Jump to content

How can i check all Sessions? or...


DarrenReeder

Recommended Posts

Hello,

 

I am trying to make a 'All players logged' on my site and i want to make it so i see all the sessions that are connected to the site, then dispay them all...

 

 

OR is it possible that if i have a field called 'logged' and When yuo connect it sets to '1' then if you close the browser/logout it sets to '0'? thiss seems a bit more dodgey though

Link to comment
https://forums.phpfreaks.com/topic/184555-how-can-i-check-all-sessions-or/
Share on other sites

There is no way of changing a value via PHP when the user closes the browser or navigates away from your page, the only way that would work is if your users always use the logout link you provide for them. One way round it is to have a last_action value stored. Each time the user performs a request to your site, (ie loads a page, if you wish to allow people to idle you could use AJAX to force the requests) you update this timer, you can then either have a scipt ran via cRON jobs to remove inactive users every x amount of minutes or you can make clients trigger the action. In other words when somebody requests this list of 'online users' it trims it down before displaying it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.