Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006

    Question users online script

    i have been looking at some users online php scripts that when embedded into your website it can tell you how many users are currently browsing your website.
    My question is, how can the script tell when users leave the website? When a person closes their web browser does it send some info to the website to tell it it's going offline?

  2. #2
    Join Date
    Nov 2001
    Rather than answering part of the question "When a person closes their web browser does it send some info to the website to tell it it's going offline?" might I recommend you download tcpwatch:

    Set it up as a proxy so you can watch the browser to server communications between your client browser and a site you are interested in emulating. Note whether there is or is not any traffic when you switch pages , close tabs or close browser window, or otherwise leave.
    “Even those who arrange and design shrubberies are under
    considerable economic stress at this period in history.”

  3. #3
    I believe for the most part, these "Users Online" scripts simply add the browsing user to a database and attach a timestamp to their requests, effectively just a "last access" time. If the "last access" time exceeds a certain number, they assume the user is offline and clear the record(s) within the database.

    The other alternative way to track (which is often much faster) is to count the number of session files in your sessions folder. If you're using shared hosting, you will need to create a seperate sessions folder otherwise you'll end up counting sessions that don't belong to your site. Check this article for lots of great information on how to set this up:

Similar Threads

  1. Users online?
    By Jona102190 in forum Programming Discussion
    Replies: 2
    Last Post: 06-27-2007, 01:43 PM
  2. no of online users
    By ranjitbhar in forum Dedicated Server
    Replies: 3
    Last Post: 11-26-2004, 10:00 AM
  3. ASP Active Users or Online Users Script
    By Abdillahi in forum Programming Discussion
    Replies: 1
    Last Post: 09-12-2003, 03:02 PM
  4. Replies: 0
    Last Post: 04-14-2001, 07:40 AM

Posting Permissions

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