Kill Session

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phppick
Forum Commoner
Posts: 57
Joined: Thu Aug 14, 2003 5:59 am

Kill Session

Post 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...
Black Unicorn
Forum Commoner
Posts: 48
Joined: Mon Jun 16, 2003 9:19 am
Location: United Kingdom

Post 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
User avatar
phpnovice
Forum Commoner
Posts: 25
Joined: Mon Feb 02, 2004 6:47 am
Location: england, london

Post 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
Post Reply