<?php
session_start();
include_once "../inc/db_connect.php";
include_once "../inc/fnc.php";
header('Content-Type: text/html;charset=utf8');
$err = "";
if(isset($_POST['regok'])){unset($_SESSION['reg_ok']);}
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"){
		header("Location: ../index.php?");
		exit();
	}else{
	$user = $_SESSION['user'];
	$dateig = date("H:i:s");
	$data_userid = $data_user['id'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>Мобильные гонки</title>
	<meta name="description" content="Мобильные гонки" />
	<link rel="stylesheet" type="text/css" href="../style/css/mobile.css" />
</head>
<body>
<div class='menu'>
	<span style="color:#FFCC00"><img src="../img/benz.png" alt="Бензин" /> <?=$data_user['fuel']?></span>
	<span style="color:#ffb759"><img src="../img/speed.png" alt="Скорость" /> <?=$data_user['speed']?> л.с</span>
	<span style="color:#fff"><?=$swlevel?> ур.</span>
	<span style="color:#92C760"><img src="../img/money.png" alt="Баксы" /> <?=$data_user['money']?></span>
</div>
<div class="progress">
	<img src="../img/level.png" alt="Уровень" width="<?=$levelimg?>%" height="7" />
</div>
<table class="wdt menu2">
    <tr>
        <td align="left"><a href="/index.php">Гараж</a></td>
        <td align="left" style="padding-left:30px;"><a class="white" href="/race.php">Гонки</a></td>
        <td align="left"><a class="white" href="/taxi.php">Такси</a></td>
		<td align="right"><a class="white" href="/city.php">Город</a></td>
    </tr>
</table>
<div class="title">Бан</div>
<?php

if(isset($_POST['banned']))
{
	$ban = mysql_real_escape_string(strip_tags($_POST['ban']));
	$whoban = $data_user['nick'];
	$prich = mysql_real_escape_string(strip_tags($_POST['prich']));
	$nickname = trim(mysql_real_escape_string($_POST['nick']));
mysql_query("UPDATE `users` SET banned='".$ban."',prich='".$prich."' WHERE nick='".$nickname."'");
mysql_query("INSERT INTO bar(`nick`,`msg`,`date`,`avatar`,`id_user`) VALUES('Система','Пользователь <b>$nickname</b> забанен.<br>Причина: <b>$prich </b><br>Забанил: <b>$whoban</b>','BANNED','avatars/no_avatar.png','0')") or die(mysql_error());
echo "<div class='inform'><center>Игрок забанен!</center></div>";
}

$hour = time()+3600;
$day = time()+86400;
$week = time()+604800;
$month = time()+2592000;
$pizda = time()+2591997408000;

echo "<div class='inform'>
<form action='' method='post'>
БАН:<br/>
<select name='ban'>
<option value='$hour'>Час</option>
<option value='$day'>Сутки</option>
<option value='$week'>Неделя</option>
<option value='$month'>Месяц</option>
<option value='$pizda'>Навегда</option>
</select>
<br/>
Причина: <br/><input type='text' name='prich' value='' /><br/>
NICK: <br/><input type='text' name='nick' value='' /><br/>
<input type='submit' name='banned' class='btn' value='Изменить' />
</form>
</div>";
}
?>
<div class="niz">
<p align="center" style="padding-top:3px;padding-bottom:3px;">Вы вошли как <b><?=$_SESSION["user"]?><b> | <a href="/exit.php">Выйти</a><br /> <font color='#000'>Игровое время:</font> <b><?=date("H:i:s")?></b><br/><font color="#000">Игровой ID:</font> <b><?=$data_user['id']?></b></p>
</div>
<p align="center" style="margin-top:3px;">&copy; <?=date("Y")?></p>
</body>
</html>
<?
}

?>