note 39840 deleted from function.setcookie by tularis
| From: | tularis@php.net | Date: | Sun, 02 Jan 2005 14:18:53 +0000 |
| Subject: | note 39840 deleted from function.setcookie by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82582@lists.php.net to get a copy of this message | ||
Note Submitter: Luis Hernandez
----
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.