note 59288 added to function.setcookie

From: Date: Thu, 01 Dec 2005 21:45:59 +0000
Subject: note 59288 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-99433@lists.php.net to get a copy of this message
Regarding martin's (and subsequently, Ray's) comment: To delete a cookie, your code specifies setting the expiry to time()-1. Being that the expiry is based on the *user* time, I would think that this could cause problems (based on timezones)? If your server is located on the west coast of the US (San Jose, California) and your user is located on the east coast (Miami, Florida), setting the expiry to your servers time minus 1 second means the user doesn't delete the cookie for approximately 2:59:59 (3 hours difference in time, minus one second). Unless I'm wrong about how PHP handles cookies, you'd be much safer off setting the expiry to simply '1', or Jan 1 1970. ---- Manual Page -- http://www.php.net/manual/en/function.setcookie.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59288 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59288&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59288&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59288&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59288&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59288&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59288&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59288&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59288&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99433) next »