Who is Online?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dyluck
Forum Commoner
Posts: 54
Joined: Thu Jun 26, 2008 1:44 pm

Who is Online?

Post by dyluck »

Ok, this is one I have been struggling with. How do I keep track of logged in members who are online on my website.
Lets take this forum for example. It knows who is online. How does it work and what would I need to make this happen on my site.

Thanks!
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Who is Online?

Post by onion2k »

Every time someone views a page there is a log of the time made against their user in the database. So me viewing this page would mean the timestamp for Onion2k will have been updated to 19:59. When the forum wants to write a list of who is online at the moment it queries the database to find anyone who has viewed a page in the last 5 minutes.

EDIT: Also, your signature is massive. Does it really need all that?
User avatar
dyluck
Forum Commoner
Posts: 54
Joined: Thu Jun 26, 2008 1:44 pm

Re: Who is Online?

Post by dyluck »

Haha yeah I suppose it is long :P

I will change it :)

Ok so it is a query based on time :)

Thanks for your help.
Post Reply