janim Posted December 24, 2007 Share Posted December 24, 2007 hi guys how can i know the online logged in users ?? let's say when login update table set log = '1' and when logout update it to '0' so how can i know if he closed the browser or not ? couse the people don't click logout they just close the browser thank for any suggestion Link to comment https://forums.phpfreaks.com/topic/83073-users-online-question/ Share on other sites More sharing options...
Northern Flame Posted December 24, 2007 Share Posted December 24, 2007 they show you how on this post http://www.phpfreaks.com/forums/index.php/topic,171853.0.html Link to comment https://forums.phpfreaks.com/topic/83073-users-online-question/#findComment-422594 Share on other sites More sharing options...
pocobueno1388 Posted December 24, 2007 Share Posted December 24, 2007 You need to make a datetime field in your users table called something like "last_active". Then on your header page (so the code is called every time they click) you need to put a query that updates that field to the current date/time (you can use the function NOW() to do that). Now to get the current users that have been active in the last 5 minutes, your query would look like this. SELECT username FROM users WHERE last_active > (NOW() - INTERVAL 5 MINUTE) Link to comment https://forums.phpfreaks.com/topic/83073-users-online-question/#findComment-422597 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.