3 * User Directory/Online Users/Top 50 page
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
12 switch ( $_SERVER['QUERY_STRING'] ) {
14 $page->title
= 'Currently Online Users';
15 $where = 'WHERE `last_active_date` > UNIX_TIMESTAMP() - 600 GROUP BY `userid` ASC';
19 if ( $DB->query('SELECT COUNT(*) AS `c` FROM `users`')->fetch_object()->c
> 50 ) {
20 $page->title
= 'Top 50 Users';
21 $where = 'GROUP BY `userid` ORDER BY `points` DESC LIMIT 50';
23 $page->title
= 'User List';
24 $where = 'GROUP BY `userid` ASC';
32 <col
/><col
/><col
/><col
/><col
/>
34 <tr
><th
>Username
</th
><th
>Points
</th
><th
>Posts
</th
><th
>Last Active
</th
><th
>Idle Time
</th
></tr
>
38 $q = $DB->query('SELECT `users`.`userid`, `alias`, `points`, `last_active_date`, COUNT(`messageid`) AS `msgs`
39 FROM `users` NATURAL LEFT JOIN `messages` '.$where);
44 $idle = time() - $last;
45 $idle -= ($time[2] = $idle %
60); $idle /= 60;
46 $idle -= ($time[1] = $idle %
60); $idle /= 60;
47 $idle -= ($time[0] = $idle %
24); $time[3] = $idle / 24;
51 return ( $time[3] ?
$time[3].' day'.( 1 != $time[3] ?
's ' : ' ' ) : '').vsprintf('%d:%02d:%02d', $time);
56 while ( $row = $q->fetch_assoc() ) {
58 printf('<tr class="content c%d"><td>%s</td><td>%d</td><td>%d</td><td>%s</td><td>%s</td></tr>'."\n",
60 $user->namelink($row['userid'], $row['alias']),
63 $user->fdate($row['last_active_date']),
64 $user instanceof authuser
&& $user->userid
== $row['userid'] ?
'' : idle($row['last_active_date'])