Aarclay schreef:Ik snap dat stuk wat ik er zelf nog in moet zetten na setcookie(); niet. Ik weet dus niet wat ik daar moet zetten.Wat snap je dan ook niet?
Kan je a.u.b. even wat concreter zijn?
Welkomst pagina
Heb je al op http://php.net/setcookie gekeken?
Niet rot bedoeld, maar ik heb niet het idee dat je zelf iets geprobeerd hebt.
90% van de code heb je al...
Niet rot bedoeld, maar ik heb niet het idee dat je zelf iets geprobeerd hebt.
90% van de code heb je al...
Aarclay schreef:Op die website heb ik gekeken ja, maar daar snap ik dus helemaal niks vanHeb je al op http://php.net/setcookie gekeken?
Niet rot bedoeld, maar ik heb niet het idee dat je zelf iets geprobeerd hebt.
90% van de code heb je al...

Wat snap je dan niet?
Wat heb je al geprobeerd?
Wat heb je al geprobeerd?
Aarclay schreef:Ik snap niet wat ik van die pagina na setcookie moet zetten.Wat snap je dan niet?
Wat heb je al geprobeerd?
Al naar de voorbeelden gekeken?
Pas die setcookie(); functie uit het script gewoon aan.
Pas die setcookie(); functie uit het script gewoon aan.
Zo dus?
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_COOKIE[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]redirect[/COLOR][COLOR= #007700]])) {
<[/COLOR]script language[COLOR= #007700]=[/COLOR][COLOR= #DD0000]"javascript"[/COLOR][COLOR= #007700]>[/COLOR]
setTimeout[COLOR= #007700]([/COLOR][COLOR= #DD0000]location.href="welkom.php"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]);[/COLOR]
</script>
} else {
setcookie("TestCookie", "mijndomein.ext", 1);
}
?> Waarom gebruik je javascript, als header() in PHP ook iemand kan doorsturen?
Naast dit klopt je code niet, zorg dat je gewoon weet wat PHP is, en wat HTML en JS is.
En verder klopt de naam van de cookie niet...
Naast dit klopt je code niet, zorg dat je gewoon weet wat PHP is, en wat HTML en JS is.
En verder klopt de naam van de cookie niet...
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_COOKIE[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]redirect[/COLOR][COLOR= #007700]])) {[/COLOR]
?>
<script language="javascript">
setTimeout(location.href="welkom.php",0);
</script>
[COLOR= #0000BB]<?[/COLOR]
[COLOR= #007700]}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/setcookie"]setcookie[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"redirect"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"mijndomein.ext"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]);
}[/COLOR]
?> Dit is wel correct, maar het kan zeker zonder JavaScript.
Kijk eens naar http://php.net/header...
Bovendien heb je een heel korte expire-tijd. Niet echt handig
Kijk eens naar http://php.net/header...
Bovendien heb je een heel korte expire-tijd. Niet echt handig

Maartenl schreef:[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_COOKIE[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]redirect[/COLOR][COLOR= #007700]])) {[/COLOR] ?> <script language="javascript"> setTimeout(location.href="welkom.php",0); </script> [COLOR= #0000BB]<?[/COLOR] [COLOR= #007700]}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/setcookie"]setcookie[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"redirect"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"mijndomein.ext"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]); }[/COLOR] ?>
Warning: Cannot modify header information - headers already sent by (output started at /home/ewan/domains/***/public_html/***/index.php:4) in /home/ewan/domains/***/public_html/***/index.php on line 24 Line 24:
setcookie("redirect", "***", 99999999); Die melding wordt gelukkig vaak besproken op Google en dergelijke....
Er mag geen output (HTML/whitespace) voor een header/setcookie/session_start staan.
Er mag geen output (HTML/whitespace) voor een header/setcookie/session_start staan.
Aarclay schreef:De cookie maakt hij nu maar hij stuurt niet door naar welkom.phpDie melding wordt gelukkig vaak besproken op Google en dergelijke....
Er mag geen output (HTML/whitespace) voor een header/setcookie/session_start staan.
Relevante code?
En gebruik je nu al een header() met location?
En gebruik je nu al een header() met location?
Aarclay schreef:Relevante code?
En gebruik je nu al een header() met location?
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_COOKIE[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]redirect[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Location: ***"[/COLOR][COLOR= #007700]);
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/setcookie"]setcookie[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"redirect"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"***"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]999999[/COLOR][COLOR= #007700]);
}[/COLOR]
?>