how to kill the session cookie after a period of time in php
841
if I define the session.cookie_lifetime to be zero so the cookie will only be killed after the browser is closed. but if I want to sent a max time which after that even if the browser was not closed the session will end anyway???? integer
Answer
Solution:
This makes the cookie to be expired in one hour.
More about setting cookie is at here.
Answer
Solution:
Assign value for
session.cookie_lifetime
in PHP ini file.session.cookie_lifetime=300
for 5 minsAnswer
Solution:
Normal Cookie From php.net The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. In other words, you'll most likely set this with the time() function plus the number of seconds before you want it to expire. Or you might use mktime(). time()+60*60*24*30 will set the cookie to expire in 30 days. If set to 0, or omitted, the cookie will expire at the end of the session (when the browser closes).
That will give a nice long cookie.
Session Based Cookie php.net link [http://www.php.net/manual/en/function.session-set-cookie-params.php] For Session cookies use an int in seconds [360 = 6mins or 21600 = 6hours]
Also, for the session() cookie type make sure to add it before you start the session