Файл: users.php
Строк: 77
<?php
include('common.php');
$do = getarg('do', '');
$page = intval(getarg('page', 1));
if(islogged()){
if($do == 'banned')
$astring = ' WHERE `banned` = '1'';
elseif($do == 'mods')
$astring = ' WHERE `status` = '2'';
elseif($do == 'admins')
$astring = ' WHERE `status` = '3'';
else
$astring = '';
if($astring != '')
$dos = 'do=' . $do . '&';
else
$dos = '';
$alink = '<a href="/users.php?do=admins">' . $lang['uadmins'] . '</a>';
$mlink = '<a href="/users.php?do=mods">' . $lang['umods'] . '</a>';
$blink = '<a href="/users.php?do=banned">' . $lang['ubanned'] . '</a>';
$ulink = '<a href="/users.php">' . $lang['lusers'] . '</a>';
if($do == 'admins')
$alink = $lang['uadmins'];
elseif($do == 'mods')
$mlink = $lang['umods'];
elseif($do == 'banned')
$blink = $lang['ubanned'];
else
$ulink = $lang['lusers'];
echo theader($lang['lusers']);
echo '<div class="list2">' . $alink . '/' . $mlink . '/' . $ulink . '/' . $blink . '</div>';
$query = mysql_query('SELECT COUNT(*) FROM `users`' . $astring . ';');
$nusers = mysql_result($query, 0);
$upp = 10;
$npages = ceil($nusers / $upp);
if($page > $npages && $page != 1)
$page = $npages;
$limit = ($page - 1) * $upp;
$users = mysql_query('SELECT * FROM `users`' . $astring . ' ORDER BY `date` ASC LIMIT ' . $limit . ', ' . $upp . ';');
if(mysql_num_rows($users) > 0){
while($user = mysql_fetch_array($users)){
echo'<div class="list2">';
$uid = intval($user['id']);
$uusername = $user['username'];
if($user['banned'] > 0)
$ustatus = $lang['status']['banned'];
else
$ustatus = formatstatus(intval($user['status']));
echo '<a href="/profile.php?id=' . $uid . '">' . $uusername . '</a> (' . $ustatus . ')</div>';
}
if($page > 1){
$bp = $page - 1;
$bl = '<a href="/users.php?'.$dos . '&page=' . $bp . '">< ' . $lang['backward'] . '</a>';
}else
$bl = '< ' . $lang['backward'];
if($page < $npages){
$fp = $page + 1;
$fl = ' | <a href="/users.php'.$dos . '&page=' . $fp . '">' . $lang['forward'] . ' ></a>';
}else
$fl = ' | ' . $lang['forward'] . ' >';
echo '<div class="list2">' . $bl . $fl . '</div>
<a href="/index.php">' . $lang['back'] . '</a></div>';
}else{
echo '<div class="list2">' . $lang['nousers'] . '<br />
<a href="/index.php">' . $lang['back'] . '</a></div>';
}
echo tfooter();
}else{
echo'<div class="list2">'.$lang['error'].'</div>';
}
exit();
?>