Файл: online2.php
Строк: 62
<?php
include_once 'inc/bd.php';
include_once 'inc/fun.php';
$title = 'Пользователи Online';
include_once 'inc/v.php';
####
echo '<div class="rmenu"><strong>Пользователи Online</strong></div>';
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `online`"), 0, 0);
####
$get = num($_GET['page']);
if(isset($get)){$page = $get;}else{$page=1;}
$str = ceil($all/$npage);
if(!$str) $pages = 1;
if($page>$str or $page<=0) $page=1;
if($start>$all or $start<=0) $start = 0;
if($page) $start = ($page - 1) * $npage;
else $start = 0;
####
if ($all > 0)
{
echo '<div class="menu">';
$sql = mysql_query("SELECT * FROM `online` ORDER BY `id` DESC LIMIT $start,$npage");
while ($row = mysql_fetch_assoc($sql))
{
$onlineip = html($row['ip']);
$onlinebrowser = html($row['brauz']);
echo '<span style="color:#900">IP: </span>'.$onlineip.'<br/><span style="color:#900">Browser: </span>'.$onlinebrowser.'<br>';
}
echo '</div>';
####
$pp = $page - 2;
$pp2 = $page + 3;
echo '<div class="nmenu">';
$backpage = $page - 1;
$uppage = $page + 1;
if ($str>1){
if ($page > 1)
echo '<a class="str" href="'.$home.'/online.php?page='.$backpage.'">«</a> ';
if($pp<$all && $pp>0 && $page>3)
echo '<a class="str" href="'.$home.'/online.php?page=1">1</a> ... ';
for($i=$pp; $i<$pp2;$i++)
{
if($i<$all && $i>0)
{
if ($i > $str )
break;
if ($page==$i)
echo '<span class="str_active"><b>'.$i.'</b></span> ';
else echo '<a class="str" href="'.$home.'/online.php?page='.$i.'">'.$i.'</a> ';
}
}
if ($i <= $str) {if($pp2<$all) echo ' ... <a class="str" href="'.$home.'/online.php?page='.$str.'">'.$str.'</a>';}
if ($page < $str)
{
echo '<a class="str" href="'.$home.'/online.php?page='.$uppage.'">»</a> ';
}
}
####
}
else {echo '<div class="menu">Никого нет!</div>';}
echo '<hr/>Онлайн пользователей: <strong>'.online().'</strong></div>';
####
include_once 'inc/n.php';
?>