Файл: Krimos/online.php
Строк: 106
<?php
// Криме / Krime
include('common.php');
$page = getarg('page', 1);
if(islogged())
{
echo theader($lang['whosonline']);
echo ' <span>' . $lang['whosonline'] . '</span><br /><br />' . "rn";
$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 ' <span><a href="' . $s_siteurl . '/online.php?lang=' . $language . '&page=1">' . $lang['firstpage'] . '</a></span><br />' . "rn";
if($npages > 1 && $page < $npages)
echo ' <span><a href="' . $s_siteurl . '/online.php?lang=' . $language . '&page=' . $npages . '">' . $lang['lastpage'] . '</a></span><br />' . "rn";
$limit = ($page - 1) * $ntpp;
$ons = mysql_query('SELECT * FROM `online` ORDER BY `time` DESC LIMIT ' . $limit . ', ' . $ntpp . ';');
if($nonl > 0)
{
echo ' <div class="left">' . "rn";
while($on = mysql_fetch_array($ons))
{
$uid = $on['user'];
if($uid == 0)
$uusername = $lang['guest'];
else
$uusername = '<a href="' . $s_siteurl . '/profile.php?lang=' . $language . '&id=' . $uid . '">' . getusername($uid) . '</a>';
$where = $on['where'];
echo ' <div class="online">' . "rn";
echo ' <span>' . $uusername . ' - ' . $where . '</span><br />' . "rn";
echo ' </div>' . "rn";
}
echo ' </div>' . "rn";
}
if($page > 1)
{
$bp = $page - 1;
$bl = '<a href="' . $s_siteurl . '/online.php?lang=' . $language . '&page=' . $bp . '">< ' . $lang['backward'] . '</a>';
}
else
$bl = '< ' . $lang['backward'];
if($page < $npages)
{
$fp = $page + 1;
$fl = ' | <a href="' . $s_siteurl . '/online.php?lang=' . $language . '&page=' . $fp . '">' . $lang['forward'] . ' ></a>';
}
else
$fl = ' | ' . $lang['forward'] . ' >';
echo ' </div>' . "rn";
echo ' <span>' . $bl . $fl . '</span><br />' . "rn";
}
else
{
echo ' <span>' . $lang['onlineparadox'] . '</span><br /><br />' . "rn";
}
echo ' <span><a href="' . $s_siteurl . '/index.php?lang=' . $language . '">' . $lang['back'] . '</a></span><br /><br />' . "rn";
echo tfooter();
}
else
{
header('Location: ' . $s_siteurl . '/index.php?lang=' . $language);
}
exit();
?>