How can I make it so my cookie never expires? If that's not possible, what's the maximum time I can set it to?
My cookies always expire too soon and I have to login again in the middle of stuff.
Printable View
How can I make it so my cookie never expires? If that's not possible, what's the maximum time I can set it to?
My cookies always expire too soon and I have to login again in the middle of stuff.
Just set it to expire in like a year. (http://www.php.net/manual/en/function.setcookie.php)
What would be the value for year? I see that "time()+3600" gives an hour.
So would "time()+31536000" give a year? Or something else?
I would imagine, if that's 60 * 60 * 25 * 365...I think that's how I programmed the TT cookies *looks at source*
Here's my setcookie.php, nice little page I wrote:
PHP Code:<?
if ($delete)
{
setcookie($name, '', time() - 3600); // Setting to the past deletes
}
else
{
setcookie($name, '', mktime(12, 0, 0, 1, 1, 2005));
}
header("Location: $returnto");
exit;
?>
PHP Code:setcookie("myCookie", "Any Value", Time() + 7*24*60*60);
// a week lasts 7 days, a day lasts 24 hours, a hour lasts 60 minutes, a minute lasts 60 seconds