note 9156 deleted from function.setcookie by john

From: Date: Sat, 30 Nov 2002 16:12:28 +0000
Subject: note 9156 deleted from function.setcookie by john
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-40149@lists.php.net to get a copy of this message
Finally, I could overcome the "cookie monster". The setcookie() function was not working correctly in IE4SP1. Therefore, I tried the header directive to set the cookie. However, unless a large value for the time was given, it kept deleting the cookie instead of setting it. I finally found out that this "large" time was the difference between the local time and the GMT time. I was setting the "expire" parameter by calling the strftime("%A, %d-%b-%Y %H:%M:%S", $exp) function to convert the time to the required format. After changing that syntax to gmstrftime("%A, %d-%b-%Y %H:%M:%S", $exp), the cookies work very well in all the browsers. Remember send the GMT time and not the local time.

« previous php.notes (#40149) next »