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

Размер файла: 42.22Kb
<?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'])) ? addslashes(htmlspecialchars($_GET['to'])) : false;

if(isset($_GET['post']) && $_GET['post']==='avatar'){
	if(!empty($_FILES)){
		$file_save = $_SERVER['DOCUMENT_ROOT'].'/images/avatars/users/'.$_FILES['userfile']['name'];
		$insert = move_uploaded_file($_FILES['userfile']['tmp_name'], $file_save);
		if($insert != false){
			mysql_query("INSERT INTO `ava`(`price`, `image`) VALUES ('{$_POST[price]}','{$_FILES[userfile][name]}')");
		}
	}
}

if(isset($_GET['post']) && $_GET['post']==='editavatar'){
	if(isset($_POST['delete']) && !empty($_POST['delete'])){
		mysql_query("DELETE FROM `ava` WHERE `id`='{$_POST[id]}'");
		unlink($_SERVER['DOCUMENT_ROOT'].'/images/avatars/users/'.$_POST['image']);
		header("Location: /element/admin/panel?go=avatarlist");
		exit;
	}
	if(isset($_POST['price'])){
		mysql_query("UPDATE `ava` SET `price`='{$_POST[price]}' WHERE `id`='{$_POST[id]}'");
		header("Location: /element/admin/panel?go=avatarlist");
		exit;
	}
}
if ($go == 'avatarlist') {
		$title = 'Аватарки';  
		require_once './element_include/element_head.php';
		require_once './element_include/element_header_user_true.php';
		
		echo '<div class="nfl p5 mb5 mt5 mlra">';
		echo '<div class="small cntr mb10 yellow1"><a href="/element/admin/panel">В панель управления</a></div>';
		echo '<div class="cntr small">';
		echo'<form enctype="multipart/form-data" action="/element/admin/panel?post=avatar" method="POST">
		Файл: <input name="userfile" type="file" /><br />
		Стоимость: <input name="price" type="text" /><br />
		<input type="submit" value="Добавить" />
		</form>';
		echo '</div>';
		echo '<hr />';
		echo '<hr />';
		$resuolt = mysql_query("SELECT `id`, `price`, `image` FROM `ava` LIMIT 0,50");
		if($resuolt != false){
			while($arr = mysql_fetch_assoc($resuolt)){
			// ["id"]=> string(1) "1" ["price"]=> string(2) "20" ["image"]=> string(15) "rlpkfV0Y4i0.jpg" }
				echo "<img class='plr10' src='/images/avatars/users/{$arr[image]}'/><br/>";
				echo "Стоимость {$arr[price]}<br/>";
				echo "<form method='post' action='/element/admin/panel?post=editavatar'>";
				echo "<input type='checkbox' name='delete' value='{$arr[id]}'> Удалить<br/>";
				echo "<input type='hidden' name='id' value='{$arr[id]}'>";
				echo "<input type='hidden' name='image' value='{$arr[image]}'>";
				echo "<input type='text' name='price' value='{$arr[price]}'><br/>";
				echo "<input type='submit' name='submit' value='Отправить'><br/>";
				echo "</form>";
				echo '<hr />';
			}
		}
	require_once './element_include/element_foot_user_true.php';
	exit;
	
}
	if ($go == 'other_settings') {
		$title = 'Общие настройки';  
		require_once './element_include/element_head.php';
		require_once './element_include/element_header_user_true.php';
		
		if ($to == 'game') {
			$servets = element_settings_game('lost_servers');
			$servets = ($servets == 0) ? 1 : 0;
			writecache('element_settings_game_lost_servers', $servets);
			mysql_query("UPDATE `element_options_games` SET `lost_value` = '$servets' WHERE `lost_options` = 'lost_servers' LIMIT 1");
			header('Location: /element/admin/panel?go=other_settings'); 
			exit;
		}
		$list_user = user_list_update(0);
		if ($to == 'update_online') {
			if (count($list_user) > 0) {
			echo '<div class="nfl p5 cntr mb5 mt5 mlra">';
				foreach ($list_user as $key => $value) {
					$cache_user = readcache('element_users_id_'.$key);
					if (!empty($cache_user)) {
						update_params_users($cache_user);
						echo '<span class="small lngreen">Обновлен игрок  <span class="bold">'.$cache_user['lost_login'].'</span></span><br/>';
						unset($list_user[$key]);									   
						writecache('element_user_list_update', $list_user);
					}
				}
			echo '</div>';
			}	
		}
		
		if ($to == 'unset_online') {
			$online = array();
			writecache('lost_element_online', $online);
			header('Location: /element/admin/panel?go=other_settings'); 
			exit;
		}
			$list_town = town_list_update(0);
		if ($to == 'update_town') {
			
			if (count($list_town) > 0) {
			echo '<div class="nfl p5 cntr mb5 mt5 mlra">';
				foreach ($list_town as $key => $value) {
					$cache_town = readcache('element_town_id_'.$key);
					if (!empty($cache_town)) {
						mysql_query("UPDATE `element_town` SET `lost_name` = '$cache_town[lost_name]',
															   `lost_level` = '$cache_town[lost_level]',
															   `lost_exp` = '$cache_town[lost_exp]',
															   `lost_race` = '$cache_town[lost_race]',
															   `lost_max_users` = '$cache_town[lost_max_users]',
															   `lost_text_announce` = '$cache_town[lost_text_announce]',
															   `lost_other_announce` = '$cache_town[lost_other_announce]',
															   `lost_treas_gold` = '$cache_town[lost_treas_gold]',
															   `lost_treas_crist` = '$cache_town[lost_treas_crist]',
															   `lost_treas_iridiy` = '$cache_town[lost_treas_iridiy]',
													           `lost_altar` = '$cache_town[lost_altar]',
															   `lost_altar_time` = '$cache_town[lost_altar_time]' WHERE `lost_id` = '$cache_town[lost_id]' LIMIT 1");
						echo '<span class="small lngreen">Обновлен город  <span class="bold">'.$cache_town['lost_name'].'</span></span><br/>';
						unset($list_town[$key]);									   
						writecache('element_town_list_update', $list_town);
					}
				}
			echo '</div>';
			}
		}
		
		if ($to == 'gold_arena') {
			$cache_gold = readcache('element_arena_pvp_gold');
			if (is_array($cache_gold)) {
				$i = 0; $c_g = 0;
				foreach ($cache_gold as $us => $gold) {
					$i++;
					$c_g = $c_g + $gold;
					$cache_user = cache_user($us);
					update_money_exp($cache_user, 0, 0, 0, $gold);
					user_list_update($us);
					unset($cache_gold[$us]);
				}
				writecache('element_arena_pvp_gold', $cache_gold);
				echo '<div class="nfl p5 cntr mb5 mt5 mlra">';
				
				echo '<span class="small lngreen">Возврат '.$i.' юзерам, '.$c_g.' золота</span></span><br/>';
				echo '</div>';
			}
		}
		
		$list_quest = quests_list_update(0);
		if ($to == 'update_quests') {
	
			if (count($list_quest) > 0) {
			echo '<div class="nfl p5 cntr mb5 mt5 mlra">';
			$i = 0;
				foreach ($list_quest as $key => $value) {
					$user_quests = readcache('element_quests_user'.$key);
					if (!empty($user_quests)) {
						mysql_query("UPDATE `element_quests_user` SET 
									`lost_new` = '$user_quests[lost_new]',
									`lost_vipolneno` = '$user_quests[lost_vipolneno]',
								    `missions_10` = '$user_quests[missions_10]',
									`labirint_3` = '$user_quests[labirint_3]',
									`labirint_all` = '$user_quests[labirint_all]',
									`arena_tvt_5` = '$user_quests[arena_tvt_5]' WHERE `lost_user` = '$key' LIMIT 1");
						unset($user_quests[$key]);									   
						writecache('element_quests_list_update', $user_quests);
					$i++;
					}
				}
			echo '<span class="small lngreen">Обновленны миссии у '.$i.' игроков</span></span><br/>';
			echo '</div>';
			}
		
		}
		
		echo '<div class="nfl p5 mb5 mt5 mlra">';
		echo '<div class="small cntr mb10 yellow1"><a href="/element/admin/panel">В панель управления</a></div>';
		echo '<div class="cntr small">';
		echo '<a class="button w96 mt5 mb5" href="/element/admin/panel?go=other_settings&to=game">'.((element_settings_game('lost_servers') == 0) ? 'Отключить игру' : 'Включить игру').'</a><br/>';
		echo '<a class="button w96 mt5 mb5" href="/element/admin/panel?go=other_settings&to=update_online">Обновить игроков: '.count($list_user).'</a>';
		echo '<a class="button w96 mt5 mb5" href="/element/admin/panel?go=other_settings&to=update_town">Обновить города: '.count($list_town).'</a>';
		echo '<a class="button w96 mt5 mb5" href="/element/admin/panel?go=other_settings&to=update_quests">Обновить задания: '.count($list_quest).'</a>';
		echo '<a class="button w96 mt5 mb5" href="/element/admin/panel?go=other_settings&to=gold_arena">Возврат золота: Арена</a>';
		echo '</div>';
		
			echo '<div class="nf2 p5 mt5 mlra">';
			echo '<div class="small p5 mb5 yellow1 cntr">Справка:</div>';
			echo '<span class="lngreen small">1. Первая кнопка (Отключить / Включить игру) - отключает игру всем, кроме администрации. Нужно иногда перед рестартом и обновлениями</span><br/><br/>';
			echo '<span class="lngreen small">2. Вторая кнопка (Обновить игроков) - обновляет данные всех персонажей, которые находяться в онлайне. Обязательна перед рестартом сервера, чтобы пользователи не теряли кое какие свои данные</span><br/><br/>';
			echo '<span class="lngreen small">4. Четветая кнопка (Обновить города) - обновляет данные всех городов, в которых были хоть какие-то изменения после посл. обновления. Обязательна перед рестартом</span><br/><br/>';
			echo '<span class="lngreen small">4. Пятая кнопка (Обновить задания) - обновляет задания всех городов, в которых были хоть какие-то изменения после посл. обновления. Обязательна перед рестартом</span><br/><br/>';
			echo '<span class="lngreen small">3. Третяя кнопка (Очистить онлайн) - очищает онлайн в игре, иногда необходимо. Перед использованием, обязательно нужно "Обновить данные игроков"</span>';
			echo '</div>';
		
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}

	if ($go == 'memcache') {
		$memcache_statistika = $memcache->getStats();
		$title = 'Статистика Memcache';  
		require_once './element_include/element_head.php';
		require_once './element_include/element_header_user_true.php';
		echo '<div class="nfl p5 mb5 mt5 mlra">';
		echo '<div class="small mb10 yellow1 cntr"><a href="/element/admin/panel?go=memcache">Обновить ститистику</a> | <a href="/element/admin/panel">В панель управления</a></div>';
		echo '<span class="small yellow1">Элементов в кэше: <span class="lngreen">'.$memcache_statistika['curr_items'].'</span></span><br/>'; 
		echo '<span class="small yellow1">Всего было элементов: <span class="lngreen">'.$memcache_statistika['total_items'].'</span></span><br/>';  
		echo '<span class="small yellow1">Размер кэша: <span class="lngreen">'.Replace_Bytes($memcache_statistika['bytes']).'</span></span><br/>';  
		echo '<span class="small yellow1">Выделено под кэш: <span class="lngreen">'.Replace_Bytes($memcache_statistika['limit_maxbytes']).'</span></span><br/>';  
		echo '<span class="small yellow1">Взяли кэш: <span class="lngreen">'.$memcache_statistika['get_hits'].' раз</span></span><br/>'; 
		echo '<span class="small yellow1">Пытались взять: <span class="lngreen">'.$memcache_statistika['get_misses'].' раз</span></span><br/>'; 
		echo '<span class="small yellow1">Соотношение (Взяли / Пытались): <span class="lngreen">'.(int)(($memcache_statistika['get_misses'] / $memcache_statistika['get_hits']) * 100).'%</span></span><br/>'; 
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}
	
	if ($go == 'mysql') {
		$title = 'MySQL запросы';  
		require_once './element_include/element_head.php';
		require_once './element_include/element_header_user_true.php';
		
			if ($to == 'count_sql') {
				$count_sql = (isset($_POST['count_sql']) AND !empty($_POST['count_sql'])) ? $_POST['count_sql'] : false;
				
				if ($count_sql) {
					echo '<div class="nfl p5 mb5 mt5 yellow1 small mlra">';
					echo 'Запрос: mysql_query("'.$count_sql.'");<br/>';
					echo 'Результат: '.mysql_result(mysql_query($count_sql), 0);
					echo '</div>';
				} else echo '<div class="nfl p5 mb5 mt5 small red cntr mlra">Вы не ввели SQL-запрос</div>';
			}
			
			if ($to == 'update_sql') {
				$update_sql = (isset($_POST['update_sql']) AND !empty($_POST['update_sql'])) ? $_POST['update_sql'] : false;
				
				if ($update_sql) {
					echo '<div class="nfl p5 mb5 mt5 yellow1 small mlra">';
					if (mysql_query($update_sql)) 
						echo '<div class="cntr yellow1">mysql_query("'.$update_sql.'")<br/>Запрос успешно выполнен!</div>'; 
						else 
						echo '<div class="cntr red">mysql_query("'.$update_sql.'")<br/>Неверный запрос. Не выполнено</div>';
					echo '</div>';
				} else echo '<div class="nfl p5 mb5 mt5 small red cntr mlra">Вы не ввели SQL-запрос</div>';
			}
		
		mysql_query("UPDATE `element_user` SET `lost_id` = '24' WHERE `lost_id` = '24' LIMIT 1") or die('no');
		
		echo '<div class="nfl p5 mb5 mt5 small cntr mlra">';
		echo '<div class="mb10 yellow1"><a href="/element/admin/panel">В панель управления</a></div>';
		
		echo '<div class="mb5"><form method="post" action="/element/admin/panel?go=mysql&to=count_sql">
			  <label class="bl mb5 ccc">Подсчет данных, SQL запрос:<br>
			  <input class="fdark w98" type="text" name="count_sql" value="'.((isset($count_sql) AND $count_sql) ? $count_sql : '').'" size="20">
			  </label>
	          <input type="submit" class="button blue w40" name="submit" value="Выполнить"/>
			  </form></div>';
			  
		echo '<div class=""><form method="post" action="/element/admin/panel?go=mysql&to=update_sql">
			  <label class="bl mb5 ccc">Другие действия, SQL запрос:<br>
			  <input class="fdark w98" type="text" name="update_sql" value="'.((isset($update_sql) AND $update_sql) ? $update_sql : '').'" size="20">
			  </label>
	          <input type="submit" class="button blue w40" name="submit" value="Выполнить"/>
			  </form></div>';
		
		echo '<div class="nf2 p5 mt5 mlra">';
		echo '<span class="red small">Тут категарически запрещено вводить что-то. Только для программистов! Может упасть вся система!!!</span>';
		echo '</div>';
		echo $_GET[1];
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}

	if ($go == 'create_item') {
		$title = 'Создание вещей';  
		require_once './element_include/element_head.php';
		require_once './element_include/element_header_user_true.php';
		require_once './element_function/element_function_item.php';
		
			function procent_item_admin($quality) {
				if ($quality == 0) return array(  0, 25);
				if ($quality == 1) return array( 26, 50);
				if ($quality == 2) return array( 51,100);
				if ($quality == 3) return array(101,150);
				if ($quality == 4) return array(151,250);
				if ($quality == 5) return array(251,400);
			}
		
			if ($to == 'create') {
				$post_user = (isset($_POST['item_user']) AND is_numeric($_POST['item_user'])) ? cache_user($_POST['item_user']) : false;
				$post_srav = ($_POST['sravnenie'] < 0 AND $_POST['sravnenie'] > 20) ? false : (int)$_POST['sravnenie'];
				$post_set  = ($_POST['set'] > 5 AND $_POST['set'] < 0) ? 0 : (int)$_POST['set'];
				$post_mesto = (isset($_POST['mesto']) AND !empty($_POST['mesto'])) ? $_POST['mesto'] : 'helmet';
				$post_encha = ($_POST['enchants'] > 5 OR $_POST['enchants'] < -1) ? -1 : (int)$_POST['enchants']; 
				$post_new = ($_POST['new'] > 1 OR $_POST['new'] < 0) ? false : (int)$_POST['new']; 
				
				$procent_set = procent_item_admin($post_set);
				
				$procent_str = ($_POST['procent_str'] < $procent_set[0] AND $_POST['procent_str'] > $procent_set[1]) ? item_generation_quality($post_set) : $_POST['procent_str'];
				$procent_hp = ($_POST['procent_hp'] < $procent_set[0] AND $_POST['procent_hp'] > $procent_set[1]) ? item_generation_quality($post_set) : $_POST['procent_hp'];
				$procent_pr = ($_POST['procent_pr'] < $procent_set[0] AND $_POST['procent_pr'] > $procent_set[1]) ? item_generation_quality($post_set) : $_POST['procent_pr'];
				
				if ($post_user) {
					$bag = users_shoot_item($post_user['lost_id']);
					$qqqe = create_item($post_user['lost_id'], $bag, $post_set, $procent_str, $procent_hp, $procent_pr, $post_encha, $post_new, $set, $post_mesto, $post_srav);
					if ($qqqe) {
						header('Location: /element/admin/panel?go=create_item&item='.$qqqe.'');
						exit;
					} else echo '<div class="nfl p5 mb5 mt5 cntr red small mlra">Произошла какая-то ошибка</div>';
				}
			}
			
			if (isset($_GET['item'])) echo '<div class="nfl p5 mb5 mt5 cntr white small mlra"><a href="/item?id='.$_GET['item'].'">Вы успешно создали вещь</a></div>';
		
		
		echo '<div class="nfl p5 mb5 mt5 cntr small mlra">';
		echo '<div class="mb10 cntr yellow1"><a href="/element/admin/panel">В панель управления</a></div>';
		echo '<form method="post" action="/element/admin/panel?go=create_item&to=create">
		
			<label class="bl mb5 ccc">ID персонажа, которому дадим вещь:<br>
			<input class="fdark w70" type="text" name="item_user" value="" size="20" maxlength="32">
			</label>
			
			<label class="bl mb5 ccc">Указываем уровень сравнения ( 0 - 20 ):<br>
			<input class="fdark w70" type="text" name="sravnenie" value="" size="20" maxlength="32">
			</label>
			
			<label class="bl mb5 ccc">Выбираем комплект:<br>
			<select class="fdark mb10 w70" name="set">
			<option value="0" selected>Обычный</option>
			<option value="1">Эпический </option>
			<option value="2">Легендарный</option>
			<option value="3">Дары Богов</option>
			<option value="4">Трофейный</option>
			<option value="5">Уникальный</option>
			</select>
			</label>
	
			<label class="bl mb5 ccc">Выбираем тип вещи:<br>
			<select class="fdark mb10 w70" name="mesto">';
			
			foreach($array_type as $key => $value) {
				echo '<option value="'.$value.'">'.name_item_mesto($value).'</option>';
			}
			//array('Обычный','Эпический','Легендарный','Дары Богов','Трофейный', 'Уникальный');
			//array(0 => 50, 1 => 75, 2 => 150, 3 => 250, 4 => 350, 5 => 500)
			echo '</select>
			</label>
			
			<label class="bl mb5 ccc">Чары:<br>
			<select class="fdark mb10 w70" name="enchants">
			<option value="-1" selected>Не установлено</option>
			<option value="0">Обычные +50</option>
			<option value="1">Эпические +75</option>
			<option value="2">Легендарые +150</option>
			<option value="3">Дары Богов +250</option>
			<option value="4">Трофейное +350</option>
			<option value="5">Уникальный +500</option>
			</select>
			</label>
			
			
			<label class="bl mb5 ccc">Новая / личная:<br>
			<select class="fdark mb10 w70" name="new">
			<option value="0" selected>Новая</option>
			<option value="1">Личная</option>
			</select>
			</label>
			
			<label class="bl mb5 ccc">Процент параметра силы (таблица процентов ниже):<br>
			<input class="fdark w70" type="text" name="procent_str" value="" size="20" maxlength="32">
			</label>
			
			<label class="bl mb5 ccc">Процент параметра здоровья (таблица процентов ниже):<br>
			<input class="fdark w70" type="text" name="procent_hp" value="" size="20" maxlength="32">
			</label>
			
			<label class="bl mb5 ccc">Процент параметра защита (таблица процентов ниже):<br>
			<input class="fdark w70" type="text" name="procent_pr" value="" size="20" maxlength="32">
			</label>
			
			<span class="button w50 mt5"><input type="submit" class="ttl" name="submit" value="Отправить"/></span><br/><br/>
			
			</form>';
		echo '<div class="line"></div>';
		
		echo '<div class="p5 yellow1">';
		echo 'ТАБЛИЦА ПРОЦЕНТОВ НА ВЕЩИ В СООТВЕТСТВИИ С КАЧЕСТВОМ ВЕЩИ. ВВОДИМ СТРОГО ПО ТАБЛИЦЕ ( ЕСЛИ ОСТАВИТЬ ПОЛЯ С ПРОЦЕНТАМИ ПУСТЫМИ, СИСТЕМА ПОДБЕРЕТ СЛУЧАЙНЫЕ ПРОЦЕНТЫ<br/><br/>
			  Обычное - от 0 до 25%<br/>
			  Эпическое - от 26 до 50%<br/>
			  Легендарное - от 51 до 100%<br/>
			  Дары Богов - от 101 до 150%<br/>
			  Трофейное - от 151 до 250%<br/>
			  Уникальный - от 251 до 400%<br/>';
		echo '</div>';
		
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}
	
	if ($go == 'xsolla') {
		$title = 'Платежы';  
		require_once './element_include/element_head.php';
		require_once './element_include/element_header_user_true.php';
		echo '<div class="nfl p5 mb5 mt5 small mlra">';
		echo '<div class="mb10 cntr yellow1"><a href="/element/admin/panel">В панель управления</a> | <a href="/element/admin/panel?go=xsolla">Обновить</a></div>';
		$query = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `element_payment_shop`"), 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_payment_shop` ORDER BY `time` DESC LIMIT $pagination[start], $pagination[num]");
			
			while ($myrrow = mysql_fetch_array($query)) {
				if ($color % 2) $odd = ''; else $odd = ' odd';
				$xs_user = cache_user($myrrow['user']);
				echo '
					<div class="ml5 mr5">
						<div class="bl p5 small white block'.$odd.'">
						Персонаж: <span class="moderator bold"><a href="/user?id='.$myrrow['user'].'">'.$xs_user['lost_login'].'</a></span><br/>
						Наш ID платежа: <span class="moderator bold">'.$myrrow['id'].'</span><br/>
						Robokassa ID платежа: <span class="moderator bold">'.$myrrow['robo_id'].'</span><br/>
						Сумма золота: <img src="/images/icons/gold.png"><span class="moderator bold">'.$myrrow['gold'].'</span><br/>
						Дата платежа: <span class="moderator bold">'.rdate("Y год, d M H:i:s", $myrrow['time']).'</span><br/>
						Цена: <span class="moderator bold">'.$myrrow['cena'].' RUR</span><br/>
						'.(($myrrow['refferer'] > 0) ? '<span class="moderator bold">Выплата по реферальной системе</span>' : '').'
						</div>
					</div>
				';
				
				$color++;
			}
		
			echo pagination_echo($pagination['page'],$pagination['total'],'/element/admin/panel?go=xsolla&page=');
		
		} else echo '<div class="moderator mb5 cntr">Платежей нет!</div>';
	
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}
	
	if ($go == 'game_setting') {
		$title = 'Общие настройки игры';  
		require_once './element_include/element_head.php';
		require_once './element_include/element_header_user_true.php';
		echo '<div class="nfl p5 mb5 cntr mt5 small mlra">';
		echo '<div class="mb10 cntr yellow1"><a href="/element/admin/panel">В панель управления</a> | <a href="/element/admin/panel?go=game_setting">Обновить</a></div>';
		
			if ($to == 'lost_bank_crisstal') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_bank_crisstal');
				writecache('element_settings_game_lost_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_bank_crisstal' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
			
			if ($to == 'lost_chat_max_count') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_chat_max_count');
				writecache('element_settings_game_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_chat_max_count' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
			
			if ($to == 'lost_chat_min_level') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_chat_min_level');
				writecache('element_settings_game_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_chat_min_level' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
			
			if ($to == 'lost_expoint') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_expoint');
				writecache('element_settings_game_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_expoint' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
	
		
			if ($to == 'lost_forum_create_topic') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_forum_create_topic');
				writecache('element_settings_game_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_forum_create_topic' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
			
			if ($to == 'lost_forum_create_comment') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_forum_create_comment');
				writecache('element_settings_game_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_forum_create_comment' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
			
			if ($to == 'lost_refresh_energy') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_refresh_energy');
				writecache('element_settings_game_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_refresh_energy' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
			
			if ($to == 'lost_support_min_level') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_support_min_level');
				writecache('element_settings_game_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_support_min_level' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
			
			if ($to == 'lost_time_bank_update') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_time_bank_update');
				writecache('element_settings_game_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_time_bank_update' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
			
			if ($to == 'lost_town_create_lvl') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_town_create_lvl');
				writecache('element_settings_game_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_town_create_lvl' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
			
			if ($to == 'lost_town_create_gold') {
				$value = (isset($_POST['value']) AND is_numeric($_POST['value'])) ? (int)($_POST['value']) : element_settings_game('lost_town_create_gold');
				writecache('element_settings_game_'.$to, $value);
				mysql_query("UPDATE `element_options_games` SET `lost_value` = '$value' WHERE `lost_options` = 'lost_town_create_gold' LIMIT 1");
				header('Location: /element/admin/panel?go=game_setting'); 
				exit;
			}
			
		echo '<div class="hr mt5 mb5"></div>';
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_bank_crisstal">
				<label class="bl mb5 ccc">Цена единицы золота в обменнике:<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_bank_crisstal').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';
			  
		echo '<div class="hr mt5 mb5"></div>';	
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_chat_max_count">
				<label class="bl mb5 ccc">Максимальное число комментариев в чатах:<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_chat_max_count').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';	
		
		echo '<div class="hr mt5 mb5"></div>';	
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_chat_min_level">
				<label class="bl mb5 ccc">Чаты можно комментировать с уровня:<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_chat_min_level').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';	
		
		echo '<div class="hr mt5 mb5"></div>';	
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_expoint">
				<label class="bl mb5 ccc">Опыт всех игроков ( 100 = 1х опыт, 200 = 2х опыт и тд ):<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_expoint').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';	
			  
		echo '<div class="hr mt5 mb5"></div>';	
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_forum_create_topic">
				<label class="bl mb5 ccc">Создавать топики на форуме можно с уровня:<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_forum_create_topic').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';	
			  
		echo '<div class="hr mt5 mb5"></div>';	
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_forum_create_comment">
				<label class="bl mb5 ccc">Создавать комментарии на форуме можно с уровня:<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_forum_create_comment').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';
			  
		echo '<div class="hr mt5 mb5"></div>';	
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_refresh_energy">
				<label class="bl mb5 ccc">Количество сек. для восст. единицы энергии:<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_refresh_energy').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';
			  
		echo '<div class="hr mt5 mb5"></div>';	
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_support_min_level">
				<label class="bl mb5 ccc">Минимальный уровень для созд. запроса в тех. под:<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_support_min_level').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';
			  
		echo '<div class="hr mt5 mb5"></div>';	
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_time_bank_update">
				<label class="bl mb5 ccc">Время восст. всего золота для обмена, в сек. ( 86400 = 1 сутки ):<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_time_bank_update').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';
		
		echo '<div class="hr mt5 mb5"></div>';	
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_town_create_lvl">
				<label class="bl mb5 ccc">Мин. уровень для создания города:<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_town_create_lvl').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';
			  
		echo '<div class="hr mt5 mb5"></div>';	
		echo '<form method="post" action="/element/admin/panel?go=game_setting&to=lost_town_create_gold">
				<label class="bl mb5 ccc">Цена создания города:<br>
				<input class="fdark w90" type="text" name="value" value="'.element_settings_game('lost_town_create_gold').'" size="20" maxlength="32">
				 <span class="button w40 mt5"><input type="submit" class="ttl" name="submit" value="Изменить"/></span>
				</label>
			  </form>';
		
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}
	
	
	if ($go == 'game_statistika') {
		$title = 'Игровая статистика';  
		require_once './element_include/element_head.php';
		require_once './element_include/element_header_user_true.php';
		echo '<div class="nfl p5 mb5 mt5 small mlra">';
		echo '<div class="mb10 cntr yellow1"><a href="/element/admin/panel">В панель управления</a> | <a href="/element/admin/panel?go=game_statistika">Обновить</a></div>';
		
		$all_users = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_user`"), 0);
		$blocket_users = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_user` WHERE `lost_block_info` != ''"), 0);
		$save_users = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_user` WHERE `lost_save` > '0'"), 0);
		$no_save_users = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_user` WHERE `lost_save` = '0'"), 0);
		$race_ogon = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_user` WHERE `lost_race` = '1'"), 0);
		$race_voda = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_user` WHERE `lost_race` = '2'"), 0);
		$race_vozd = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_user` WHERE `lost_race` = '3'"), 0);
		$race_zeml = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_user` WHERE `lost_race` = '4'"), 0);
		$pol_male = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_user` WHERE `lost_male` = 'male'"), 0);
		$pol_female = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_user` WHERE `lost_male` = 'female'"), 0);
		$sootn_all_save = round((($save_users / $all_users) * 100), 2);
		$sootn_all_no_save = round((($no_save_users / $all_users) * 100), 2);
		
		echo '<div class="nf2 p5 mlra">';
		echo '<div class="small ml5 mb5 yellow1 cntr">Статистика по игрокам</div>';
		echo '<span class="white">- Игроков в игре: '.$all_users.'</span><br/>';
		echo '<span class="white">- Заблокированных игроков: '.$blocket_users.'</span><br/>';
		echo '<span class="white">- Сохраненных игроков: '.$save_users.'</span><br/>';
		echo '<span class="white">- Не сохраненных игроков: '.$no_save_users.'</span><br/>';
		echo '<span class="white">- Соотношение (все / сохран.): '.$sootn_all_save.'%</span><br/>';
		echo '<span class="white">- Соотношение (все / не сохран.): '.$sootn_all_no_save.'%</span><br/><br/>';
		echo '<span class="white">-	Игроков за стихию Огня: '.$race_ogon.' ('.round((($race_ogon / $all_users) * 100),1).'%)</span><br/>';
		echo '<span class="white">-	Игроков за стихию Воды: '.$race_voda.' ('.round((($race_voda / $all_users) * 100),1).'%)</span><br/>';
		echo '<span class="white">-	Игроков за стихию Воздуха: '.$race_vozd.' ('.round((($race_vozd / $all_users) * 100),1).'%)</span><br/>';
		echo '<span class="white">-	Игроков за стихию Земли: '.$race_zeml.' ('.round((($race_zeml / $all_users) * 100),1).'%)</span><br/><br/>';
		echo '<span class="white">-	Всего парней: '.$pol_male.'</span><br/>';
		echo '<span class="white">- Всего девушек: '.$pol_female.'</span><br/>';
		echo '</div>';
		
		$all_item = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_item`"), 0);
		$shot_item = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_item` WHERE `lost_bag` = '0'"), 0);
		$wear_item = mysql_result(mysql_query("SELECT COUNT(lost_id) FROM `element_item` WHERE `lost_bag` = '1'"), 0);
		
		echo '<div class="nf2 p5 mt5 mlra">';
		echo '<div class="small ml5 mb5 yellow1 cntr">Статистика по вещам</div>';
		echo '<span class="white">- Вещей в игре: '.$all_item.'</span><br/>';
		echo '<span class="white">- Одетых вещей: '.$shot_item.'</span><br/>';
		echo '<span class="white">- Не одетых вещей: '.$wear_item.'</span><br/>';
		echo '</div>';
		
		echo '</div>';
		require_once './element_include/element_foot_user_true.php';
		exit;
	}

$title = 'Админ Панель';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
echo '<div class="nfl p5 mb5 mlra small">';	

echo '<div class="nf2 p5 mlra">';
echo '<div class="small p5 mb5 yellow1 cntr">Управление игрой</div>';
echo '<div class="ml5 mr5">
		<a class="bl p5 block odd" href="/element/admin/panel?go=game_setting">
			<span class="small yellow1"><img src="/images/icons/1.gif"> Общие настройки игры</span> <span class="lngreen"></span>
		</a>
	  </div>';
echo '<div class="ml5 mr5">
		<a class="bl p5 block" href="/element/admin/panel?go=game_statistika">
			<span class="small yellow1"><img src="/images/icons/1.gif"> Игровая статистика</span> <span class="lngreen"></span>
		</a>
	  </div>';
echo '<div class="ml5 mr5">
		<a class="bl p5 block odd" href="/element/admin/panel?go=xsolla">
			<span class="small yellow1"><img src="/images/icons/1.gif"> Все платежи</span> <span class="lngreen"></span>
		</a>
	  </div>';
echo '</div>';

echo '<div class="nf2 p5 mt5 mlra">';
echo '<div class="small p5 mb5 yellow1 cntr">Управление вещами</div>';
echo '<div class="ml5 mr5">
		<a class="bl p5 block odd" href="/element/admin/panel?go=create_item">
			<span class="small yellow1"><img src="/images/icons/1.gif"> Создание вещей</span> <span class="lngreen"></span>
		</a>
	  </div>';
/*echo '<div class="ml5 mr5">
		<a class="bl p5 block" href="">
			<span class="small yellow1"><img src="/images/icons/1.gif"> Управление вещами</span> <span class="lngreen"></span>
		</a>
	  </div>';*/	 
echo '</div>';

// Моё
echo '<div class="nf2 p5 mlra">';
echo '<div class="ml5 mr5">
		<a class="bl p5 block odd" href="/element/admin/panel?go=avatarlist">
			<span class="small yellow1"><img src="/images/icons/1.gif"> Управление магазином аватарок</span> <span class="lngreen"></span>
		</a>
	  </div>'; 
/*echo '<div class="ml5 mr5">
		<a class="bl p5 block" href="/element/admin/panel?go=upduserbyid">
			<span class="small yellow1"><img src="/images/icons/1.gif"> Управление хар-к игрока по ID</span> <span class="lngreen"></span>
		</a>
	  </div>';*/
echo '</div>';
	  
echo '<div class="nf2 p5 mt5 mlra">';
echo '<div class="small p5 mb5 yellow1 cntr">Системная часть</div>';
echo '<div class="ml5 mr5">
		<a class="bl p5 block odd" href="/element/admin/panel?go=other_settings">
			<span class="small yellow1"><img src="/images/icons/1.gif"> Общие настройки игры</span> <span class="lngreen"></span>
		</a>
	  </div>';
echo '<div class="ml5 mr5">
		<a class="bl p5 block" href="/element/admin/panel?go=memcache">
			<span class="small yellow1"><img src="/images/icons/1.gif"> Статистика Memcache</span> <span class="lngreen"></span>
		</a>
	  </div>';	
echo '<div class="ml5 mr5">
		<a class="bl p5 block odd" href="/element/admin/panel?go=mysql">
			<span class="small yellow1"><img src="/images/icons/1.gif"> MySQL запросы</span> <span class="lngreen"></span>
		</a>
	  </div>';
echo '</div>';

echo '</div>';
require_once './element_include/element_foot_user_true.php';
?>