Jump to content

finding all current sessions?


legohead6

Recommended Posts

[!--quoteo(post=378562:date=May 30 2006, 08:55 PM:name=legohead6)--][div class=\'quotetop\']QUOTE(legohead6 @ May 30 2006, 08:55 PM) [snapback]378562[/snapback][/div][div class=\'quotemain\'][!--quotec--]
how do i find all the current sessions to make a thing to show whos logged in? or is that done some other way?

Thanks
MAtt
[/quote]

Make an online column in the users table that will show 1 when logged in and 0 when not. Run a query like so:

SELECT user_id FROM users WHERE online=true

to see who's online.
[!--quoteo(post=378564:date=May 30 2006, 09:06 PM:name=witt)--][div class=\'quotetop\']QUOTE(witt @ May 30 2006, 09:06 PM) [snapback]378564[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Make an online column in the users table that will show 1 when logged in and 0 when not. Run a query like so:

SELECT user_id FROM users WHERE online=true

to see who's online.
[/quote]

o.. but how do i make it remove it if they exit? like clse the browser?
You need to also make a timestamp, and on each request this needs to be updated. Then, as it updates, it should aslo check for old timestamps (sessions are by default set to expire after 20 mins) and remove these entries.

There are better more complex ways of doing it, but that is the rough idea.
[!--quoteo(post=378584:date=May 30 2006, 10:59 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ May 30 2006, 10:59 PM) [snapback]378584[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You need to also make a timestamp, and on each request this needs to be updated. Then, as it updates, it should aslo check for old timestamps (sessions are by default set to expire after 20 mins) and remove these entries.

There are better more complex ways of doing it, but that is the rough idea.
[/quote]

i have never used timestamps before....umm....can you show me how?

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.