note 51421 deleted from function.setcookie by nlopess

From: Date: Thu, 29 Sep 2005 08:32:10 +0000
Subject: note 51421 deleted from function.setcookie by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-95961@lists.php.net to get a copy of this message
Note Submitter: Daine Mamacos ---- I found with Internet explorer (ver 5 and 6) that I was unable to delete cookies by setting the expiry to 1 (1 second after the epoch). This was causing me headaches because it worked with every other browser except for internet explorer. The solution, though timely and weird, I figured out was that (as far as I can figure) M$ don't consider 1970 the epoch, they consider 1980 the epoch. Or something like that. So to expire a cookie on internet explorer you can set the expiry according to the following formula. //10 years less the 2 yeas which have leap years (60*60*24*365*10) = 315360000 //add 2 extra days for the missing leap years. 315360000 + (60*60*24*2) = 315532800 So one can use this to expire a cookie: setcookie("MyCookie", "BLAHBLAH", 315532800, "/"); I found that this number was the minimum I could set it to, one second less, and it would not expire the cookie.

« previous php.notes (#95961) next »