SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast webdude's Avatar
    Join Date
    Feb 2005
    Location
    Great Britain
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A Forum Tracking system

    Hi there I'm trying to do a forum/site tracking system.

    You know you see it on forums "Online now: 3 members, 1 Guest" sorta thing. I can figure out how to do the tracker when they are logged in, but how do you do it for guests? I tried but I end up with loads of rows in MySQL table that don't get deleted unless I do it manually or set a cron job.

    So how would I go about doing this?

    Thanks

  2. #2
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    New Jersey, USA
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A guest is someone who isn't logged in.

    You write a record into a special table, logged in. Write the userid of the user, or 0 for guest.

    Also write a timestamp when you first see them (put a "does the database know about me" variable in their session).

    When you go to print your summary, you delete anyone whose timestamp is lower than NOW() - 300 seconds, or thereabouts. Then you summarize the number of distinct logged in users and the number of anonymous users.

    You'd be cleaning out your database every page hit if you did it that way, so you might try something a little slower: give the thing a random chance to do the delete, or whatever. That would be a performance optimization you can do later.

    =Austin
    Austin Hastings - Principal Consultant - Longacre, Inc.

    Anything you can do, you can do better.

  3. #3
    SitePoint Enthusiast webdude's Avatar
    Join Date
    Feb 2005
    Location
    Great Britain
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK thanks Austin


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
  •