Page 1 of 1

Kill Session

Posted: Mon Mar 15, 2004 4:05 am
by phppick
Hi

How to Kill the Session if the User uses Window X Button insted of "Logout" hyperlink?? What is the default PHP session timeout and How to change it for my Site??

Check me...

Posted: Mon Mar 15, 2004 6:28 am
by Black Unicorn
I think it is 300 seconds for a session to time-out.

To change it, you can use
ini_set(session.gc_maxlifetime, 300); or something before session_start.

When closing windows, think it's a bit faster.

Hope that helped,
H Rage

Posted: Mon Mar 15, 2004 6:32 am
by phpnovice
ah php has garbage collection. im not sure of the default but the settings can be found in your php.ini. the setting names are: session.gc_probability and session.gc_maxlifetime. i think the default for lifetime is 1440 secs. the probability works like so: if you have it at 100% then garbage collection will run every time a new session is initialised. i.e. a call to session_start() and 50% will do it 50% of the times session_start is called.

hope that helps!

James