Jump to content


Photo

Online Users


  • Please log in to reply
2 replies to this topic

#1 Deserteye

Deserteye
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationNew Jersey

Posted 04 October 2006 - 12:26 AM

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)

What I know:
XHTML: 10/10
CSS: 8/10
JavaScript: 5/10
VBScript: 7/10 PHP: 8/10 MySQL: 9/10

#2 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 04 October 2006 - 12:51 AM

Look at:

time();
PHP Ninja

#3 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 04 October 2006 - 01:26 AM

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.


$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>";

}

That would output a list of people.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users