<?php
define('NTLCMS', 1);
$module = 'inputlogs';
include ('../system/start.php');
include ('../system/function.php');
include ('../system/INFO.class.php');
include ('../system/antidos.php');
$page_title = 'Страница логов авторизаций - клик клуба ' . strtoupper($_SERVER['HTTP_HOST']);
include ('../system/head.php');
if (!$active){
header('Location: '.URL);
$_SESSION['fail'] = 'Вы не авторизированы!';
exit;
}
echo '<div class="title"><b>'.razd.' Логи авторизаций</b></div>';
$k_post = DB :: run() -> querySingle("select count(`id`) from `auth` where `login` = ?", array($ulogin));
$k_page = k_page($k_post, $onpage); 
$page = page($k_page); 
$start = $onpage * $page - $onpage;
$sql = DB :: run() -> query("select * from `auth` where `login` = ? order by `id` desc limit ".$start.", ".$onpage, array($ulogin));
if ($k_post == 0){
echo '<div class="post"><center><i class="fa fa-close fa-fw"></i> Логи входов отсутствуют!</center></div>';
} else {
while ($row = $sql -> fetch(PDO::FETCH_OBJ)){
$detect = new USER_INFO($row -> ua);
$astatus = ($row -> method == '1' ? '<span style="color:green">Успешно</span>' : '<span style="color:red">Не успешно</span>');
echo '<div class="menu"><i class="fa fa-dot-circle-o fa-fw"></i> <b>Дата:</b> '.date('d.m.Y H:i:s', $row -> time).' ['.$astatus.']<br/> - <b>IP адрес:</b> '.checkout($row -> ip).'<br/>- <b>Браузер:</b> '.checkout($row -> ua).'<br> - '.($detect -> getOS() == 'false' ? 'Unknown' : $detect -> getOS()).'</div>';
}
if ($k_page > 1) navigation(URL.'/inputlogs?', $k_page, $page);
}
echo '<div class="block"><i class="fa fa-home fa-fw"></i> <a href="'.URL.'/cabinet">В кабинет</a></div>';
include ('../system/foot.php');
?>