<?php
@session_start();
include_once "../inc/db_connect.php";
include_once "../inc/fnc.php";
header('Content-Type: text/html;charset=utf8');
$err = "";
if(!isset($_SESSION['user'])){
	header("Location: index.php");
	exit();
}else{
	$data_user = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE nick='".$_SESSION['user']."'")) or die(mysql_error());
	if($data_user['status'] == "Гонщик" or $data_user['status'] == "VIP" or $data_user['status'] == "Помощник"){
		header("Location: ../index.php");
		exit();
	}else{
	$user = $_SESSION['user'];
	$dateig = date("H:i:s");
	$data_userid = $data_user['id'];
?>
<?include_once '../head.php'?>
<div class="title"><b>АДМИНКА</b></div>
<?php
if($err) echo "<div class='err'>" , $err , "</div>";
if($data_user['status'] == "Турнирщик" or $data_user['status'] == "Создатель"){
if(isset($_GET['clear'])){
	mysql_query("DELETE FROM turnir");
	echo "<meta http-equiv='refresh' content='0; URL=../tur_panel/index.php'>";
	exit();
}
/*by DezZzmonD*/
$turnir = mysql_fetch_array(mysql_query("SELECT * FROM turnir_settings"));
	echo "
	<div class='menu'>
	<form action='tur.php' method='post'>
		На машине: <input type='text' name='car' class='input' value='".$turnir['car']."' /><br/>
		Топ: <input type='text' name='top' class='input' value='".$turnir['top']."'/><br/>
		Бензин: <input type='text' name='fuel' class='input' value='".$turnir['fuel']."'/><br/>
		Баксы победителю: <input type='text' name='baks_win' class='input' value='".$turnir['baks_win']."'/><br/>
		Баксы топу: <input type='text' name='baks_top' class='input' value='".$turnir['baks_top']."'/><br/>
		Вкл/откл: <select name='status'><option value='1'>Включить</option><option value='0'>Отключить</option></select>
		<br/>
		Рейтинг победителю: <input type='text' name='rai_win' class='input' value='".$turnir['raiting_win']."'/><br/>
		Рейтинг топу: <input type='text' name='rai_top' class='input' value='".$turnir['raiting_top']."'/><br/>
		OFF: <input type='text' name='off' class='input' value='".$turnir['off']."'/><br/>
		OFF_TOP: <input type='text' name='off_top' class='input' value='".$turnir['off_top']."'/><br/>
		 Т.О за Гонку : <input type='text' name='turnirnie' class='input' value='".$turnir['turnirnie']."'/><br/>

		<input type='submit' name='submit' class='btn' value='Начать'/>
	</div>
	<div class='menu'><a href='?clear'>Очистить гонщиков из турнира</a></div>
	</form>
	";
}
?>
<?include_once '../foot.php'?>
</body>
</html>
<?
}
}
?>