<?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{
?>
<!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'><center>
<span style="color:#fff;"><?=$data_user['fuel']?> лтр.</span>
<span style="color:orange;"><img src="../img/speed.png" alt="Скорость"> <?=$data_user['speed']?> л.с</span>
<span style="color:#fff;"><?=$data_user['level']?> ур.</span>
<span style="color:#0f0;"><img src="../img/money.png" alt="$"> <?=$data_user['money']?></span></center>
</div>
<div class="progress">
	<img src="img/level.png" alt="Уровень" width="<?=$levelimg;?>%" height="7" />
</div>
<table class="wdt cdcdcd menu2">
    <tr>
        <td align="left"><a class="white" 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 href="../city.php">Город</a></td>
    </tr>
</table>
<div class="title">Админка</div>
<?php
if(isset($_POST['add'])){
	if(!empty($_POST['news'])){
		$news = trim(mysql_real_escape_string(strip_tags($_POST['news'])));
		$date = date("d.m.Y H:i:s");
		$nq2 = mysql_query("SELECT * FROM `news` ORDER BY `id`") or die(mysql_error());
		$newsq2 = mysql_fetch_assoc($nq2);
	if($news == $newsq2['msg']){
		echo "<div class='err'>Такая новость уже есть<br/><a href='index.php?addnews' style='color:#fff;'>Назад</a></div>";
	}else{
		mysql_query("INSERT INTO `news`(msg,date) VALUES('$news','$date')") or die(mysql_error());
		echo "<meta http-equiv='refresh' content='0; URL=index.php?addnews' />";
		exit();
	}
	}else{
		echo "<meta http-equiv='refresh' content='0; URL=index.php?addnews' />";
		exit();
	}
}else{
	echo "<meta http-equiv='refresh' content='0; URL=index.php?addnews' />";
	exit();
}
?>
<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>
<?
}
}
?>