Results 1 to 3 of 3

Thread: Updating DB when a user leaves my site...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    South Africa
    Posts
    113

    Question Updating DB when a user leaves my site...

    Hi,
    I need to keep track of users connected to my site at one time. So when a user logs in its easy to just update a counter of users. But, when a user leaves my site, they might just close the page, and not log out, so...how do I update the db if they just close the page?

    Is there a server side function that can be called onExit of a web site???

    Thanks in advance
    You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    You could either do it when the session times out (by default, it's about 20 minutes).

    Or, using javascript, when the user closes the current window, a tiny window opens up which simply updates the database that the user has left the "building"

    HTH

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    South Africa
    Posts
    113

    Great, thanks

    whats the Javascrip function for when a window has been closed?

    Also, what about if the user exits my site by entering a new url, and doesnt close the window?
    You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width