<?php

	# author Drk in

	require_once ( $_SERVER['DOCUMENT_ROOT']."/_core/system.php" );

	$id =  isset( $_GET['id'] ) ? abs(intval($_GET['id'])): 0;

	$act = DB :: $dbh -> queryFetch("SELECT CK FROM `user` WHERE `id`=? LIMIT 1;", array($id));  
	
	$act = cache_user::check($act['CK']);

	if (cache_user::ch($act['CK']) == false)system::header('/admin/users','Ошибка ID не найден');

	# meta

	$title = 'Пользователи - Мульты - '.system::check($act['login']);
	$description = system::check($config['description']);
	$keywords = system::check($config['keywords']);
	$tl = 'Пользователи - Мульты - '.system::check($act['login']);

	# admin

	system::adm();

	# head

	require_once ( head );

	$cn = DB :: $dbh -> querySingle("SELECT count(id) FROM user WHERE ip = ? AND ua = ? AND id != ?", array($act['ip'],$act['ua'],$id));	

	if($cn == 0)echo '<div class="err">Cписок пуст!</div>';

	$page = new page($cn);

	$limit = $cn > $page -> elements ? $page -> limit : null;

	$query = DB :: $dbh -> query("SELECT CK FROM user WHERE ip = ? AND ua = ? AND id != ? ORDER BY id  {$limit}", array($act['ip'],$act['ua'],$id));	

	while ($data = $query -> fetch()):

	$data = cache_user::check($data['CK']);

	$pf = DB :: $dbh -> querySingle("SELECT count(id) FROM platforms  WHERE user = ?;", array($data['id']));	
	
	echo '
	<div class = "touch">
	<img src ="'.ico.'us/'.($data['admin'] == 0 ? 'man_on.gif':'anime.png').'" style ="    vertical-align: baseline;"> '.system::check($data['login']).'
	[ID: '.$data['id'].' '.($data['admin'] == 1 ? '| <font color="red"> ADM </font>':'').' '.($data['ban'] == 1 ? '| <font color="red"> BAN </font>':'').' | сайтов: <font color="green">'.$pf.'</font>]
	</div>
	';	
	endwhile;	
	
	$page -> get('?');

	echo '
	
	<a href="'.site.'admin/users" class="touch">« Назад</a>';

	# foot

	require_once ( foot ) ;
?>