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
https://forums.phpfreaks.com/topic/22929-online-users/
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
https://forums.phpfreaks.com/topic/22929-online-users/#findComment-103494
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.