Skip to main content
February 11, 2009
Question

see if someone is online

  • February 11, 2009
  • 3 replies
  • 520 views
What kind of command/coding would I use to see if a user is online or not? I just want a green circle to appear in the users profile if the person is online and browsing the site, and a red circle to appear otherwise.
    This topic has been closed for replies.

    3 replies

    February 11, 2009
    If it's users who have accounts on your site, this is fairly straightforward.

    What you would do, is that when a user logs in, you insert their details into a new table called something like "whoIsOn" and then query this table to get the amount of records and times etc they have been logged in for. When the user session ends, you simply delete this record from the table.

    It might be an idea to also put something in place to check for last activity because a user might leave the computer for a long time without actually logging out. So on your query, you could have a column in the table that updates on every page they visit called "lastModifiedTimeDate" and then compare that to the current time. If it's longer than say an hour, you can probably be sure that they haven't been looking at the same page for an hour without clicking on something and you could therefore delete this record.

    I dunno, I've never done it, but I imagine uing a temp table like this would be the best solution.

    Good luck.
    Mikey.
    Inspiring
    February 11, 2009
    Not sure if it will work exactly for your needs but check out Who's On CFC:
    http://whosoncfc.riaforge.org/

    There's also a database version (using Transfer) of the same project:
    http://whosoncfcdb.riaforge.org/

    Might be what you're looking for!
    tclaremont
    Inspiring
    February 11, 2009
    Do some Googling on session variables.






    Ever notice how many people say they need to "Google" something, but you never hear anyone say they need to "Yahoo" something?