<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
?>
<title>Супер гонки</title>';
<?
?>
<link rel="stylesheet" href="style000.css" type="text/css" />
<?
if(!isset($user)){
echo '<table class="wdt msg-table">
<tr>
<td align="left" style="vertical-align: top; width: 10%">
<img src="icon/face-mex.png">
</td>
<td align="left" style="vertical-align: top">
Играть могут лишь зарегистрированные пользователи!</td>
</tr>
</table>';
exit;
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `supergonki` WHERE `id_u`='".$user['id']."'"),0)==0)
mysql_query("INSERT INTO `supergonki`(`id_u`) VALUES('".$user['id']."')");
  $arr=mysql_fetch_array(mysql_query("SELECT * FROM `supergonki` WHERE `id_u`='".$user['id']."'"));
   $car=mysql_fetch_array(mysql_query("SELECT * FROM `super_car` WHERE `id`='".$arr['car']."'"));
if($arr['color']!='0'){
if($arr['color']==1)
$color='red_';
elseif($arr['color']==2)
$color='blue_';
elseif($arr['color']==3)
$color='green_'; 
}

?>

<table class="wdt black">
<tr>
<td class="yellow" align="left" style="vertical-align: top; padding-bottom: 0px">
<img src="icon/fuelico.png"><span id="FUELCNT">
<?
echo"".$arr['exp']."";
?>
</span>
</td>
<td class="orange" align="left"  style="vertical-align: top;  padding-bottom: 0px">
<img src="icon/2.png">
<?
echo"".$arr['speed']."";
?> км.ч.
</td>
<td class="white"  style="vertical-align: top;  padding-bottom: 0px">
ур.
<?
echo"".$arr['level']."";
?>
</td>
<td class="white" align="right"  style="vertical-align: top; padding-bottom: 0px">
<img src="icon/1.png">
<?
echo"".$arr['money']."";
?>
</td>
<td class="green" align="right"  style="vertical-align: top; padding-bottom: 0px">
<img src="icon/goldico.png">
<?
echo"".$user['balls']."";
?>
</td>
</tr>
<tr>
<td align="left" class="white" style="vertical-align: top; padding: 0px; height: 3px" colspan="5" height="3px">
<img src="icon/expline.png" width="35%" height="3px" style="height: 3px;">
</td>
</tr>
</table>

<table class="wdt black" style="border-bottom: 1px solid #767676;">
<tr>
<td class="white" align="left" style="padding-top: 0px;">
<a class="white" href="index.php">Гараж</a>
</td>
<td class="white" align="left" style="padding-top: 0px;">
<a class="white" href="race.php">Гонки</a>
</td>
<td class="gray" align="left" style="padding-top: 0px;">
<a class="green" style="font-weight: bold;" href="bank.php">Дилер</a>
</td>
<td class="gray" align="right" style="padding-top: 0px;">
<a class="white" href="rate.php">Топ</a>
</td>
</tr>
</table>

<table class="wdt msg-table">
<tr>
<td align="left" style="vertical-align: top; width: 10%">
<img src="icon/face-ban.png">
</td>
<td align="left" style="vertical-align: top">
На чёрном рынке ты можешь обменять Баллы на монеты!</br>
<?
if(isset($user)){
if($gconf[0]['open']!=1){
$action=htmlspecialchars(trim($_GET['action']));
switch ($action){
case 'change':
$num=(int)$_POST['num'];
if(!$num || $num<1){echo 'Ошибка, введите сумму!';break;};
if($user['balls']<$num){echo 'У вас нет столько баллов!';break;};
$baks=$num*1;
mysql_query("UPDATE `user` SET `balls`=`balls`-'$num' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `supergonki` SET `money`=`money`+'$baks' WHERE `id_u`='".$user['id']."' LIMIT 1");
echo 'Обмен баллов успешно завершен!';
}}}
?>
</td>
</tr>
</table>
<table class="wdt green-header">
<tr>
<td align="left">Курс 1 балл = 1 монете</td>
</tr>
</table>
<?
if(isset($user)){
if($gconf[0]['open']!=1){
$action=htmlspecialchars(trim($_GET['action']));
switch ($action){
default:
?>
<table class="wdt gray-table">
<tr>
<td class="td-cell white" style="height: 55px;" align="left">
<b style="color: #999999; font-size: 12pt; font: Tahoma;">Сколько баллов поменять:</b>&nbsp;
<b style="color: #ffffff; font-size: 15pt; font: Tahoma;">
<form action="bank.php?action=change" method="post">
<?
echo '<input name="num" type="text" value=""/>';
?>
</b>
</td>
<td class="td-cell white" style="height: 45px;" align="right">
<input class="race-btn" type="submit" value="Обмен" />
</form>
</td>
</tr>
</table>
<?
}
}
}
?>
<td class="white td-cell" align="center" style="height:30px;">
<form action="index.php" method="get">
<input type="submit" class="wdt race-btn" value="В гараж"/>
</form>
</td>
</tr>
</table>