run code on session destroy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ktrw25
    New Member
    • Feb 2007
    • 17

    run code on session destroy

    I need to find a way when a user closes the browser (not a refresh), to make a log entry into a txt file of the date/time logged out. I have a logout function, but it only works if they hit the log out button. I need to be able to run some code to see if a session is destroyed on the server to make a log entry. Users will be frequently logging in/out & I need to record each entry, so a cronjob will not work. I have not found a way in javascript to distinguish between a refresh or a close. I think checking if the session is destroyed & if it is, then make a log entry would be a good train of thought, but I do not know how.

    Any suggestions?
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Would

    <body onunload="javas criptFunction() ">

    work?

    Comment

    • ktrw25
      New Member
      • Feb 2007
      • 17

      #3
      Unfortunately that code runs when you refresh the page and when you click the close button. I only want it to happen when the page has been closed

      Comment

      Working...