nadeemshafi9 Posted November 13, 2008 Share Posted November 13, 2008 Hi guys im looking for some theory not code, what is the best way or any way to check if the user is online and when they are offline. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/132576-check-if-user-is-online/ Share on other sites More sharing options...
premiso Posted November 13, 2008 Share Posted November 13, 2008 You have to do it with last_time_seen. Basically you cannot really have an up-to-date deal the best way is to have a table with the time the last user is seen, if that time is greater than X minutes they are not longer online. SO you would just check that on page load to see whose time < X minutes if it is they are considered online. Along with that you have to set the last_seen each time the user goes to another page. Quote Link to comment https://forums.phpfreaks.com/topic/132576-check-if-user-is-online/#findComment-689373 Share on other sites More sharing options...
flyhoney Posted November 13, 2008 Share Posted November 13, 2008 If you're using a database to manage user's sessions, you could simply query the database for all active sessions. That should tell you how many user's are logged in. Quote Link to comment https://forums.phpfreaks.com/topic/132576-check-if-user-is-online/#findComment-689376 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.