Re: a cookie that never expires

From: Date: Thu, 12 Oct 2000 21:36:34 +0000
Subject: Re: a cookie that never expires
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-19885@lists.php.net to get a copy of this message
For one year, you could just do $year=60*60*365; ... ----- Original Message ----- From: "Joao Prado Maia" <jpm@kefta.com> To: "Juan Luis Baptiste" <jbaptiste@nextmedia-i.com> Cc: <php-general@lists.php.net> Sent: Thursday, October 12, 2000 1:43 PM Subject: Re: [PHP] a cookie that never expires On Thu, 12 Oct 2000, Juan Luis Baptiste wrote: > Can I set a cookie that never expires? or ona that expires a year from now? > Hello Juan, Try this piece of code: <?php $year = 60 * 60 * 24 * 30 * 12; // The one below means 1 year, you can just increase it for more years $lifetime = time() + ($year * 1); setcookie("name", "value", $lifetime); ?> There you go. Now, it isn't perfect because it doesn't compute 31 days and all that stuff, but oh well. Regards, Joao -- Joao Prado Maia Web Developer Kefta, Inc. T: (415) 391-6881 ext 8008 F: (415) 391-7079 -- 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 (#19885) next »