Page 1 of 1
Session in PHP
Posted: Wed Jan 27, 2010 9:41 pm
by nithinkk
Hi , i want to know how to check whether session is expired or not and when the session is expired i want to update the time as logout time in database...if a user closes the browser without signout what to do? i want to update logout time in database...can any one tell me the PHP code to do that ???
Every 10 minutes it must check whether the session is expired and if expired update the signout time
Re: Session in PHP
Posted: Wed Jan 27, 2010 10:07 pm
by flying_circus
There were some idea's tossed around in your previous thread, but I think I would implement my system as such:
We aren't going to get an accurate logout time, we'll basically have a window of time to work with.
- When your user logs in and on every subsequent page request, update a timestamp associated with their account.
- Determine a maximum allowable time for which your user may remain logged in, without activity (example: 14 minutes).
- If your user tries to access a page after the max allowable time, they will need to re-login.
- On this login, if there is a time stamp present on their account, move it to another field in your database, such as "last logout".
- This will give you a logout time that is accurate within 14 minutes of the actual logout event.
I hope I have portrayed my idea clearly.