note 30474 deleted from function.setcookie by irchtml
| From: | irchtml@php.net | Date: | Wed, 25 Feb 2004 07:27:45 +0000 |
| Subject: | note 30474 deleted from function.setcookie by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65695@lists.php.net to get a copy of this message | ||
Note Submitter: lexcomputer
----
** Modifying from the former poster **
The script that help to solve the problem of calling cookie for the first time, which return nothing
(strlen($cookie)=0).
<?php
// This script named testcookie.php
$cc = strlen($mycookie);
if($cc==0){
setcookie("mycookie", "mycookie", time()+3600);
//3600 is an hour, in seconds
Header("Location: testcookie.php");
// testcookie.php is the document itself
exit();
} else {
if (!isset($mycookie)) {
echo "Your browser does not support cookie";
} else {
echo "Your browser does support cookie";
}
}
?>
hope this script could help you :-)