<?
if (isset($user) && $user['group_access'] == 0)
{
	if ($_SERVER['PHP_SELF'] == '/user/frends/create.php' && isset($_GET['add']) && $_GET['add'] != 0)
	{
		$_ID_BLACK = (int) $_GET['add'];
		$_BLACK_TYPE = 'info';
	}
	elseif ($_SERVER['PHP_SELF'] == '/info.php' && isset($_GET['id']) && $_GET['id'] != 0)
	{
		$_ID_BLACK = (int) $_GET['id'];
		$_BLACK_TYPE = 'info';
	}
	elseif ($_SERVER['PHP_SELF'] == '/mail.php' && isset($_GET['id']) && $_GET['id'] != 0)
	{
		$_ID_BLACK = (int) $_GET['id'];
		$_BLACK_TYPE = 'mail';
	}
	elseif ($_SERVER['PHP_SELF'] == '/foto/index.php' && isset($_GET['id_user']) && $_GET['id_user'] != 0)
	{
		$_ID_BLACK = (int) $_GET['id_user'];
		$_BLACK_TYPE = 'foto';
	}
	
	if (isset($_BLACK_TYPE))
	{
		$_BLACKLIST = mysql_fetch_assoc(mysql_query("SELECT * FROM `user_black` WHERE `id_black` = '$user[id]' AND `id_user` = '$_ID_BLACK' AND 
		(`time` > '" . time() . "' OR `time` = '0') LIMIT 1"));
		
		if (isset($_BLACKLIST['id_black']) && preg_match("/$_BLACK_TYPE/i", $_BLACKLIST['razdel']))
		{
			header('Location: /user/blacklist/?func=ban&id=' . $_ID_BLACK);	
			exit;
		}		
	}
}
?>