Файл: play_gamescool/car/race.php
Строк: 46
<?
include_once '../../connect.php';
include_once '../../head.php';
if(!isset($u)){
echo 'Вы неавторизованы';
include_once '../../foot.php';
exit;
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `racing` WHERE `id_u`='".$u['id']."'"),0)==0)
mysql_query("INSERT INTO `racing`(`id_u`) VALUES('".$u['id']."')");
$arr=mysql_fetch_array(mysql_query("SELECT * FROM `racing` WHERE `id_u`='".$u['id']."'"));
$car=mysql_fetch_array(mysql_query("SELECT * FROM `racing_car` WHERE `id`='".$arr['car']."'"));
$all_racer=mysql_result(mysql_query("SELECT COUNT(*) FROM `racing` WHERE `id_u`!='".$u['id']."'"),0);
if($arr['color']!='0'){
if($arr['color']==1)
$color='red_';
elseif($arr['color']==2)
$color='blue_';
elseif($arr['color']==3)
$color='green_';
}
echo "
<div class='aut'>
| опыт: ".$arr['exp']."
| ур: ".$arr['level']."
| <img src='ico/money.gif' alt=''/>".$arr['money']."
| реп: ".$arr['resp']."</div>
<div class='aut'>
<img src='ico/race.gif' alt=''/> $u[login] Смотри чувак не вызывай лучших Гоншиков, <br/> а то при проигрыше над нашей канторай все будут смеятся <br/>
<br/>
</div>
<div class='iroder3'>
<br/>
<center><img src='car/".(isset($color) ? "".$color."".$car['screen']."" : "".$car['screen']."")."' alt=''/> <br/>".$car['name']."</center>
<br/>";
if(isset($_POST['submit'])){
$id=abs(intval($_GET['id_user']));
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `racing_race` WHERE `id_2`='".$u['id']."' AND `id_1`='".$id."' AND `act`='0'"),0)==0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `racing_race` WHERE `id_1`='".$u['id']."' AND `id_2`='".$id."' AND `act`='0'"),0)==0){
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `racing` WHERE `id_u`='".$id."'"),0)!=0){
mysql_query("INSERT `racing_race`(`id_1`, `id_2`) VALUES('".$u['id']."', '".$id."')");
msg('Ваше предложение будет рассмотрено соперником');
}}
else
{
msg('У вас не все гонки завершены с данным пользователем');
}}
if($all_racer==0){
echo "Гонщиков нет!<br/>";
}
else
{
$k_page=k_page($all_racer,10);
$page=page($k_page);
$start=10*$page-10;
$queryy=mysql_query("SELECT * FROM `racing` WHERE `id_u`!='".$u['id']."' ORDER BY `id` DESC LIMIT $start,10");
while($po=mysql_fetch_array($queryy)){
$carp=mysql_fetch_array(mysql_query("SELECT * FROM `racing_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_';
}
echo "<div class='iroder3'>";
echo "<img src='car/".$color2."".$carp['screen']."' alt=''/> ";
echo "<div class='rowup'>
- Ник : <a href='/info.php?id=".$po['id_u']."'>
".mysql_result(mysql_query("SELECT `login` FROM `users` WHERE `id`='".$po['id_u']."'"),0)."</a><br/>
- Поб/Пор : ".$po['win']."/".$po['lose']."<br/>
- Тачка : ".$carp['name']."<br/>
<form method='post' action='race.php?id_user=".$po['id_u']."'>
<input type='submit' name='submit' value='Вызвать на гонки'/></form></div>";
}
if($k_page>'1')str('?',$k_page,$page);
}
echo "<div class='rowup'>
<img src='ico/moi_gonki.png' alt=''/><a href='allrace.php'> Мои гонки</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `racing_race` WHERE (`id_2`='".$u['id']."') OR (`id_1`='".$u['id']."')"),0).")</div>
<div class='aut'><a style='display:block;' href='index.php'><img src='ico/back.png' alt=''/> Назад</a></div>";
include_once '../../foot.php';
?>