Page 1 of 1

when a user close the browser without login

Posted: Sat Apr 19, 2008 7:41 am
by djdon11
Hello Friends.
I am facing a problem
actually i have to show my user that who is online and offline right now for this i am using a database table. when user login than i make a entry of this record along with the user id and date time. and using these records i can show who is online.
when user logout through logout link than i delete the record along with this userid.

my problem is when user close the browser without logout link than user get logout but the entry which is in the database table is not deleted. as the user does not goes over the logout page and the delete query is not executed..
can anybody suggest me any solution that how i can execute my delete query when user goes logout via the browser closed.


thanks in advance

Re: when a user close the browser without login

Posted: Sat Apr 19, 2008 8:13 am
by onion2k
You can't. If the user closes the browser window without logging out there is no way to tell. You have to record the time the user last interacted with the site and assume that they've logged out after a certain time eg 5 minutes with no activity.

Is this a class assignment for college or something? We've had this question asked here a few times in the past week. If it is, why don't you talk to your classmates?

Re: when a user close the browser without login

Posted: Sat Apr 19, 2008 8:17 am
by aceconcepts
I don't see a problem with logging a user out after a certain period of time.