Page 1 of 1

Handling uncontrolled Logoff from Website

Posted: Mon Aug 02, 2004 5:54 am
by beath
hiya

i'm having a problem with a counter that shows the numbers of logged-in users. the bookkeeping works fine, if the users logoff from the website by using the logoff-button. but if they just close the browser, they still remain as active. this is not exactly a language-based problem, more a conceptual problem.

any ideas?

thanks and hang loose
beat

ps: i'm aware of the fact, that in general this is a client-side problem, but perhaps there are any ideas how to deal it with a server-script...)

Posted: Mon Aug 02, 2004 7:06 am
by CoderGoblin
Normal method during bookkeeping is to log when the user has performed something/reloaded. Then If current_time greater then last time done something time + (fixed time period) assume they are logged out.

Posted: Mon Aug 02, 2004 2:16 pm
by evilmonkey
Alternatively, if you're using the OO approach, and each user is an object, you can set up a destructor to log the user off (destroy the session, I guess)...

Posted: Mon Aug 02, 2004 2:20 pm
by John Cartwright
yea the best way to go is in the users table each time they reload the time update the time, and when someone else comes on the page get your script to see if the time of the last activitiy is longer than like 5min, and if so change their status to logged off