About the online user currently to be display?

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
coolesting
Forum Newbie
Posts: 13
Joined: Thu Sep 02, 2010 12:36 am

About the online user currently to be display?

Post by coolesting »

Hi,
how design the function about the online users currently to be display when you logon that website be presented ?
who can get me some idea in detail ,

thanks anybody suggestion, much appreciate .
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: About the online user currently to be display?

Post by yacahuma »

sorry, dont understand the question
User avatar
coolesting
Forum Newbie
Posts: 13
Joined: Thu Sep 02, 2010 12:36 am

Re: About the online user currently to be display?

Post by coolesting »

yacahuma wrote:sorry, dont understand the question
In other words, the website will be display all of users who is online when you access the website.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: About the online user currently to be display?

Post by Jonah Bron »

You'll need to put a last_visit column into your users table if you don't already have one. Whenever a logged-in user visits a page, it updates the last_visit column with time() [http://php.net/time].

Then, when you want to list online users, just check the users table for users who's last_visit is within a threshold for age. For example, time() - (60*10) would only show users that had been seen within ten minutes ago.
Post Reply