<?php $page = 0; include("header.php"); ?> <div style="text-align:left;padding:15px 10px 0;"> <center><span style="font-size : 20pt;">Users Online</span></center><br> <?php // Update online list $current_time = time(); $sql = "SELECT id, time FROM phpBB3_online"; $result = mysql_query($sql); while ($values = mysql_fetch_array($result)) { if ($current_time - $values['time'] > 60*10) { mysql_query("DELETE FROM phpBB3_online WHERE id = " . $values['id']); } } // Get online list $sql = "SELECT * FROM phpBB3_online ORDER BY time ASC"; $result = mysql_query($sql); while ($values = mysql_fetch_array($result)) { $users_online .= "<tr><td><a href='../phpBB3/memberlist.php?mode=viewprofile&u=" . $values['user_id'] . "'>" . $values['username'] . "</a></td><td>" . date("H:i", $values['time']) . "</td></tr>"; } if (!isset($users_online)) { $users_online = "<tr><td colspan='2'><i>No one is online.</i></td></tr>"; } else { $users_online = substr($users_online, 0, strlen($users_online) - 3); } ?> <table align="center" width="100%" border="0"> <tr> <td><b>User</b></td> <td><b>Last Click</b></td> </tr> <?php echo($users_online); ?> </table> </div> <?php include("footer.php"); ?>
AJAX Users Online
Started by
Alainmeyer1
, Apr 08 2007 07:05 PM
4 replies to this topic
#1
Posted 08 April 2007 - 07:05 PM
Hey guys, how can I change my script of users online to something that will load every 10 seconds to check for users online?
#2
Posted 08 April 2007 - 08:34 PM
Would this page help? http://wiki.script.a...ow/Ajax.Updater You need their JS library tho.
#3
Posted 09 April 2007 - 05:50 AM
Hmmmmm I tried but it doesn't seem to work.
Can someone help me write the script?
Can someone help me write the script?
#4
Posted 09 April 2007 - 01:20 PM
Simple Ajax.PeriodicalUpdater works just fine.
Just pass it the container, URL of the PHP script to request from, and an optional object with the method and frequency of the updates.
Of course you need to download the Prototype library, which is simple enough to use.
Just pass it the container, URL of the PHP script to request from, and an optional object with the method and frequency of the updates.
Of course you need to download the Prototype library, which is simple enough to use.
#5
Posted 21 October 2012 - 04:15 PM
no
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users