Your Session Has Ended!
You often see a message that says "You are logged out because your session has ended"
How do you check (in PHP) that the session has ended?
if you go to a site that users session and bookmark the site on a page that requires a login then when you close and open your browser the session is lost(it is a cookie that is deleted when the browser closes)
the best way to check this is say you have $_SESSION['login'] and you set that to true when a user logsin then you can say
//You are logged out because your session has ended
You could store a timestamp in the session data, and if it is more than X seconds old when a page is accessed, you could show such a message and have them log in again. Or you could just let PHP's session settings delete the session data when it gets past a certain age, and if a user accesses a page with a session cookie but has no session data, then show that message and have them log in again. (See the session runtime config options, in particular the session.gc_probability, session.gc_divisor and session.gc_maxlifetime settings.)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)