Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Kill

Status
Not open for further replies.

ketankshah

IS-IT--Management
Jan 11, 2001
121
IN
I am logging the visitor's login session. I insert a row in a table when a visitor logs in through the login page of my site and insert the login time. I update the logout time when he/she logs out by clicking the Log out button.

How can I update the logout value, when
1) the visitor's close the browser without logging out.
2) the client machine gets switched off.

First of all can this possible?

If yes, then how?

Ketan Shah
 
Hey Ketan,

There isn't a standard way to do this reliably. About the only thing I can suggest is having either a javscript function or a hidden frame with an auto-reload function which calls a script to update the logout time with the current time. This way, the logout time will show approximately the last time the browser was on your page since that will be the last time the script updated the time. If they come back, it will start changing the logout time and you will still have an accurate time of when they were last on your site.

I don't consider this a "solution" so much as a hack but there really isn't any way to tell when somebody leaves your site or closes the browser. There are some Javascript events that happen when you close the window and such but I think you'll find their behavior isn't standard across most browsers.

Hope this helps,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top