Re: How to make a cookie never expire in PHP?

From: Date: Sat, 28 Jul 2001 12:20:10 +0000
Subject: Re: How to make a cookie never expire in PHP?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60038@lists.php.net to get a copy of this message
"Joel" <joelagnel@spamex.com> skrev i en meddelelse news:20010728121025.1692.qmail@pb1.pair.com... > I can use cookies with PHP but I can't make the cookie last forever. No - because it can't be done. > I can set the cookie to expire for upto 1 hour. > This is the code : > setcookie("bookmarks","cookievalue",time()+3600); > That would make the cookie expire after an hour. Yes. > How do I make the cookie not expire at all? You can't. The closest you get to never is x years. > If I don't mention any expiration time, the cookie expires as soon > as quit the browser. Can I use date instead of time? No. Setcookie requires a the time to expire in seconds: setcookie("bookmarks","cookievalue",time()+3600*24*30*12*10); // This cookie will expire after 10 years. -- Mvh./Best Regards Jonas Delfs, http://delfs.dk "Developers are being asked to do more with less, do it faster, and make it fit with the existing systems and databases." - IDC

« previous php.general (#60038) next »