View Full Version : Logging out trouble?

07-05-2007, 08:07 PM
Hi, when i login the username appears on the online users box, when you logout it goes. However if you close the internet browser instead of logging out the username stays and you username will show more than once if you close the internet browser again and again until you press logout. I know why the problem is, it is because when you logout it deletes the username, how can i avoid that problem, any ideas???

07-05-2007, 08:51 PM
You need two things:

1) When you login, you delete any existing login sessions for your name.
2) You create a script that executes on every page that checks for "idle" users. Any user over a specified time (10 minutes for example) is then automatically logged out.

For #2, when someone logs in, you log the date/time in their own "last activity" field. Every page the user accesses, their date/time activity is updated to the current time. Before updating the date/time activity field for the user, however, you check ALL USERS' date/time activity fields to see if their last activity is more than 10 minutes behind the current date/time. If it's been more than 10 minutes from the current time, you log them out.


07-06-2007, 11:30 AM
do you know anywhere that i can get a script like that