www.webdeveloper.com
Results 1 to 5 of 5

Thread: Detecting dead users

  1. #1
    Join Date
    Oct 2010
    Location
    UK
    Posts
    11

    Cool Detecting dead users

    Hi,

    I know there are the event handlers onBeforeUnload and onunload, which work great 90% of the time.

    But what would happen if a user who was in the system had a power cut? Would it then be down to the database that stores who is logged in to go through logging users out who havent done anything for a while?

    Or could you use the PHP function 'exec' to ping the users IP address and if there is no response, log them off?

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    You may use a server-side session cookie which expires when the user leaves the site. Should work even if the system has a power cut.

  3. #3
    Join Date
    Oct 2010
    Location
    UK
    Posts
    11
    Would my way work though? As the CGI stuff looks very complicated :/

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by imperium2335 View Post
    Would my way work though? As the CGI stuff looks very complicated :/
    Not more complicated than a client-side solution. But most of the time better:

    http://www.tizag.com/phpT/phpsessions.php

  5. #5
    Join Date
    Oct 2010
    Location
    UK
    Posts
    11
    So PHP would destroy a session if a user had a powercut or otherwise left the site? I know abit about these so I could use them, but I thought they persisted for a while after the user vanished?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles