note 33133 added to function.setcookie
| From: | fandelem at Hotmail dot com | Date: | Tue, 17 Jun 2003 14:27:23 +0000 |
| Subject: | note 33133 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-50499@lists.php.net to get a copy of this message | ||
i have noticed this after 5 pain-staking hours:
Going to indiewatch.com/test.php?do=gen, which does:
setcookie('id', $unique_id, $expiry);
then, closing browser, re-opening, and going to www.indiewatch.com, will yield a blank $_COOKIE
array.
However, going to www.indiewatch.com/test.php?do=gen, having the cookie being set, then closing the
browser, re-opening, and going to www.indiewatch.com will yield an element in $_COOKIE called
'id'.
Are there any solutions for this? Perhaps a better one than I will contribute, so I wait in
anticipation for responses.. below is my solution:
setcookie('id', $unique_id,
$expiry,'',str_replace('www.','',strtolower($HTTP_HOST)));
this will allow someone who has created a cookie by going to www.indiewatch.com to have it loaded
when they go to indiewatch.com.
cheers,
k.
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33133
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33133&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33133&report=yes