Re: a cookie that never expires
| From: | Joao Prado Maia | Date: | Thu, 12 Oct 2000 20:43:32 +0000 |
| Subject: | Re: a cookie that never expires | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19883@lists.php.net to get a copy of this message | ||
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