Deserteye Posted October 4, 2006 Share Posted October 4, 2006 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) Quote Link to comment Share on other sites More sharing options...
Caesar Posted October 4, 2006 Share Posted October 4, 2006 Look at:[url=http://us3.php.net/manual/en/function.time.php]time();[/url] Quote Link to comment Share on other sites More sharing options...
Tandem Posted October 4, 2006 Share Posted October 4, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.