RE: [PHP] problems with cookies and PHP
| From: | Bryan Lipscy | Date: | Thu, 13 Feb 2003 20:50:51 +0000 |
| Subject: | RE: [PHP] problems with cookies and PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135514@lists.php.net to get a copy of this message | ||
I have been playing with this at home.
Perhaps this makes it a bit easier.....
boolean setcookie ( string name [, string value [, int expire [, string
path [, string domain [, int secure]]]]])
boolean setcookie (name, value, expire, path, domain, secure)
<?php
if(!isset($_COOKIE['userInfo'])){
setcookie("userInfo","temp",0,"/","faxonautoliterature.com",0);
print "set temp";
} else {
if($_COOKIE['userInfo']=="temp"){
setcookie("userInfo","userID",time()+60*60*24*30,"/","faxonautoliteratur
e.com",0);
print "set info";
}
}
?>
Fwiw, a solution from another project:
<?
if (empty($_COOKIE["uuid"])){
$token = md5(uniqid(rand(),1));
setcookie ("uuid", $token,
mktime(23,59,59,2,28,2003),"/poll/","ukiuki");
print "Cookie set: ".$token;
} else {
print "Cookie exits: ".$_COOKIE["uuid"];
}
?>