._.
[specialops2.git] / userlist.php
blob5ce1a5c3e9e37a1abd83b946e31616146060d63a
1 <?php
2 // $Id$
4 require 'con.php';
5 $page->title = _('User List');
7 if ( ! ($user instanceof authuser) ) {
8 $page->errorfooter('login');
11 $sql = array (
12 'online' => array('WHERE `u_lastactive` > UNIX_TIMESTAMP() - 600', _('Online Users List')),
13 'banned' => array('WHERE `u_level` < '.LVL_RESTRICTED, _('Banned Users List'))
16 $where = '';
18 if ( isset($_GET['show']) && array_key_exists($_GET['show'], $sql) ) {
19 $where = $sql[$_GET['show']][0];
20 $page->title = $sql[$_GET['show']][1];
23 $user->userheader();
25 echo
26 '<table id="userlist">
27 <tr>
28 <th>',_('Username'),'</th>
29 <th>',_('Level'),'</th>
30 <th>',_('Points'),'</th>
31 <th>',_('Posts'),'</th>
32 <th>',_('Last Active'),"</th>\n",
33 ( LVL_ADMIN <= $user->u_level ?
34 ' <th>'._('Last IP')."</th>\n" : '' ),
35 "</tr>\n";
37 $q = $DB->query(
38 'SELECT `userid`, `u_name`, `u_level`, `u_points`, `u_lastactive`,
39 INET_NTOA(`u_lastip`) AS `u_lastip`, COUNT(`messageid`) AS `msgs`
40 FROM `users`
41 LEFT JOIN `messages` ON `userid` = `m_poster`
42 '.$where.'
43 GROUP BY `userid` ASC');
45 $a = 1; //Shadebar variable
47 while ( $row = $q->fetch_assoc() ) {
48 echo '<tr class="content c',(++$a&1),'">
49 <td>',$user->namelink($row['userid'], $row['u_name']),'</td>
50 <td>',$row['u_level'],'</td>
51 <td>',$row['u_points'],'</td>
52 <td>',$row['msgs'],'</td>
53 <td>',$user->fdate($row['u_lastactive']),"</td>\n",
54 ( LVL_ADMIN <= $user->u_level ?
55 ' <td>'.$row['u_lastip']."</td>\n" : '' ),
56 "</tr>\n";
59 echo '</table>';
61 $page->pagefooter();