Hey. i want to make a cookie last forever, so i put like 999999999999 as its expiration time but that made it not work at all. I think putting 0 makes it last as long as the browser is open, so how do i make it last forever (or at least a really long time).
Cheers
Why do you need it to last forever? Surely if the user hasn't visited you site in two years they no longer need the cookie anymore and whenever they return to your page you're going to add the cookie and reset the expiration time. Rob
yup. fair point. ok, does anyone know then what the maximum time is? cos at the moment this cookie is only lasting about 2 days and thats no good, and its SUCH a hassle to keep changing the time, testing it, looking at the cookie , and keep doing that till i got it....
try generating your timestamp like this
$time=mktime(0,0,0,date("n",time()),date("j",time()),date("Y",time())+1,0);
This will set the cookie expiration time as exactly one year away. HTH Rob