<?php
require_once('classes/body.class.php');
require_once('classes/db.class.php');
require_once('classes/system.class.php');
$title= new Body;
$title->SetTitle(homeurl.' - История авторизация');
$title->GetHeader();
if ($b == false){
header('location:/');
die();
}

echo'<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-widgets"></i><a href="/"style="text-decoration:none; color:white;"> Главная</a> :: <a href="/office"style="text-decoration:none; color:white;"> Кабинет</a> :: История авторизация</div></div></div>';

$look = DB::$dbs->querySingle("SELECT COUNT(id) FROM auth_log WHERE user_id = ?", [$b['id']]);
if ($look == 0) {
err('Пусто!');
}
$num = 10;
$k_page = k_page($look, $num);
$page = page($k_page);
$start = $num*$page-$num;
$sql = DB::$dbs->query("SELECT * FROM auth_log WHERE user_id = ? ORDER BY id DESC LIMIT $start,$num", [$b['id']]);
while($a = $sql->fetch()) {

echo '<div class="list-group-item media"> <i class="zmdi zmdi-shuffle"></i> IP: '.$a['ip'].' ('.vr($a['time']).') '.($a['type'] == 1 ? '[<b><font color="green">Удачно</font></b>]':'[<b><font color="red">Неудачно</font></b>]').'</br>Soft: '.$a['soft'].'<br/></div>';
}
if ($k_page > 1) {
str('?',$k_page,$page);
}
$title->GetMenu();
$title->GetFooter();
?>