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.
Link to comment
Share on other sites

[!--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?
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

[!--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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.