Page 1 of 1

Permanent Cookies

Posted: Fri Jul 25, 2003 9:44 pm
by daniworldwide
I was wondering how to set a permanent cookie on someone's computer.

Code: Select all

<?php
setcookie("mid",$mid,time()+3600,"/",".site.com",0);


?>
I have that, but how do I get it so its not 3600 seconds long, (1 hour), but forever? I deleted +3600 but that did not work, I got an error.

Thanks, -Dani 8O

Posted: Fri Jul 25, 2003 11:51 pm
by qartis
Without the 'time' argument, cookies only last until the browser is exited. Your main option is to set the cookie lifetime to a larger number, like a year or two.

Posted: Sat Jul 26, 2003 9:29 am
by RTT
Just set time()+31536000*n

where n is the number of years you want the cookie to be set for