Page 1 of 1
Session handling
Posted: Tue Jul 10, 2007 10:26 am
by aceconcepts
Hi,
How would I destroy/end a visitor's session after a particular period?
And, how would I make their session last longer than the default 1440?
Thanks.
Posted: Tue Jul 10, 2007 10:46 am
by arturm
You can use
session_destroy() to remove user session i.e. when he clicks LOGOUT button.
php kills session automatically after some time.
You can define it in php.ini:
session.gc_maxlifetime
Posted: Tue Jul 10, 2007 11:01 am
by aceconcepts
I don't have access to the php ini file. How can I destroy the session after a period e.g. 1minute (just to test it).
Posted: Tue Jul 10, 2007 11:32 am
by arturm
This should work (on top of the page before you start a session):
Code: Select all
ini_set('session.gc_maxlifetime', 60);
Posted: Tue Jul 10, 2007 11:35 am
by arturm
There are some other issues with changing session timeout
check this website out
http://www.captain.at/howto-php-sessions.php