<?php

require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';

if (empty($user_id) || $user['level'] < 1) go(URL);

if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
	$id = abs(intval($_GET['id']));
	$result = mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1");
	if (mysql_num_rows($result) == true) $arr = mysql_fetch_array($result);
		else go(URL);
}


if ($arr['ban'] == 1) mysql_query("UPDATE `users` SET `ban` = 0 WHERE `id` = '".$id."'");


$title = lang('Админ-панель','Адмін-панель').' :: Бан-лист';
require_once '../incfiles/head.php';

echo '<div class="title">Бан-лист</div>';

	$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `ban` = 1"),0);
	if ($all > 0)
	{
		$cp = ceil($all/10);
		$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
		$start = $p*10-10;

		$res = mysql_query("SELECT * FROM `users` WHERE `ban` = 1 ORDER by `id` DESC LIMIT $start,10");
		while ($array = mysql_fetch_array($res))
		{
			echo '<div class="block">'.user_name($array['id']).'<br/><a href="'.URL.'/adm/banlist.php?id='.$array['id'].'&p='.$p.'">'.lang('Разблокировать','Розблокувати').'</a></div>';
		}
		navi($p,$cp,'/adm/banlist.php?');
	}

require_once '../incfiles/foot.php';

?>