<?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());
{
include 'head.php';
echo "<div class='title'>ГИБДД</div>";
if(isset($_GET['nomer1'])){
	$resm_nomer1 = abs($data_user['money'])-5000;
	if(abs($data_user['money'])< 5000){
		$err = "Извини,но у тебя не хватает <img style='padding:0;margin:0;float:none;' src='img/money.png' alt='.' />";
	}else{
	$nomer1 = mysql_query("UPDATE users SET money='".$resm_nomer1."',nomer='2' WHERE nick='".$_SESSION['user']."'") or die(mysql_error());
	if($nomer1 == true){
		$nomer1 = "<center>Номер успешно куплен.</center>";
	}
	}
}
if($nomer1){
	echo "<table class='wdt msg'>
<tr>
	<td style='vertical-align:top;padding:10px;border:2px dotted indigo;border-radius: 5px 5px 5px 5px;'><b> $nomer1 </b>
	</td>
</tr>
</table>";
}
?>
<div class="menu">
<table>
<td><img src="/nomer/2.png"></td>
<td> <img src="/img/money.png"> <b>5.000</b> </td>
<td> <a href="gibdd.php?nomer1"> КУПИТЬ</a></td><br>
</table>
</div>
</div>
</div>
</body>
</html>
<?
}
}
include 'foot.php';
?>