Файл: online.php
Строк: 66
<?php
include('common.php');
$page = getarg('page', 1);
if(islogged()){
echo theader($lang['whosonline']);
echo '<div class="list2">' . $lang['whosonline'] . '</div>';
$query = mysql_query('SELECT COUNT(*) FROM `online`;');
$query=mysql_query("select count(*) from `online`");
if(($nonl = intval(mysql_result($query, 0))) > 0){
$ntpp = 10;
$npages = ceil($nonl / $ntpp);
if($page == 'last')
$page = $npages;
$page = intval($page);
if($page == 0)
$page = 1;
if($page > $npages && $page != 1)
$page = $npages;
if($page > 1)
echo '<a href="/online.php?page=1">' . $lang['firstpage'] . '</a><br />';
if($npages > 1 && $page < $npages)
echo '<a href="/online.php?page=' . $npages . '">' . $lang['lastpage'] . '</a><br />';
$limit = ($page - 1) * $ntpp;
$ons = mysql_query('SELECT * FROM `online` ORDER BY `time` DESC LIMIT ' . $limit . ', ' . $ntpp . ';');
if($nonl > 0){
while($on = mysql_fetch_array($ons)){
$uid = $on['user'];
if($uid == 0)
$uusername = $lang['guest'];
else
$uusername = '<a href="/profile.php?id=' . $uid . '">' . getusername($uid) . '</a>';
$where = $on['where'];
echo '<div class="list2">
' . $uusername . ' - ' . $where . '</div>';
}
}
if($page > 1){
$bp = $page - 1;
$bl = '<a href="/online.php?page=' . $bp . '">< ' . $lang['backward'] . '</a>';
}
else
$bl = '< ' . $lang['backward'];
if($page < $npages){
$fp = $page + 1;
$fl = ' | <a href="/online.php?page=' . $fp . '">' . $lang['forward'] . ' ></a>';
}else
$fl = ' | ' . $lang['forward'] . ' >';
echo '<div class="list2">' . $bl . $fl . '</div>';
}else{
echo '<div class="list2">' . $lang['onlineparadox'] . '</div>';
}
echo '<div class="list2"><a href="/index.php">' . $lang['back'] . '</a></div>';
echo tfooter();
}else{
echo'<div class="list2">'.$lang['error'].'</div>';
}
exit();
?>