Hyaku_ Posted July 6, 2006 Share Posted July 6, 2006 Hi!I'm using sessions on my website. I want users to be logged out automaticly after they leave my website, instead of manualy logging out all the time! And I need the session to be destroyed imidietly not after some time! Is this posible? Any suggestions? Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/13874-how-to-destroy-session-after-user-leaves-the-website/ Share on other sites More sharing options...
SharkBait Posted July 6, 2006 Share Posted July 6, 2006 You cant really tell if someone has left your site. They could of closed it, quit it, their machine could crash. Only way I guess would be to somehow set up a cron job to go through the directory were the sessions are kept and if they havent been used within a set time, delete it? Quote Link to comment https://forums.phpfreaks.com/topic/13874-how-to-destroy-session-after-user-leaves-the-website/#findComment-54039 Share on other sites More sharing options...
wildteen88 Posted July 6, 2006 Share Posted July 6, 2006 You cannot destroy the session immediatly as soon the user leaves your site. The only the way you do this is to lower the lifetime of the session, to something like 5mins however if the user leaves his computer for 5mins or more thier session will be destroyed, thefore when they return they'll most probably get a session timeout error message of some sort.Also sessions become invalid when the user closes their browser and goes to return to your site. Quote Link to comment https://forums.phpfreaks.com/topic/13874-how-to-destroy-session-after-user-leaves-the-website/#findComment-54041 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.