pedjasmek Posted November 6, 2007 Share Posted November 6, 2007 Expire time in the cookie I use is next year but it expires few minutes later.Is there some setting(s) I'm missing? Link to comment https://forums.phpfreaks.com/topic/76213-cookie-expire/ Share on other sites More sharing options...
MadTechie Posted November 6, 2007 Share Posted November 6, 2007 post code example setcookie("TestCookie", "blar", time()+3600); /* expire in 1 hour */ Link to comment https://forums.phpfreaks.com/topic/76213-cookie-expire/#findComment-385724 Share on other sites More sharing options...
pedjasmek Posted November 6, 2007 Author Share Posted November 6, 2007 Is this code wrong: setcookie('username',$_SESSION['korisnicko_ime'],mktime(12,0,0,12,31,2008)); Link to comment https://forums.phpfreaks.com/topic/76213-cookie-expire/#findComment-385803 Share on other sites More sharing options...
revraz Posted November 6, 2007 Share Posted November 6, 2007 Not sure if you can use mktime in a cookie like that. I've always done it with time () Easy way to do it is to multiply seconds * minutes * hours * days So time()+60 * 60 * 24 * 365); would equal 1 year. Link to comment https://forums.phpfreaks.com/topic/76213-cookie-expire/#findComment-385807 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.