On this new website i'm making I use sessions for users to log in. I also have it so it shows who all the users are that are online and where they are and for how long etc...
Well I got this much working by storeing the page they are on, username, and there last active date in a database and I update the date everytime they go to a page. If they don't have any activity for so long it deletes them from the database.
My problem with this is to find a good way that I can make it automaticly remove them from the database if they close there browser window? I was thinking of useing a javascript pop-up that will remove them from the database when they leave the site then auto close it after. Is this the best way? I think this is what I seen other sites do...
Is there any way to tap right into the session data on the server to tell who's online?
what is the best way to do this?
Thanks