Possible Duplicate:
How do I expire a PHP session after 30 minutes?
How to detect is a session ID is dead or alive? Lets suppose somebody logged in - a new session is created and I save the session ID. If he logins from another browser, I can determine that he is logged in twice. But how to detect if he logs out?
What you would need to do is when he logs in to his account on a new browser, find the old sessionID associated with his account and expire it. When he clicks a logout button, you can then retire that sessionID.
EDIT:
Sorry I read your question wrong. What you want to do is set a session timeout so if the timeout is reached, you assume the session is dead and expire it. On each page request, you will renew the expiration so that it is live. If they login from another browser, you can assume the session in the old browser is old, and expire it right off the bat or let it expire with the timeout.
You can then check session timeouts on page load, or run a cron script that will run through the session database and expire all old sessions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With