Jump to content

Online Users


Deserteye

Recommended Posts

I am wondering how to show how many users active in the past 15 min. I assume I would enter the current time in a database every page a user visits and subtract 15 from that. I don't know the best way to do this but any help would be appriciated. Could someone please tell me the best way to check for and show the users active in the past 15 min and provide sample code? Thanks

(or a link to a tut will be good lol)
Link to comment
Share on other sites

On my site i include a file on every page which updates a field called LAST_ONLINE in the MEMBERS table which contains the members general user information. Then i use the following to display the people who have been active in the last 10 minutes.


[code]$online_check = mysql_query("SELECT USERNAME FROM MEMBERS WHERE LAST_ONLINE > DATE_SUB(NOW(), INTERVAL 10 MINUTE)");
$online_num = mysql_num_rows($online_check);

for ($i = 0; $i < $online_num; $i++){

$online_result = mysql_result($online_check, $i);

echo "$online_result<br>";

}[/code]

That would output a list of people.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.