<?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{
	if(isset($_POST['submit'])){
		$car = $_POST['car'];
		$top = $_POST['top'];
		$fuel = $_POST['fuel'];
		$baks_win = $_POST['baks_win'];
		$baks_top = $_POST['baks_top'];
		$status = $_POST['status'];
		$rai_win = $_POST['rai_win'];
		$rai_top = $_POST['rai_top'];
		$off = $_POST['off'];
		$off_top = $_POST['off_top'];
		$turnirnie = $_POST['turnirnie'];

		$sql = mysql_query("UPDATE turnir_settings SET car='$car',top='$top',fuel='$fuel',baks_win='$baks_win',baks_top='$baks_top',status='$status',raiting_win='$rai_win',raiting_top='$rai_top',off='$off',off_top='$off_top',turnirnie='$turnirnie'") or die(mysql_error());
		if($sql==true){
			header("Location: /tur_panel/index.php");
			exit();
		}
		
	}

}
}