SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist jazztie's Avatar
    Join Date
    Mar 2001
    Location
    the Netherlands
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Showing people that are online

    I'm not sure if this question belongs here. But, let me try anyway.

    I have an Intranetsystem where people have to log in (a cookie is set) to enter.

    Is it possible to show the people that are currently logged in? How would I go about doing this?

    i can imagine that you would need a db-table where you log people that have logged in. But how would you know that they are still online?

    Any help is appreciated.

    Jazz

  2. #2
    purple monkey dishwasher scoates's Avatar
    Join Date
    Nov 2001
    Location
    Montreal
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is NOT 100% accurate.

    As you can see to the left of this message, the Sitepoint site is doing this with our accounts.

    The method I've used is something similar to this:
    create a table wherein you will store user_IDs and the time of their last page request (call the function to log request times in your global header if you have one, or from each page).

    To find out if a user is online, query this new table for said users' user_ID and last request. If their last hit was within the last n minutes (n=how long before you consider a user to be offline) then they are online.

    You should also set the users' last hit time to something older than your timeout when a user requests to be logged out.

    Hope that's not confusing. (-:

    S

  3. #3
    SitePoint Evangelist jazztie's Avatar
    Join Date
    Mar 2001
    Location
    the Netherlands
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx Scoates,

    That sounds like a very good way to do it. I'll certainly try it.

    Jazz


Bookmarks

Posting Permissions

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