Просмотр файла element_admin_user.php

Размер файла: 35.76Kb
<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
if ($user['lost_privilege'] != 3) { header('Location: /'); exit; } 
$to = (isset($_GET['to'])) ? $_GET['to'] : false;
if (!$id) {
	$title = 'Персонаж не найден';
	$error1 = '<span class="small">Выбранный Вами персонаж не существует, либо был удален';
	require_once 'element_error_page.php';
	exit;
}

$profile_user = cache_user($id);
	
if (!$profile_user) {
	$title = 'Персонаж не найден';
	$error1 = '<span class="small">Выбранный Вами персонаж не существует, либо был удален';
	require_once 'element_error_page.php';
	exit;
}
require_once './element_function/element_function_admin.php';

// Регистрация / Посл. вход / Почта / Бан / Ник / Стихия / Пол
$profile_other = explode(' ', $profile_user['lost_other']);
$profile_exp = explode(' ', $profile_user['lost_exp']);	
$profile_energy = explode(':', $profile_user['lost_params_energy']);	
$town_o = explode(':', $profile_user['lost_town_other']);	
$subforum = mysql_query("SELECT * FROM `element_forum_list_2` WHERE `lost_town` = '0' ORDER BY `lost_dostype` ASC");
	
$title = 'Управление "'.$profile_user['lost_login'].'"';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';

	if ($go == 'race' AND $to >= 1 AND $go == 'race' AND $to <= 4) {
		$profile_user['lost_race'] = $to;
		writecache('element_users_id_'.$id,$profile_user);
		user_list_update($id);
	}
	
	if (isset($_GET['forum'])) {
	
		while ($myrrow = mysql_fetch_array($subforum)) {
			$moderation = explode(" ", $myrrow['lost_moderation']);
			$ok = $_POST['forum_id_'.$myrrow['lost_id']];
			$moder = (in_array($id, $moderation)) ? true : false;
			
			// Если назначить, или снять
			if ($ok AND !$moder) { 
				array_unshift($moderation, $id);
				$myrrow['lost_moderation'] = implode(' ', $moderation);
				mysql_query("UPDATE `element_forum_list_2` SET `lost_moderation` = '$myrrow[lost_moderation]' WHERE `lost_id` = '$myrrow[lost_id]' LIMIT 1");
			} else if (!$ok AND $moder) {
				
				foreach ($moderation as $key => $value) {
					if ($value == $id) unset($moderation[$key]);
				}
				
				$myrrow['lost_moderation'] = implode(' ', $moderation);
				mysql_query("UPDATE `element_forum_list_2` SET `lost_moderation` = '$myrrow[lost_moderation]' WHERE `lost_id` = '$myrrow[lost_id]' LIMIT 1");
			}
		}
	
		header('Location: /element/admin/user?id='.$id.'');
		exit;
	}
	
	
	if ($go == 'block') {
		if (empty($profile_user['lost_block_info']) AND $user['lost_id'] != $id) {
		$time_block = (isset($_POST['time_block'])) ? $_POST['time_block'] : false;
		$text_block = (isset($_POST['text_block']) AND !empty($_POST['text_block'])) ? addslashes(htmlspecialchars($_POST['text_block'])) : false;
		
		if ($text_block) {
			$time_block_1 = ($time_block > 0) ? $time_block + time() : 0;
			$add_block = time().'(::||&&&&&&&&&||::)'.$user['lost_id'].'(::||&&&&&&&&&||::)'.$time_block_1.'(::||&&&&&&&&&||::)'.$text_block.'(::||&&&&&&&&&||::)'.$time_block;
			$profile_user['lost_block_info'] = $add_block;
			writecache('element_users_id_'.$id,$profile_user);
			user_list_update($id);
			echo '<div class="nfl p5 mb5 mlra cntr lngreen small">Персонаж "'.$profile_user['lost_login'].'" успешно заблокирован</div>';
		} else echo '<div class="nfl p5 mb5 mlra cntr red small">Причина блока обязательна для ввода</div>';
		
		}
	}
	
	if ($go == 'unblock') {
		if (!empty($profile_user['lost_block_info']) AND $user['lost_id'] != $id) {
		$profile_user['lost_block_info'] = '';
		writecache('element_users_id_'.$id,$profile_user);
		user_list_update($id);
		echo '<div class="nfl p5 mb5 mlra cntr lngreen small">Персонаж "'.$profile_user['lost_login'].'" успешно разблокирован</div>';
		}
	}
	
	if ($go == 'privilege') {
		if ($user['lost_id'] != $id) {
			$privilege = (isset($_POST['privilege'])) ? $_POST['privilege'] : false;
			
			if ($privilege) {
			$privilege = $privilege - 1;
				if ($privilege != $profile_user['lost_privilege']) {
				$privilege_name = array('Пользователь','Модератор','Полу-администратор','Администратор');
				$profile_user['lost_privilege'] = $privilege;
				writecache('element_users_id_'.$id,$profile_user);
				user_list_update($id);
				echo '<div class="nfl p5 mb5 mlra cntr lngreen small">Привилегии сменены на: '.$privilege_name[$privilege].'</div>';
				}
			}
		}
	}
	
	if ($go == 'login') {
	$er = 'В имени вы можете использовать от 3-х до 16-и символов и 2-а пробела. Нельзя использовать цифры и чередовать латиницу с кириллицей.<br/>';
	$nickname = (isset($_POST['nickname'])) ? mb_convert_case(mysql_real_escape_string(htmlspecialchars(addslashes(mb_strtolower(trim($_POST['nickname']),"UTF-8")))),MB_CASE_TITLE,"UTF-8") : false;
	
	if (!$nickname OR empty($nickname)) $error = '<span class="red">Поле \'<span class="ccc">ник</span>\' обязательно для ввода</span><br/>';
	if(!preg_match('/^([a-zа-яё ]*)$/iu', $nickname)) $error = $er;
	if (preg_match("/[а-яё]/ui", $nickname) AND preg_match("/[a-z]/i", $nickname) OR substr_count($nickname,' ') > 2 
		OR  mb_strlen($nickname, 'utf-8') < 3 OR mb_strlen($nickname, 'utf-8') > 16) $error = $er;
	
		if (!isset($error)) {
		if (mysql_num_rows(mysql_query("SELECT `lost_id` FROM `element_user` WHERE `lost_login` = '$nickname' LIMIT 1")) > 0) $error = '<span class="red">Ник \'<span class="ccc">'.$nickname.'</span>\' уже занят. Выберите пожалуйста другой ник</span><br/>';
		
			if (!isset($error)) {
				$sssq = $profile_user['lost_login'];
				$profile_user['lost_login'] = $nickname;
				mysql_query("UPDATE `element_user` SET `lost_login` = '$nickname' WHERE `lost_id` = '$id' LIMIT 1");
					
				$statistika_user = 'Время: '.rdate("Y год, d M H:i", time()).'<br/>
				Админка: Смена ника с <span class="moderator">'.$sssq.'</span> на <span class="moderator">'.$nickname.'</span>';
				
				update_money_exp($profile_user, 0, 0, 0, 0);
				header('Location: /element/admin/user?id='.$id);
				exit;
			} else echo '<div class="nfl cntr p5 mt5 mb5 error1 mlra small">'.$error.'</div>';
		
		} else echo '<div class="nfl cntr p5 mt5 mb5 error1 mlra small">'.$error.'</div>';
	}
	
	if ($go == 'expoint') {
		$expoint = (isset($_POST['expoint']) AND is_numeric($_POST['expoint'])) ? (int)$_POST['expoint'] : 0;
		update_money_exp($profile_user, $expoint, 0, 0, 0);
		header('Location: /element/admin/user?id='.$id.'');
		exit;
	}
	
	if ($go == 'gold') {
		$gold = (isset($_POST['gold']) AND is_numeric($_POST['gold'])) ? (int)$_POST['gold'] : 0;
		
		$statistika_user = 'Время: '.rdate("Y год, d M H:i", time()).'<br/>
						Нарисовано золото из админки: <img src="/images/icons/gold.png">'.$gold.' золота';
				
		
		update_money_exp($profile_user, 0, 0, 0, $gold);
		header('Location: /element/admin/user?id='.$id.'');
		exit;
	}
	
	if ($go == 'email') {
		$email = (isset($_POST['email'])) ? htmlspecialchars(trim($_POST['email'])) : '';
		
		$statistika_user = 'Время: '.rdate("Y год, d M H:i", time()).'<br/>
						Смена email c "'.$profile_user['lost_email'].'" на "'.$email.'"';
		$profile_user['lost_email'] = $email;
		
		update_money_exp($profile_user, 0, 0, 0, 0);
		header('Location: /element/admin/user?id='.$id.'');
		exit;
	}
	
	if ($go == 'cristall') {
		$cristall = (isset($_POST['cristall']) AND is_numeric($_POST['cristall'])) ? (int)$_POST['cristall'] : 0;
		
		$statistika_user = 'Время: '.rdate("Y год, d M H:i", time()).'<br/>
						Нарисованы кристаллы из админки: <img src="/images/icons/gold.png">'.$cristall.' кристаллов';
		
		update_money_exp($profile_user, 0, $cristall, 0, 0);
		header('Location: /element/admin/user?id='.$id.'');
		exit;
	}
	
	if ($go == 'irridiy') {
		$irridiy = (isset($_POST['irridiy']) AND is_numeric($_POST['irridiy'])) ? (int)$_POST['irridiy'] : 0;
		
		$statistika_user = 'Время: '.rdate("Y год, d M H:i", time()).'<br/>
						Нарисован ирридий из админки: <img src="/images/icons/irridyi.png">'.$irridiy.' ирридия';
		
		update_money_exp($profile_user, 0, 0, $irridiy, 0);
		header('Location: /element/admin/user?id='.$id.'');
		exit;
	}
	
	if ($go == 'hp') {
		$hp = (isset($_POST['hp']) AND is_numeric($_POST['hp'])) ? (int)$_POST['hp'] : 0;
		
		SetParams($profile_user, 0, $hp, 0, true);
		header('Location: /element/admin/user?id='.$id.'');
		exit;
	}
	
	if ($go == 'str') {
		$str = (isset($_POST['str']) AND is_numeric($_POST['str'])) ? (int)$_POST['str'] : 0;
		
		SetParams($profile_user, $str, 0, 0, true);
		header('Location: /element/admin/user?id='.$id.'');
		exit;
	}
	
	if ($go == 'block') {
		$block = (isset($_POST['block']) AND is_numeric($_POST['block'])) ? (int)$_POST['block'] : 0;
		
		SetParams($profile_user, 0, 0, $block, true);
		header('Location: /element/admin/user?id='.$id.'');
		exit;
	}
	
	if ($go == 'avatar') {
		$avatar = (isset($_POST['avatar'])) ? trim($_POST['avatar']) : '';
		$profile_user['lost_avatar'] = $avatar;
		writecache('element_users_id_'.$id,$profile_user);
		user_list_update($id);
		header('Location: /element/admin/user?id='.$id.'');
		exit;
	}
	
	if ($profile_user['lost_town'] == 0 AND $go == 'v_town') {
	$town_id = (isset($_POST['id_town']) AND is_numeric($_POST['id_town'])) ? (int)$_POST['id_town'] : false;
	if ($town_id) {
	$cache_t = cache_town($town_id);
	if ($cache_t) {
		$priglashenie = array('user_id_kto' => $user['lost_id'], 'lost_town' => $town_id);
		writecache('element_v_gorod_user'.$id, $priglashenie);
				
		echo '<div class="nf2 small p5 mb5 small cntr lngreen mlra">';
		echo 'Приглашение в город успешно отправлено';
		echo '</div>';
		} else echo '<div class="nf2 small p5 mb5 small cntr red mlra">Города не существует</div>';
	} else echo '<div class="nf2 small p5 mb5 small cntr red mlra">Поле должно быть integer</div>';
	}
	
	if ($go == 'up' AND $profile_user['lost_town'] > 0) {
	$cache_t = cache_town($profile_user['lost_town']);
	$town_o = explode(':', $profile_user['lost_town_other']);
		if($town_o[0] > 0 AND $town_o[0] <= 7) {
			$list_user = readcache('element_list_user_town'.$profile_user['lost_town']);
				
				if (!empty($list_user)) {
				unset($list_user[$town_o[0]][$id]);
				$list_user[$town_o[0] - 1][$id] = $profile_exp[2];
				writecache('element_list_user_town'.$profile_user['lost_town'], $list_user);
				}
						
			$town_o[0] = $town_o[0] - 1;
			$profile_user['lost_town_other'] = implode(':', $town_o);
			
			$journal = '<span class="lngreen">[user]'.$user['lost_id'].'[/user] повысил [user]'.$id.'[/user] до звания: '.town_users_zvanie($town_o[0]).'</span>';
			mysql_query("INSERT INTO `element_town_journal` SET `lost_town` = '$profile_user[lost_town]',
																`lost_value` = '$journal',
																`lost_time` = '".time()."'");
			writecache('element_users_id_'.$id, $profile_user);
			user_list_update($id);	
			header('Location: /element/admin/user?id='.$id);
			exit;
		}
	}
	
	if ($go == 'down' AND $profile_user['lost_town'] > 0) {
	$cache_t = cache_town($profile_user['lost_town']);
	$town_o = explode(':', $profile_user['lost_town_other']);
		if($town_o[0] < 7) {
			$list_user = readcache('element_list_user_town'.$profile_user['lost_town']);
				
				if (!empty($list_user)) {
				unset($list_user[$town_o[0]][$id]);
				$list_user[$town_o[0] + 1][$id] = $profile_exp[2];
				writecache('element_list_user_town'.$profile_user['lost_town'], $list_user);
				}
						
			$town_o[0] = $town_o[0] + 1;
			$profile_user['lost_town_other'] = implode(':', $town_o);
			
			$journal = '<span class="red">[user]'.$user['lost_id'].'[/user] понизил [user]'.$id.'[/user] до звания: '.town_users_zvanie($town_o[0]).'</span>';
			mysql_query("INSERT INTO `element_town_journal` SET `lost_town` = '$profile_user[lost_town]',
																`lost_value` = '$journal',
																`lost_time` = '".time()."'");
			writecache('element_users_id_'.$id, $profile_user);
			user_list_update($id);	
			header('Location: /element/admin/user?id='.$id);
			exit;
		}
	}

	
	if ($go == 'kick' AND $profile_user['lost_town'] > 0) {
		$list_user = readcache('element_list_user_town'.$profile_user['lost_town']);
		
		if (!empty($list_user)) {
		unset($list_user[$town_o[0]][$id]);
		writecache('element_list_user_town'.$profile_user['lost_town'], $list_user);
		}
		
		$profile_user['lost_town_altar_time'] = time() - 5;
		$profile_user['lost_town'] = 0;
		$journal = '<span class="red">[user]'.$user['lost_id'].'[/user] исключил из города [user]'.$id.'[/user]</span>';
		mysql_query("INSERT INTO `element_town_journal` SET `lost_town` = '$profile_user[lost_town]',
																			`lost_value` = '$journal',
																			`lost_time` = '".time()."'");

		writecache('element_users_id_'.$id, $profile_user);	
		user_list_update($id);	
		header('Location: /element/admin/user?id='.$id);
		exit;
	}

	if (isset($_GET['client_info'])) {
		$exp_ip = explode('**', $profile_user['lost_ip']);
		krsort($exp_ip);
		echo '<div class="nfl p5 mb5 mlra small">';	
		echo '<div class="yellow1 mb5 cntr"><a href="/element/admin/user?id='.$id.'">В управление персонажом</a></div>';
		echo '<span class="white">Регистрационный IP адрес: </span><span class="moderator">'.$profile_user['lost_start_ip'].'</span><br/>';
		echo '<span class="white">Регистрация с <span class="moderator">'.UserAgent($profile_user['lost_user_agent']).'</span> где UserAgent: </span><span class="moderator">'.$profile_user['lost_user_agent'].'</span>';
		echo '<div class="hr mt5 mb5"></div>';
		echo '<span class="white">Текущие IP адреса: </span><span class="moderator">'.$profile_user['lost_ip'].'</span><br/>';
		echo '<span class="white">Играет с <span class="moderator">'.UserAgent($profile_user['lost_user_agent_2']).'</span> где UserAgent: </span><span class="moderator">'.$profile_user['lost_user_agent_2'].'</span>';
		echo '<div class="hr mt5 mb5"></div>';
		echo '<div class="yellow1 mb5 cntr">Другие возможные персонажы</div>';
		
		$list_clony = array();
		foreach ($exp_ip as $ip) {
			$mylty = mysql_query("SELECT `lost_id` FROM `element_user` WHERE `lost_ip` LIKE '%$ip%' AND `lost_id` != '$id'");
			while ($qwe = mysql_fetch_array($mylty)) {
				if (empty($list_clony[$qwe['lost_id']])) $list_clony[$qwe['lost_id']] = $qwe['lost_id'];
			}
		}
		
		// Выводим список мультов, иначе говорим, что их нету
		if (count($list_clony) > 0) {
			$color = 0;
			foreach ($list_clony as $value_id) {
				if ($color % 2) $odd = ''; else $odd = ' odd';
				$cache_clon = cache_user($value_id);
				echo '
					<div class="ml5 mr5">
						<a class="bl p5 small block'.$odd.'" href="/user?id='.$value_id.'">
						Персонаж '.$value_id.': '.ikonka_user($cache_clon['lost_race'], 'online').' <span class="yellow1">'.$cache_clon['lost_login'].'</span><br/>
						Список IP адресов: <span class="moderator">'.$cache_clon['lost_ip'].'</span><br/>
						Схожесть UserAgent\'ов: <span class="moderator">'.(($profile_user['lost_user_agent_2'] == $cache_clon['lost_user_agent_2']) ? 'Данные на 100% совпадают' : 'Данные не совпадают').'</span><br/>
						Пароли: <span class="moderator">'.(($profile_user['lost_password'] == $cache_clon['lost_password']) ? 'Совпадают' : 'Не совпадают').'</span><br/>
						Регистрационные IP: <span class="moderator">'.(($profile_user['lost_start_ip'] == $cache_clon['lost_start_ip']) ? 'Совпадает' : 'Не совпадает').'</span>
						</a>
					</div>
				';
				$color++;
			}
		} else echo '<div class="moderator mb5 cntr">Мультов по текущим IP адресам не найдено!</div>';
		
		echo '<div class="yellow1 mt5 cntr"><a href="/element/admin/user?id='.$id.'">В управление персонажом</a></div>';
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}
	
	if (isset($_GET['xsolla'])) {
		echo '<div class="nfl p5 mb5 mlra small">';	
		echo '<div class="yellow1 mb5 cntr"><a href="/element/admin/user?id='.$id.'">В управление персонажом</a></div>';
		$query = mysql_result(mysql_query("SELECT COUNT(`lost_id`) FROM `element_xsolla` WHERE `lost_user` = '$id'"), 0);
		
		if ($query > 0) {
			require_once './element_function/element_function_pagination.php';
			$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
			$pagination = pagination(10, $page, $query);
			
			$query = mysql_query("SELECT * FROM `element_xsolla` WHERE `lost_user` = '$id' ORDER BY `lost_time` DESC LIMIT $pagination[start], $pagination[num]");
			
			while ($myrrow = mysql_fetch_array($query)) {
				if ($color % 2) $odd = ''; else $odd = ' odd';
				echo '
					<div class="ml5 mr5">
						<div class="bl p5 small white block'.$odd.'">
						Наш ID платежа: <span class="moderator bold">'.$myrrow['lost_id'].'</span><br/>
						Xsolla ID платежа: <span class="moderator bold">'.$myrrow['lost_xsolla_id'].'</span><br/>
						Сумма золота: <img src="/images/icons/gold.png"><span class="moderator bold">'.$myrrow['lost_sum'].'</span><br/>
						Дата Xsolla, для сверки платежей: <span class="moderator bold">'.$myrrow['lost_date'].'</span><br/>
						Наша дата платежа: <span class="moderator bold">'.rdate("Y год, d M H:i:s", $myrrow['lost_time']).'</span><br/>
						'.(($myrrow['lost_refferal'] > 0) ? '<span class="moderator bold">Выплата по реферальной системе</span>' : '').'
						</div>
					</div>
				';
				
				$color++;
			}
		
			echo pagination_echo($pagination['page'],$pagination['total'],'/element/admin/user?id='.$id.'&xsolla&page=');
		} else echo '<div class="moderator mb5 cntr">Персонаж ещё не покупал золото!</div>';
		
		echo '<div class="yellow1 mt5 cntr"><a href="/element/admin/user?id='.$id.'">В управление персонажом</a></div>';
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}
	
	if (isset($_GET['params'])) {
		require_once './element_function/element_function_item.php';
		$wear = users_wear_item($id);
		$shoot = users_shoot_item($id);
		ParamsCountRepeat($wear, $shoot, $profile_user);
	}
	
	if (isset($_GET['refferer'])) {
		$sql = "SELECT `id_refferer` FROM `element_refferer` WHERE `id_user` = '$id'";
		$query = mysql_query($sql);
		$count = mysql_num_rows($query);
		
		echo '<div class="nfl p5 mb5 mlra small">';	
		echo '<div class="yellow1 mb5 cntr"><a href="/element/admin/user?id='.$id.'">В управление персонажом</a></div>';
		
		if ($count == 0) {
			echo '<div class="mt5 mb5 ccc cntr">Пользователь ещё никого не пригласил в игру</div>';
		} else {
			echo '<div class="mt5 mb5 yellow1 cntr">Приглашено игроков: ' . $count . '</div>';
			
			while ($myrrow = mysql_fetch_assoc($query)) {
				$id_user = cache_user($myrrow['id_refferer']);
				$on_off = (!empty($online[$myrrow['id_refferer']])) ? 'online' : 'offline';
				
				echo ikonka_user($id_user['lost_race'], $on_off) . ' <a href="/user?id=' . $myrrow['id_refferer'] . '">' . $id_user['lost_login'] . '</a><br/>';
				
			}
			
		}
		
		
		echo '<div class="yellow1 mt5 cntr"><a href="/element/admin/user?id='.$id.'">В управление персонажом</a></div>';
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}
	
	
	if (isset($_GET['history'])) {
		echo '<div class="nfl p5 mb5 mlra small">';	
		echo '<div class="yellow1 mb5 cntr"><a href="/element/admin/user?id='.$id.'">В управление персонажом</a></div>';
		$count_h = mysql_result(mysql_query("SELECT COUNT(`lost_id`) FROM `element_history_user` WHERE `lost_user` = '$id'"), 0);
		
		if ($count_h > 0) {
			require_once './element_function/element_function_pagination.php';
			$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
			$pagination = pagination(15, $page, $count_h);
			
			$query = mysql_query("SELECT `lost_text` FROM `element_history_user` WHERE `lost_user` = '$id' ORDER BY `lost_time` DESC LIMIT $pagination[start], $pagination[num]");
			
			while ($myrrow = mysql_fetch_array($query)) {
				echo $myrrow['lost_text'];
			}
		
			echo pagination_echo($pagination['page'],$pagination['total'],'/element/admin/user?id='.$id.'&history&page=');
		} else echo '<div class="cntr mb5 mt5 white">Пусто</div>';
		
		echo '<div class="yellow1 mt5 cntr"><a href="/element/admin/user?id='.$id.'">В управление персонажом</a></div>';
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}
	
	if ($go == 'password') {
		$update_password = (isset($_POST['update_password'])) ? htmlspecialchars(addslashes(trim($_POST['update_password']))) : false;
		$repeat_password = (isset($_POST['replace_password'])) ? htmlspecialchars(addslashes(trim($_POST['replace_password']))) : false;
	
		if (!$update_password OR empty($update_password)) $error .= 'Поле \'<span class="ccc">пароль</span>\' обязательно для ввода<br/>';
		if (!$repeat_password OR empty($repeat_password)) $error .= 'Поле \'<span class="ccc">повторный пароль</span>\' обязательно для ввода<br/>';
	
		if (md5(md5($update_password)) != md5(md5($repeat_password))) $error .= 'Пароль не совпадают<br/>';
		
		if (!isset($error)) {
			$profile_user['lost_password'] = md5(md5($update_password));
			writecache('element_users_id_'.$id, $profile_user);
			mysql_query("UPDATE `element_user` SET `lost_password` = '$profile_user[lost_password]'
													WHERE `lost_id` = '$id' LIMIT 1");
			
				if ($user['lost_id'] == $id) {
					setcookie('id', $id, time()+3600*24*365, '/');
					setcookie('password',$profile_user['lost_password'], time()+3600*24*365, '/');	
				}
			
			header('Location: /element/admin/user?id='.$id);
			exit;
		} else echo '<div class="nfl cntr p5 mt5 mb5 error1 mlra small">'.$error.'</div>';
	
	}
	
	$blessing = SetBlessing($profile_user['lost_blessing']);
echo '<div class="nfl p5 mb5 mlra small">';	
echo '<span class="yellow1">Персонаж ID: '.$id.', '.ikonka_user($profile_user['lost_race'], ((!empty($online[$id])) ? 'online' : 'offline')).' <a href="/user?id='.$id.'">'.$profile_user['lost_login'].'</a></span><br/>';	
echo '<span class="yellow1">Регистрация: '.rdate("Y, d M H:i", $profile_other[0]).'</span><br/>';	
echo '<span class="yellow1">Опыт: '.Replace_Bytes($profile_exp[0]).' / '.Replace_Bytes($profile_exp[1]).' / '.Replace_Bytes($profile_exp[2]).'</span><br/>';
echo '<span class="yellow1">Деньги: </span><span class="bold white"><img src="/images/icons/gold.png"> '.$profile_user['lost_money_gold'].'
 <img src="/images/icons/cristall.png"> '.$profile_user['lost_resourse_cristalls'].'
 <img src="/images/icons/irridyi.png"> '.$profile_user['lost_resourse_irridyi'].'
 </span><br/>';
echo '<span class="yellow1">Благословение: '.$blessing['name'].'<span><br/>';	
 
	echo '<div class="cntr mt5">';
	echo '<a class="button w96" href="/element/admin/user?id='.$id.'&client_info">IP, USER-AGENT, мульты..</a><br/>';
	echo '<a class="button w96 mt5" href="/element/admin/user?id='.$id.'&xsolla">История платежей: XSOLLA</a><br/>';
	echo '<a class="button w96 mt5" href="/element/admin/user?id='.$id.'&refferer">Рефералы</a><br/>';
	echo '<a class="button w96 mt5" href="/element/admin/user?id='.$id.'&history">История действий</a><br/>';
	echo '<a class="button w96 mt5" href="/element/admin/user?id='.$id.'&params">Пересчитать параметры</a><br/>';
	echo '</div>';
 
	echo '<div class="nf2 cntr p5 mt5 mlra small">';

		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=login">
			  <label class="bl mb5 ccc">Логин:<br>
			  <input class="fdark w50" type="text" name="nickname" value="'.$profile_user['lost_login'].'" size="20" maxlength="32">
		      <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
			  
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=email">
			  <label class="bl mb5 ccc">Email:<br>
			  <input class="fdark w50" type="text" name="email" value="'.$profile_user['lost_email'].'" size="20" maxlength="32">
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
		//$profile_user['lost_exp'] = '5940 18169 5645';
		//writecache('element_users_id_'.$id,$profile_user);
		
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=hp">
			  <label class="bl mb5 ccc">Добавить здоровья:<br>
			  <input class="fdark w50" type="text" name="hp" value="" size="20" maxlength="32">
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
		
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=block">
			  <label class="bl mb5 ccc">Добавить брони:<br>
			  <input class="fdark w50" type="text" name="block" value="" size="20" maxlength="32">
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
			  
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=str">
			  <label class="bl mb5 ccc">Добавить силы:<br>
			  <input class="fdark w50" type="text" name="str" value="" size="20" maxlength="32">
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
	  
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=expoint">
			  <label class="bl mb5 ccc">Добавить опыт:<br>
			  <input class="fdark w50" type="text" name="expoint" value="" size="20" maxlength="32">
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
			  
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=gold">
			  <label class="bl mb5 ccc">Добавить золото:<br>
			  <input class="fdark w50" type="text" name="gold" value="" size="20" maxlength="32">
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
			  
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=cristall">
			  <label class="bl mb5 ccc">Добавить кристаллы:<br>
			  <input class="fdark w50" type="text" name="cristall" value="" size="20" maxlength="32">
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
			  
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=irridiy">
			  <label class="bl mb5 ccc">Добавить ирридий:<br>
			  <input class="fdark w50" type="text" name="irridiy" value="" size="20" maxlength="32">
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
			  
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=avatar">
			  <label class="bl mb5 ccc">Аватар:<br>
			  <input class="fdark w50" type="text" name="avatar" value="'.$profile_user['lost_avatar'].'" size="20" maxlength="32">
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
			  
		
		$privilege = array('Пользователь','Модератор','Полу-администратор','Администратор');
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=privilege">
			  <label class="bl mb5 ccc ">Привилегии:<br>
			  <select class="fdark mb10 w50" name="privilege">';
			  foreach ($privilege as $key => $value) {
			  $selected = ($key == $profile_user['lost_privilege']) ? 'selected' : '';
			  echo '<option value="'.($key + 1).'" '.$selected.'>'.$value.'</option>';
			  }
			  
		echo '</select>
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';		
		echo '</div>';
		
		// Город
		echo '<div class="nf2 cntr p5 mt5 mlra small">';
			if ($profile_user['lost_town'] == 0) {
			echo '<span class="bl mb5 ccc">Персонаж находиться вне города</span>';
			echo '<form method="post" action="/element/admin/user?id='.$id.'&go=v_town">
			  <label class="bl mb5 moderator">Пригласить в город с ID:<br>
			  <input class="fdark w50" type="text" name="id_town" value="" size="20" maxlength="32">
			  <input type="submit" class="button blue w10" name="submit" value="ok"/>
			  </label></form>';
			} else {
			$cache_t = cache_town($profile_user['lost_town']);
			echo '<span class="bl mb5 ccc"><span class="yellow1">Город: <img src="/images/town/race_'.$cache_t['lost_race'].'.png" alt=""/> <a class="yellow1 bold" href="/town?id='.$cache_t['lost_id'].'">'.$cache_t['lost_name'].'</a>, '.town_users_zvanie($town_o[0]).'</span><br/></span>';
			
			echo ($town_o[0] > 0 AND $town_o[0] <= 7) ? '<div class="ml5 mr5">
						  <a class="bl p5 block odd" href="/element/admin/user?id='.$id.'&go=up">
						  <span class="small yellow1"> Повысить звание</span> <span class="lngreen"></span>
						  </a>
					      </div>' : '';
			echo ($town_o[0] < 7) ? '<div class="ml5 mr5">
						  <a class="bl p5 block odd" href="/element/admin/user?id='.$id.'&go=down">
						  <span class="small yellow1"> Понизить звание</span> <span class="lngreen"></span>
						  </a>
					      </div>' : '';
			echo '<div class="ml5 mr5">
						  <a class="bl p5 block odd" href="/element/admin/user?id='.$id.'&go=kick">
						  <span class="small yellow1"> Исключить с города</span> <span class="lngreen"></span>
						  </a>
					      </div>';
			}
		echo '</div>';
		
		echo '<div class="nf2 cntr p5 mt5 mlra small"><span class="bl mb5 ccc">Сменить стихию на:</span>';
		$race_1 = array('ogon','voda','vozdukh','zemlya');
		$race_2 = array('огня','воды','воздуха','земли');
		
		for ($i = 0; $i < 4; $i++) {
			if (($i + 1) != $profile_user['lost_race']) {
				echo '<span class="inbl w30 va_t">
					<a class="atask" href="/element/admin/user?id='.$id.'&go=race&to='.($i + 1).'">
					<span class="inbl prel">
					<img width="40" height="40" src="/images/race/'.$race_1[$i].'.png" alt=""/>
					</span><br/>
					<span class="small yellow1 mt3">Стихия '.$race_2[$i].'</span>
					</a>
					</span>';
			}
		}
		echo '</div>';
	
		if (empty($profile_user['lost_block_info']) AND $user['lost_id'] != $id) {
		echo '<div class="nf2 cntr p5 mt5 mlra small">';
		echo '<form method="post" action="/element/admin/user?id='.$id.'&go=block">
			  <label class="bl mb5 ccc ">Время блокировки:<br>
			  <select class="fdark mb10 w70" name="time_block">
				<option value="0">Вечный блок</option>
				<option value="'.(86400 * 1).'">1 день</option>
				<option value="'.(86400 * 7).'">7 дней</option>
				<option value="'.(86400 * 15).'">15 дней</option>
				<option value="'.(86400 * 30).'">30 дней</option>
				<option value="'.(86400 * 90).'">90 дней</option>
				<option value="'.(86400 * 365).'">365 дней</option>
			  </select>
			  </label>
			  <label class="bl mt5 ccc">Причина блокировки:<br>
			  <textarea class="w70 mb5 fdark" rows="3" name="text_block"></textarea><br/>
			  </label>
			  <input type="submit" class="button blue w40" name="submit" value="Заблокировать"/>
			  </form>';
		echo '</div>';
		} 
		if (!empty($profile_user['lost_block_info']) AND $user['lost_id'] != $id) {
		$block_info = explode('(::||&&&&&&&&&||::)', $profile_user['lost_block_info']);
		$block_user = cache_user($block_info[1]);
		
			if ($block_info[4] > 0) {
				$timer = $block_info[2] - time();
				
				if ($timer <= 0) {
					$profile_user['lost_block_info'] = '';
					writecache('element_users_id_'.$id,$profile_user);
					mysql_query("UPDATE `element_user` SET `lost_block_info` = '' WHERE `lost_id` = '$id' LIMIT 1");
					header('Location: /element/admin/user?id='.$id.'');
					exit;
				}
				
				if ($timer > 86400) {
					$tt = (int)($timer / 86400);
					$tt_1 = $tt * 86400;
					$timer = $timer - $tt_1;
					$tt = $tt.'д.';
					$timer_1 = date("$tt Hч iм sс", mktime(0, 0, $timer));
				} else $timer_1 = date("Hч iм sс", mktime(0, 0, $timer));
			}
		
		echo '<div class="nf2 p5 mt5 mlra small">';	
		echo '<span class="yellow1">Время выдачи блока: </span><span class="ccc">'.rdate("d M Y, H:i", $block_info[0]).'</span><br/>';
		echo '<span class="yellow1">Тип блокировки: </span><span class="ccc">'.(($block_info[4] == 0) ? 'Вечная блокировка' : ($block_info[4] / 86400).' дней').'</span><br/>';
		echo ($block_info[4] > 0) ? '<span class="yellow1">Осталось: </span><span class="admin">'.$timer_1.'</span><br/>' : '';
		echo '<span class="yellow1">Выдал блокировку: </span><span class="ccc">'.ikonka_user($block_user['lost_race'], ((!empty($online[$block_user['lost_id']])) ? 'online' : 'offline')).' <a href="/user?id='.$block_user['lost_id'].'">'.$block_user['lost_login'].'</a></span><br/>';
		echo '<span class="yellow1">Причина блокировки: </span><span class="ccc">'.nl2br($block_info[3]).'</span><br/>';
		
		echo '<div class="cntr"><a class="button mt5 w40" href="/element/admin/user?id='.$id.'&go=unblock">Разблокировать</a></div>';
		
		echo '</div>';
		}
		echo '<div class="nf2 cntr p5 mt5 mlra small">
			<form method="post" action="/element/admin/user?id='.$id.'&go=password">
			<label class="bl mb5 ccc">Установить пароль:<br>
			<input class="fdark w70" type="password" name="update_password" value="" size="20" maxlength="32">
			</label>
	
			<label class="bl mb5 ccc">Подтвердить пароль:<br>
			<input class="fdark w70" type="password" name="replace_password" value="" size="20" maxlength="32">
			</label>
		
			<input type="submit" class="button blue w40" name="submit" value="Сменить"/>
			
			</form>
			</div>';
		
		echo '<div class="nf2 p5 mt5 mlra small">
			<form method="post" action="/element/admin/user?id='.$id.'&forum">
			<label class="bl cntr mb5 ccc">Форум. Добавить / Снять модератора раздела</label>';
		
		while ($myrrow = mysql_fetch_array($subforum)) {
			$moderation = explode(" ", $myrrow['lost_moderation']);
			if (in_array($id, $moderation)) $selected = 'checked'; else $selected = '';
			
			echo '<input type="checkbox" name="forum_id_'.$myrrow['lost_id'].'" value="'.$myrrow['lost_id'].'" '.$selected.'/>'.$myrrow['lost_name'].'<br/>';
		}
		
		echo '<div class="cntr"><input type="submit" class="button blue mt5 w40" name="submit" value="Изменить"/></div></form></div>';
	
	
echo '</div>';
require_once './element_include/element_foot_user_true.php';
?>