[Admin Edit: Moved from modcp.php?t=9726]
SBukoski:- Hey can you provide some kind of sample code. I am also in the same boat as the user who posted this message. How can I delete or force session to revalidate when a user doesnt log out, but closes the browser.
Another question I have is, how can I force the session to expire after certain time of inactivity, for ex:- something similar to yahoo mail or hotmail. If a user logs in, but is inactive for certain amount of time, and after that time, when the user clicks on one of the links, he has to login to the site, since his session has expired. Thank you for any help or sample code. Thank You
Ending sessions when the browser is closed
Moderator: General Moderators
-
pistolfire99
- Forum Commoner
- Posts: 58
- Joined: Thu May 23, 2002 3:18 pm
In this thread I show some sample code for using a cookie authenticator to protect a session. It includes the auto-expire requirements without requiring either PHP's sessions garbage collection or tracking of old sessions in a database. The script (the second version, linked near the end) probably needs some tweaking to work for you, but it should give you a decent starting point.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK