Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Session Timeout Help
06-30-2007, 11:32 AM #1
- Join Date
- Aug 2002
- Oregon, United States of America
- Thanked 9 Times in 9 Posts
Session Timeout Help
I have had problems with getting Session Timeouts to work the way I think they should in PHP. (PHP5) Please help me obtain the following:
Note: All pages on my site call a PHP page where i can put the session script I need help creating.
I want to do the following:
- Session times out after 1 hours of inactivity. (Not changing pages or running AJAX.)
- After 5 and a half hours from the first log in, if the user is still active, prompt them to log in again and start thier session timer over winthout clearing thier session data.
- If they have not logged back in, at the 6 hour mark, thier session is terminated.
The reasoning for this is the application I am creating is a Web Application which could very well be left open on someones machine for an entire day or longer. So if through the day that are using the application, i want them to be able to restart thier session timer without losing thier session data. However I need it to log them out after 6 hours for security.
Any help?If I'm postin here, I NEED YOUR HELP!!
06-30-2007, 10:52 PM #2
- Join Date
- Dec 2005
- Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
- Thanked 637 Times in 625 Posts
You need to store two timestamps: login timestamp, and lastActivity timestamp. Each page includes a function that check lastActivity and logs the user out (destroys the session) if it is more than 1 hour ago, and checks login timestamp and logs the user out if it is more than 6 hours ago. The function then updates the lastActivity timestamp.