Hi all - I am having a problem with cookies. It seems that if I set the domain field in setcookie, nothing happens. I also tried creating the cookie header manually, with the same results. This is what I have:
$expireTime = time(); $expireTime += ($daysToExpire * 86400);
setcookie("Test1", "Thistest"); setcookie("Test2", "Thistest", $expireTime); setcookie("Test3", "Thistest", $expireTime, "/"); setcookie("Test4", "Thistest", $expireTime, "/", ""); setcookie("Test5", "Thistest", $expireTime, "/", ".mydomain.com.");
$COOKIE = "Set-Cookie: $cookieName=$cookieValue"; $COOKIE .= "; expires=" . gmdate("D, d-M-Y H:i:s", $expireTime) . " GMT "; $COOKIE .= "; path=/"; $COOKIE .= "; domain=; header ($COOKIE, false);
When I run this page in my browser, I get asked if I want to allow cookies Test1 through Test4, but not Test5 and Test6 - they just don't get written.
I have a perl script that does the same thing as the manual version, I have matched up character-by-character the string in $COOKIE with what is printed out by perl, but the perl works and the php doesn't.
Any clues?
thanks, andy
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php