Файл: 4mast/profmas.ru/adm/us_logs.php
Строк: 20
<?php
require_once( '../includes/Headers.php' );
require_once( '../includes/PDO_func.php' );
if ( $us == false ) {
header( 'location: /login/auth' );
exit;
}
if ($us['level'] <= 1) {
header ('location:/');
exit;
}
if (!isset ($_GET['id'])) {
header ('location: /');
exit;
}
$logID = DB::$dbs->query( "SELECT * FROM log_auth WHERE us = ? ", array(
$id
) );
$u = $logID -> fetch ();
$items = $logID -> rowCount ();
$items_per_page = 10;
$pages = ceil( $items / $items_per_page );
if ( $page < 1 ) {
$page = 1;
}
if ( $page > $pages ) {
$page = $pages;
}
$start = $page * $items_per_page - $items_per_page;
$i = isset( $_GET[ 'i' ] ) ? htmlentities( $_GET[ 'i' ] ) : false;
switch ( $i ) {
default:
H( 'История авторизаций', 'История авторизаций ' . Nick( $u[ 'us' ] ) . '' );
echo '<a class="block" href="/adm/us_logs/ok/' . $u[ 'us' ] . '"><img src="' . $img . '" alt="*"/> Удачные (' . DB::$dbs->query( "SELECT * FROM `log_auth` WHERE `us` = ? AND `type` != ?", array(
$u[ 'us' ],
0
) )->rowCount() . ')</a>
<a class="block" href="/adm/us_logs/no/' . $u[ 'us' ] . '"><img src="' . $img . '" alt="*"/> Неудачные (' . DB::$dbs->query( "SELECT * FROM `log_auth` WHERE `us` = ? AND `type` = ?", array(
$u[ 'us' ],
0
) )->rowCount() . ')</a>';
break;
////////////////////////////////////////////////////////////
case 'ok':
H( 'Удачные входы', 'Удачные входы ' . Nick( $u[ 'us' ] ) . '' );
$query = DB::$dbs->query( "SELECT * FROM log_auth WHERE us =? AND type !=? ORDER BY time DESC LIMIT $start, $items_per_page", array(
$u[ 'us' ],
0
) );
while ( $logs = $query->fetch() ) {
echo '<div class="block">
<b>Время:</b> ' . datef( $logs[ 'time' ] ) . '<br />';
$types = ( $logs[ 'type' ] == 1 ) ? 'post' : ( ( $logs[ 'type' ] == 2 ) ? 'cookies' : 'post' );
echo '<b>Тип авторизации:</b> ' . $types . '<br />
<b>IP: </b>' . $logs[ 'ip' ] . ' <a href="/adm/search_ip/logs/' . $logs[ 'ip' ] . '"> [Поиск] </a>
<br/><b>Софт:</b> ' . $logs[ 'ua' ] . '<br /> </div>';
}
if ( $pages > 1 ) echo page( '/adm/us_logs/ok/' . $u[ 'us' ] . '');
echo '<a class="block" href="/adm/us_logs/no/' . $u[ 'us' ] . '">Неудачные</a>';
break;
////////////////////////////////////////////////////////////
case 'no':
H( 'Неудачные входы', 'Неудачные входы ' . Nick( $u[ 'us' ] ) . '' );
$query = DB::$dbs->query( "SELECT * FROM log_auth WHERE us =? AND type =? ORDER BY time DESC LIMIT $start, $items_per_page", array(
$u[ 'us' ],
0
) );
while ( $logs = $query->fetch() ) {
echo '<div class="block">
<b>Время:</b> ' . datef( $logs[ 'time' ] ) . '<br />
<b>IP: </b>' . $logs[ 'ip' ] . ' <a href="/adm/search_ip/logs/' . $logs[ 'ip' ] . '"> [Поиск] </a>
<br/><b>Софт:</b> ' . $logs[ 'ua' ] . '<br /> </div>';
}
if ( $pages > 1 ) echo page( '/adm/us_logs/no/' . $u[ 'us' ] . '');
echo '<a class="list1" href="/adm/us_logs/ok/' . $u[ 'us' ] . '">Удачные</a>';
break;
}
require_once( '../includes/Footers.php' );
?>