Файл: adm/guests.php
Строк: 32
<?
include_once '../system/sys.php';
include '../system/funcs.php';
if(!$cms->us['id']){
header('location: /');
exit;
}
if($cms->us['level']<4){
header('location:/');
exit;
}
$posts = $func->getCount('id','guest');
verh('Гости','Гости ('.$posts.')');
if($posts==0){
echo '<div class="lst">Гостей еще небыло..</div>';
}else{
$num = 10;
$total = intval(($posts - 1) / $num) + 1;
$page = abs(intval($_GET['page']));
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$guests = DB::$dbs->query("SELECT * FROM `guest` order by `time` desc limit $start,$num");
while($guest=$guests->fetch()){
echo '<div class="lst"><b>'.($guest['ip']?$guest['ip']:'anonymous').'</b> - '.($guest['ua']?$guest['ua']:'<b>anonymous</b>').' ('.t($guest['time']).')</div>';
}
echo '<div class="lst">';
$func->page('/adm/guests');
echo '</div><div class="list1">
Онлайн: '.DB::$dbs->querySingle('select count(`id`) from `guest` where `time` > ?',array(time()-3600)).'<br/>
За 3 часа: '.DB::$dbs->querySingle('select count(`id`) from `guest` where `time` > ?',array(time()-10800)).'<br/>
За 6 часов: '.DB::$dbs->querySingle('select count(`id`) from `guest` where `time` > ?',array(time()-21600)).'<br/>
За 12 часов: '.DB::$dbs->querySingle('select count(`id`) from `guest` where `time` > ?',array(time()-43200)).'<br/>
За 24 часа: '.DB::$dbs->querySingle('select count(`id`) from `guest` where `time` > ?',array(time()-86400)).'<br/>
Всего посещений: '.$posts.'
</div>';
}
niz();
?>