Teonynn Posted May 15, 2010 Share Posted May 15, 2010 Hello all - I have what is becoming a perplexing problem. I have a login / logout session-based system, that also writes a cookie to check to see if the user is really who they say they are. When they log in, it sets them to "online"... when they log out the proper way, the site then sets them to "offline". However - many users don't log out the proper way. They just leave the site. What is the best way to forcibly set them to offline after, say, fifteen minutes of inactivity once they've closed all the pages related to the site and the site itself no longer has access to their system to check? Link to comment https://forums.phpfreaks.com/topic/201822-logging-users-out-after-they-leave-the-site/ Share on other sites More sharing options...
kenrbnsn Posted May 15, 2010 Share Posted May 15, 2010 Set a "last used time" for each user in your database (I'm assuming you're using a database) and have a cron job run every 5 minutes to check if each user's "last used time" is within the time limit. If it's not, logout the user and set them offline. Ken Link to comment https://forums.phpfreaks.com/topic/201822-logging-users-out-after-they-leave-the-site/#findComment-1058601 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.