note 39840 added to function.setcookie
| From: | LuisHernandez at rn2 dot php dot net | Date: | Thu, 12 Feb 2004 14:27:44 +0000 |
| Subject: | note 39840 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65051@lists.php.net to get a copy of this message | ||
As mentioned in a few other notes, if the client date earlier than the server, then you could find
setcookie("name", "value", time()-3600);
failing to clear the cookie, because the on the client's side an hour earlier than the server
is still in the future. You could just keep increasing the amount you subtract from time(), but
it's an ulgy solution. As far as I can tell, people haven't suggested using mktime (the
doc mentions it's an option).
So, for example, you can instead execute
setcookie("name", "value", mktime(12,0,0,1, 1, 1990));
if you assume no user will have their clock set to be before 1990.
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39840
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39840&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39840&report=yes
Search -- http://master.php.net/manage/user-notes.php