<?php
include_once 'sys/inc/start.php';
$doc = new document(1);
$doc->title = 'Журнал авторизаций';


$posts = array();
$pages = new pages;
$pages->posts = mysql_result(mysql_query("SELECT COUNT(*) FROM `log_of_user_aut` WHERE `id_user` = '$user->id'"), 0);
$pages->this_page(); // получаем текущую страницу
$q = mysql_query("SELECT `log_of_user_aut`.`time` AS `time`, `log_of_user_aut`.`method` AS `method`, `log_of_user_aut`.`status` AS `status`, `log_of_user_aut`.`iplong` AS `iplong`, `browsers`.`name` AS `browser`  FROM `log_of_user_aut`
LEFT JOIN `browsers` ON `browsers`.`id` = `log_of_user_aut`.`id_browser`
WHERE `log_of_user_aut`.`id_user` = '$user->id'
ORDER BY `time` DESC
LIMIT {$pages->my_start()}, {$pages->items_per_page}");
while ($log=mysql_fetch_assoc($q)) {
$p=$log['browser']."\n";
$p.=long2ip($log['iplong'])."\n";
if (!$log['status'])$p.="[u]Неудачно[/u]";
$posts[]=array('title'=>vremja($log['time']).' ('.$log['method'].')', 'post'=>output_text($p));
}

if (!$posts)$posts[]=array('icon'=>array('size'=>'small','src'=>'/sys/images/icons/empty.png'),'title'=>'Журнал пуст');

$show = new design();
$show->assign('post',$posts);
$show->display('design.listing.tpl');

$pages->listing('?'); // вывод страниц

$doc->ret('Личное меню','/menu.user.php');

?>