manix Posted August 8, 2011 Share Posted August 8, 2011 Hey, I'm creating one of those bars where you can see the currently online users, but I'm having trouble with finding out how to detect when a user logs out (or leaves the website with "remember me" checked). How is that done? Quote Link to comment https://forums.phpfreaks.com/topic/244258-user-logout/ Share on other sites More sharing options...
WebStyles Posted August 8, 2011 Share Posted August 8, 2011 it's done with a timestamp, that keeps updating whenever the user performs an action or changes pages... then you check the database for all timestamps older than (3 minutes? or whatever you want) and delete those from the onlineUsers list. I have explained this several times in detail here, and so have many others. try searching the forum. Quote Link to comment https://forums.phpfreaks.com/topic/244258-user-logout/#findComment-1254565 Share on other sites More sharing options...
AyKay47 Posted August 8, 2011 Share Posted August 8, 2011 i normally do this with a database, when a user logs in, i set a field named something like "online" to a value of 1, when a user logs out, I set it to 0...to get a list of online users, display all of the rows where online = 1 Quote Link to comment https://forums.phpfreaks.com/topic/244258-user-logout/#findComment-1254574 Share on other sites More sharing options...
WebStyles Posted August 8, 2011 Share Posted August 8, 2011 here's an example of the same situation: http://www.phpfreaks.com/forums/index.php?topic=339392.msg1599844#msg1599844 Quote Link to comment https://forums.phpfreaks.com/topic/244258-user-logout/#findComment-1254575 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.