Page 1 of 1

cookie question

Posted: Mon Aug 30, 2004 5:53 pm
by punctweb
I have a question: when you set a cookie using setcookie(), that cookie lives as long as you specified, right ? Right. Let's say that i have a cookie that lives 3 hours. How can i find out how much time has remained until that cookie expires ? Where is stored the cookie time ? Can i use it in a variable, let's say $timout = cookie_time; ?

Thanks in advance and excuse my english.

Posted: Mon Aug 30, 2004 5:57 pm
by feyd
when sent back, the cookie data only contains the value you set it to. So, you could store the time you set for it to die, inside that value, or store it on the server somewhere.

Posted: Mon Aug 30, 2004 6:02 pm
by ol4pr0

Code: Select all

set_cookie("cookie_name", "cookie_value",time()+3600,"/");

Posted: Mon Sep 06, 2004 5:54 pm
by punctweb
ok, since there is no other option, i choosed to set a value in the cookie equal to the time when that cookie was created...