Click here to Skip to main content
16,018,802 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to display 'Online' or 'Offline' on a users profile page depending if they logged in or not. How would i do that?
Posted
Comments
enhzflep 7-Dec-13 17:55pm    
When the user-profile page is requested, you check your 'logged-in users' table to see if the user is flagged as being logged in. If so, print Online - if not, print Offline.

Naturally, you need to write some data to a database table when the user logs in/out, which you then use for the above paragraph.
Sergey Alexandrovich Kryukov 7-Dec-13 18:34pm    
Also note that it has nothing to do with "off-line" or "on-line".
—SA
enhzflep 7-Dec-13 19:01pm    
Fair point. Thank-you. :)

I often find it hard to tell if the poster has the terminology wrong or the idea wrong. Thorough as always, cheers Sergey!
Sergey Alexandrovich Kryukov 7-Dec-13 19:53pm    
Thank you very much.
It's not just you. In general case, the cases you mentioned could be theoretically indistinguishable... :-)
—SA
Sergey Alexandrovich Kryukov 7-Dec-13 18:34pm    
The idea makes no sense, because "on-line/off-line" and "authenticated or not" are totally unrelated.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900