darkywarkey Posted April 1, 2009 Share Posted April 1, 2009 I've seen this many-a-times where you go to a forum and you can see a list of the users currently logged on and browsing the threads. Is there a way you can access all the session variables (logged in users) through a script, so that you can pull all of the currently online users and show them on a page? ??? ??? Link to comment https://forums.phpfreaks.com/topic/152036-how-to-show-online-users-for-a-forum/ Share on other sites More sharing options...
revraz Posted April 1, 2009 Share Posted April 1, 2009 What people normally do is use the last time the user was online. So if they accessed a page 3 mins ago, they would be considered online. You just store this time in the DB with their record. Link to comment https://forums.phpfreaks.com/topic/152036-how-to-show-online-users-for-a-forum/#findComment-798582 Share on other sites More sharing options...
PFMaBiSmAd Posted April 1, 2009 Share Posted April 1, 2009 Session variables are serialized when they are stored, so accessing all the sessions and checking for logged in users is extremely inefficient and is not the way to do this. Use the method revraz has posted. Link to comment https://forums.phpfreaks.com/topic/152036-how-to-show-online-users-for-a-forum/#findComment-798597 Share on other sites More sharing options...
darkywarkey Posted April 2, 2009 Author Share Posted April 2, 2009 I'd prefer not using the method of just checking the timelog on a given page, since the system I'm creating is going to be dependent on whether a person is actually online or not. I'm going to be allowing a form of real-time communication to occur, and I dont want someone not showing up on the active users if they have just been idle for 30min. I'm using AJAX to keep the list updated every few seconds, but I'm not sure how to track when a user leaves? I'm not familiar with any sort of function that tracks that? Link to comment https://forums.phpfreaks.com/topic/152036-how-to-show-online-users-for-a-forum/#findComment-799198 Share on other sites More sharing options...
steveangelis Posted May 12, 2009 Share Posted May 12, 2009 How would youdo that exactly? I mean with checking when a page was last accessed? And with cookies instead of sessions. Link to comment https://forums.phpfreaks.com/topic/152036-how-to-show-online-users-for-a-forum/#findComment-832792 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.