Page 1 of 1
Session Problem
Posted: Thu Jun 12, 2003 1:52 am
by k1ndkam
i wanted to know is there a way to set session time out in php because i am developing a user authentication system where if the user presses log out then the session could be destroyed but if the user does not press it then how long will it take to log out and again sign in and how can i anage this problem .
Thanks
Posted: Thu Jun 12, 2003 2:11 am
by cactus
What kind of sessions are you using ? Cookies or database ?
Regards,
Posted: Thu Jun 12, 2003 4:49 am
by delorian
The standard session time out in php is set to "until the browser is closed." If you want to set this to something different you should first read the php manual
http://php.net/manual/en/ref.session.php - there's a lot about the things you're asking
Posted: Thu Jun 12, 2003 4:51 am
by k1ndkam
My session files are saved in temp directory and I am talking about cookies i also wanted to know how these files could be deleted automatically after session ends.
Regards
Posted: Thu Jun 12, 2003 5:04 am
by cactus
delorian's link to the manual page explains exactly what you need, but dependant on the OS you are using you may have issues.
The session_destroy() method should clean up your expired sessions, the default TTL is 1440 seconds.
Posted: Thu Jun 12, 2003 8:11 am
by volka
which doesn't mean the files vanish instantly after 1440 seconds.
How often php searches for old session files is controlled via
session.gc_probability
Posted: Thu Jun 12, 2003 8:14 am
by cactus
Very true.
Posted: Thu Jun 12, 2003 12:47 pm
by oldtimer
cactus wrote:
The session_destroy() method should clean up your expired sessions, the default TTL is 1440 seconds.
Yes session_destroy() works great but instead of just going back to the index page or whatever I refresh to a kill page after destroying it. Then it refreshes to the page I want it to go to. This way You can not hit the back button and still have session.