Forum Moderators: coopster

Message Too Old, No Replies

using sessions to tell which users are online

         

distorto

5:13 pm on Dec 10, 2007 (gmt 0)

10+ Year Member



Is this possible? Is there any way to return which $_SESSION['user_name'] variables are active? I feel like this should be possible, but I have looked around and found nothing.

I'm trying to display an icon that says when a user is online now. I was using a collumn in a database, but getting the logoff to happen instantaneously is giving me problems. I was trying to log people off suing a script that's triggered by the onError or onUnload events. That doesn't work very well for me, as my logoff script is a little long. I was going to do it with a cron job that runs every 5 minutes and tests when the user last did something on the site. Any help would be appreciated with login/logoff routines in general. I feel like I'm missing something.

gergoe

7:02 pm on Dec 10, 2007 (gmt 0)

10+ Year Member



I'd suggest using a database driver session handler, which makes it possible to completely control which sessions are active, and which are expired, or removed. This search [google.com] will lead you to somewhere. By implementing your own session handler will make possible to see when new sessions are created, and also your script will handle the destroying of sessions, so you can easily update sql tables from that method.