Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

see if someone is online

Guest
Feb 10, 2009 Feb 10, 2009
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.
459
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 11, 2009 Feb 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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 11, 2009 Feb 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!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 11, 2009 Feb 11, 2009
LATEST
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources