Re: Logout

From: Date: Mon, 27 May 2002 22:25:24 +0000
Subject: Re: Logout
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-99400@lists.php.net to get a copy of this message
Jonas ? wrote:
1. I'm building this community thing and I have a text file with the users that is currently logged in. When they press logout there name is deleted from the textfile, but if they just close there browser or surf to another site there name is still in the text-file until they log out next time. Any ideas how to avoid this?
What you should do is save for each user the last time he was "seen" in the site: the value of this time is updated for each page he or she loads. Then, when checking to see if a user is currently logged in, you check how long ago was he last seen. If it was more than X seconds/minutes/etc. (this is for you to set), she is considered "offline" and you can remove him from the file. Best Regards, Sagie Maoz n0nick@php.net

« previous php.general (#99400) next »