RE: [PHP] setcookie problem

From: Date: Mon, 02 Jul 2001 19:32:39 +0000
Subject: RE: [PHP] setcookie problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55888@lists.php.net to get a copy of this message
this is my guess at what's happening... i dont know 100% if that's why cookies aren't setting properly, but here's an educated guess on my part: probably becuase time() is seconds since 1970, and as far as i understand, once it gets over 999,999,999 it will not work correctly becuase it will roll over (similar to the Y2k bug) and become 000,000,000 for example: 00,900,000,000 - current time (for example) 36,000,000,000 - what you're trying to add -------------- 36,900,000,000 - result but the buffer is only big enough for 999,999,999 and so the computer truncates the leading "36" and leaves you with 900,000,000 (which was the exact time that you set the cookie, making it expire as soon as you set it) instead of adding such wildly huge numbers, try adding 1-2 years... besides, it's kind of scary to think that your cookies might outlive you, if that timestamp was really acceptable :) > -----Original Message----- > From: Mark Lo [mailto:mark@3dsources.com] > Sent: Monday, July 02, 2001 12:33 PM > To: php general > Subject: [PHP] setcookie problem > > > Hi, > > How to set a forever cookie into client machine. I use the following > syntax to set the cookie, but when I close the brower's window, then the > cookie is deleted when the browser closed. > > setcookie("buyerid",$email,time()+36000000000,"","$domain"); > > setcookie("buyeridpasswd",$passwd,time()+36000000000,"","$domain"); > > > Thank you for your attentions, > > > Mark Lo > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#55888) next »