Fixed 1 more CRLF,
[specialops2.git] / userlist.php
blobb4d5dc25132e3bcdb5e9f3cd151c4ae3d5ed46f7
1 <?php
2 // $Id$
4 require 'con.php';
6 switch ( $_SERVER['QUERY_STRING'] ) {
7 case 'online':
8 $page->title = 'Online Users';
9 $where = 'WHERE `last_active_date` > UNIX_TIMESTAMP() - 600';
10 break;
11 default:
12 $page->title = 'User List';
13 $where = '';
16 $user->userheader();
19 <table id="userlist">
20 <col/><col/><col/><col/>
21 <thead>
22 <tr>
23 <th>Username</th>
24 <th>Points</th>
25 <th>Posts</th>
26 <th>Last Active</th>
27 </tr>
28 </thead>
29 <tbody>
30 <?php
31 $q = $DB->query('SELECT `users`.`userid`, `alias`, `points`, `last_active_date`, COUNT(`messageid`) AS `msgs`
32 FROM `users`
33 NATURAL LEFT JOIN `messages`
34 '.$where.'
35 GROUP BY `userid` ASC');
37 $a = 1; // CSS class on alternating rows
39 while ( $row = $q->fetch_assoc() ) {
40 // This looks much nicer when rendered. Really.
41 printf("<tr class=\"content c%d\">\n\t<td>%s</td>\n\t<td>%d</td>\n\t<td>%d</td>\n\t<td>%s</td>\n</tr>\n",
42 (++$a&1),
43 $user->namelink($row['userid'], $row['alias']),
44 $row['points'],
45 $row['msgs'],
46 $row['userid'] == $user->userid ? $user->fdate(time()).' (Now)' : $user->fdate($row['last_active_date'])
50 </tbody>
51 </table>
52 <?php
53 $page->pagefooter();