And that.
[specialops2.git] / userlist.php
blob2563bfba5851dc3da5f175fea281f18a74b7986c
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 );
11 $where = '';
13 if ( isset($_GET['show']) && array_key_exists($_GET['show'], $sql) )
14 list($where, $page->title) = $sql[$_GET['show']];
16 $user->userheader();
18 echo
19 '<table id="userlist">
20 <tr>
21 <th>Username</th>
22 <th>Level</th>
23 <th>Points</th>
24 <th>Posts</th>
25 <th>Last Active</th>',"\n",
26 ( LVL_ADMIN <= $user->level ?
27 " <th>Last IP</th>\n" : '' ),
28 "</tr>\n";
30 $q = $DB->query('SELECT `users`.`userid`, `alias`, `level`, `points`, `last_active_date`,
31 INET_NTOA(`last_ip`) AS `last_ip`, COUNT(`messageid`) AS `msgs`
32 FROM `users`
33 NATURAL LEFT JOIN `messages`
34 '.$where.'
35 GROUP BY `userid` ASC');
37 $a = 1; // Shadebar variable
39 while ( $row = $q->fetch_assoc() ) {
40 echo
41 '<tr class="content c',(++$a&1),'">
42 <td>',$user->namelink($row['userid'], $row['alias']),'</td>
43 <td>',$row['level'],'</td>
44 <td>',$row['points'],'</td>
45 <td>',$row['msgs'],'</td>
46 <td>',$user->fdate($row['last_active_date']),'</td>',
47 ( LVL_ADMIN <= $user->level ?
48 ' <td>'.$row['last_ip'].'</td>' : '' ),
49 "\n</tr>\n";
52 echo '</table>';
54 $page->pagefooter();