Fixes for mysql 5.0.15 breaking stuff
[specialops2.git] / userlist.php
blobe370372691a9b04b19042f5c8287af35fc9d870a
1 <?php
2 // $Id$
4 require 'con.php';
5 $page->title = 'User List';
7 $sql = array(
8 'online' => array('WHERE `last_active_date` > UNIX_TIMESTAMP() - 600', 'Online Users List'),
9 'banned' => array('WHERE `level` < '.LVL_RESTRICTED, 'Banned Users List')
12 $where = '';
14 if ( isset($_GET['show']) && array_key_exists($_GET['show'], $sql) ) {
15 $where = $sql[$_GET['show']][0];
16 $page->title = $sql[$_GET['show']][1];
19 $user->userheader();
21 echo
22 '<table id="userlist">
23 <tr>
24 <th>Username</th>
25 <th>Level</th>
26 <th>Points</th>
27 <th>Posts</th>
28 <th>Last Active</th>',"\n",
29 ( LVL_ADMIN <= $user->level ?
30 ' <th>Last IP</th>'."\n" : '' ),
31 "</tr>\n";
33 $q = $DB->query(
34 'SELECT `users`.`userid`, `alias`, `level`, `points`, `last_active_date`,
35 INET_NTOA(`last_ip`) AS `last_ip`, COUNT(`messageid`) AS `msgs`
36 FROM `users` NATURAL LEFT JOIN `messages`
37 '.$where.'
38 GROUP BY `userid` ASC');
40 $a = 1; // Shadebar variable
42 while ( $row = $q->fetch_assoc() ) {
43 echo '<tr class="content c',(++$a&1),'">
44 <td>',$user->namelink($row['userid'], $row['alias']),'</td>
45 <td>',$row['level'],'</td>
46 <td>',$row['points'],'</td>
47 <td>',$row['msgs'],'</td>
48 <td>',$user->fdate($row['last_active_date']),"</td>\n",
49 ( LVL_ADMIN <= $user->level ? "\t<td>".$row['last_ip']."</td>\n" : '' ),
50 "</tr>\n";
53 echo '</table>';
55 $page->pagefooter();