<?php
define('GCMS',true);
require_once ('system/power.php');
$count = $db -> dbcount('COUNT(`session`)','online');
$diz -> head('Онлайн '.$count.' чел.');
if ($count > 0) {
$online = $db -> dbcount('COUNT(`session`)','online');
$us = $db -> dbcount('COUNT(`login`)','online',"`login` != ''");
$diz -> title('Сейчас на сайте: '.$count.' человек</br>Из них '.$us.' пользователей и '.($online - $us).' гостей');
require_once (ROOT.'/new_mail.php');
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1; 
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
$sql = $db -> query("SELECT * FROM `online` ORDER BY `login` DESC LIMIT ".$start.",".$num);
$msg.='<div class="fon">';
while ($arr = $sql -> fetch_assoc()) {
if (!empty($arr['login'])) {
$ass = $db -> query("SELECT `id`,`ava` FROM `users` WHERE `login` = '".$arr['login']."' LIMIT 1");
$assoc = $ass -> fetch_assoc();
if ($ass -> num_rows > 0) {
$arr['login'] = '<a href="my/id'.$assoc['id'].'">'.$arr['login'].'</a>';
}
}
if($aut==true){
if($assoc['ava']!='0.png' and $arr['login']!=''){$foto='../my/ava/'.$assoc['ava'].'';}else{
$foto='../styles/'.$ya['style'].'/images/noava.png';}
$av='<img src="system/resize.php?img='.$foto.'&width=30&height=30&i=0" alt="ава"/>';
}elseif($aut==false){
if($assoc['ava']!='0.png' and $arr['login']!=''){
$foto='../my/ava/'.$assoc['ava'].'';}else{
$foto='../styles/'.$nastr['ststyle'].'/images/noava.png';}
$av='<img src="system/resize.php?img='.$foto.'&width=30&height=30&i=0" alt="ава"/>';
}
$login = empty($arr['login']) ? 'Гость' : $arr['login'];
if($ya['level']>2 and $aut == true){$arbyz= strtok($arr['browser'],' ');}
if($ya['level']>4 and $aut == true){$ipa= strtok($arr['ip'],' ');}

$msg .= '<table border="0" width="100%">
	<tr>
		<td height="0" width="26"><div class="avatar">'.$av.'</div></td>
 <td>
<div class="spisok">'.$login.' '.$arbyz.' '.$ipa.'</div></td>
	</tr>
</table>
';
}
$act = 'online.php?';
$msg .= $func -> pagenav($act,$page,$total);
} else {
$msg .= 'На сайте ни кого..';
}
$msg .= '</div><div class="levo">'.$diz -> img('home.png').'<a href="index.php">На главную</a></div>';
#####Копирайт#######
require_once ('system/kopy.php');
$diz -> out($msg);
?>