Вход Регистрация
Файл: dev/race.php
Строк: 889
<?
include_once '../sys/core/start.php';
include_once 
'../sys/core/compress.php';
include_once 
'../sys/core/sess.php';
include_once 
'../sys/core/home.php';
include_once 
'../sys/core/settings.php';
include_once 
'../sys/core/db_connect.php';
include_once 
'../sys/core/ipua.php';
include_once 
'../sys/core/fnc.php';
include_once 
'../sys/core/user.php';
include_once 
'../sys/inc/fnc_game.php';
include_once 
'../sys/inc/thead.php';
include_once 
'../sys/inc/uhead.php';
only_reg();






if(isset(
$_SESSION['fuel_ok']))
{
echo 
"<table class='wdt msg-table'><tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-benz.png'></td><td align='left' style='vertical-align: top'>";
echo 
"Я заправил тебе полный бак. Можешь приступать к зазедам!</td></tr></table></td></tr></table>";
unset(
$_SESSION['fuel_ok']);
}




if(isset(
$_GET['show_documents']) && $user['police_fine']>0){
$fine_money=5000;
$fine_money_no=$user['money'];
$fined_car=mysql_fetch_array(mysql_query("SELECT * FROM `garage` WHERE `id`='".$user['police_fine_car']."' AND `id_user` = '".$user['id']."'"));

if(
$fined_car['gos_region_transit']>0){
if(
$user['money']>=$fine_money){
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$fine_money)."', `police_fine` = '0' WHERE `id`='".$user['id']."'");
}
elseif(
$user['money']<$fine_money){
mysql_query("UPDATE `user` SET `money` = '0', `police_fine` = '0' WHERE `id`='".$user['id']."'");
}
$_SESSION['police_fine_transit']=1;
header("Location:/dev/garage.php");
}
elseif(
$fined_car['gos_region']==0){
if(
$user['money']>=$fine_money){
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$fine_money)."', `police_fine` = '0' WHERE `id`='".$user['id']."'");
}
elseif(
$user['money']<$fine_money){
mysql_query("UPDATE `user` SET `money` = '0', `police_fine` = '0' WHERE `id`='".$user['id']."'");
}
$_SESSION['police_fine_transit']=1;
header("Location:/dev/garage.php");
}
else
{
mysql_query("UPDATE `user` SET `police_fine` = '0' WHERE `id`='".$user['id']."'");
$_SESSION['police_fine_clear']=1;
header("Location:/dev/garage.php");
}
}

if(isset(
$_GET['start']) && intval($_GET['start'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '".intval($_GET['start'])."' AND `car_id` != '0' AND `id` != '".$user['id']."'"),0)!=&& mysql_result(mysql_query("SELECT COUNT(*) FROM `lograce` WHERE `id_eremy` = '".intval($_GET['start'])."' AND `id_user` = '".$user['id']."'"),0)<3)
{
$select_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".intval($_GET['start'])."'"));

$select_user_taxist=mysql_fetch_array(mysql_query("SELECT * FROM `taxi_user` WHERE `id_user`='".$select_user['id']."'"));
$select_user_taxi=mysql_fetch_array(mysql_query("SELECT * FROM `taxi` WHERE `id`='".$select_user_taxist['id_taxi']."'"));
$info=mysql_fetch_array(mysql_query("SELECT * FROM `garage` WHERE `id` = '".$select_user['car_id']."'"));
$today_race=mysql_result(mysql_query("SELECT COUNT(*) FROM `lograce` WHERE `id_user` = '".$user['id']."' AND `id_eremy` = '".$select_user['id']."'"),0);


$money=500;
$fuel=10;
if(
$user['lapka']>0)
{
$exp_win=6;
$exp_loose=2;
}
else
{
$exp_win=3;
$exp_loose=1;
}
$rating=1;



if(
$mtu && $mt)
{
if(
$mt['clients']>=90)
{
$reputation=10;
}
elseif(
$mt['clients']>=80)
{
$reputation=9;
}
elseif(
$mt['clients']>=70)
{
$reputation=8;
}
elseif(
$mt['clients']>=60)
{
$reputation=7;
}
elseif(
$mt['clients']>=50)
{
$reputation=6;
}
elseif(
$mt['clients']>=40)
{
$reputation=5;
}
elseif(
$mt['clients']>=30)
{
$reputation=4;
}
elseif(
$mt['clients']>=20)
{
$reputation=3;
}
elseif(
$mt['clients']>=10)
{
$reputation=2;
}
else
{
$reputation=1;
}
}






#бонусы противника
if($select_user['nitro_bonus']>0){
$eremy_n2o_power=$select_user['nitro_bonus'];
}
else
{
$eremy_n2o_power=0;
}

if(
$select_user_taxi['bonus_power']>0){
$eremy_taxi_bonus_power=$select_user_taxi['bonus_power'];
}
else
{
$eremy_taxi_bonus_power=0;
}
$eremy_parametr=$info['power']+$eremy_n2o_power+$eremy_taxi_bonus_power;




#бонусы мои
if($user['nitro_bonus']>0){
$n2o_power=$user['nitro_bonus'];
}
else
{
$n2o_power=0;
}
if(
$mt['bonus_power']>0){
$my_taxi_bonus_power=$mt['bonus_power'];
}
else
{
$my_taxi_bonus_power=0;
}
$my_parametr=$mycar['power']+$n2o_power+$my_taxi_bonus_power;




if(
$eremy_parametr<$my_parametr)
{
$avulsion_win=$my_parametr-$eremy_parametr;
if(
$avulsion_win>=80)
{
$invers=1;
}
elseif(
$avulsion_win>=60)
{
$pobs=rand(1,30);
if(
$pobs==3){
$invers=2;
}
else
{
$invers=1;
}
}
elseif(
$avulsion_win>=30)
{
$pobs=rand(1,20);
if(
$pobs==3){
$invers=2;
}
else
{
$invers=1;
}
}
elseif(
$avulsion_win>=20)
{
$pobs=rand(1,10);
if(
$pobs==3){
$invers=2;
}
else
{
$invers=1;
}
}
elseif(
$avulsion_win>=1)
{
$pobs=rand(1,5);
if(
$pobs==3){
$invers=2;
}
else
{
$invers=1;
}
}
}
elseif(
$eremy_parametr>$my_parametr)
{
$avulsion_loose=$eremy_parametr-$my_parametr;
if(
$avulsion_loose>=80)
{
$invers=2;
}
elseif(
$avulsion_loose>=60)
{
$pobs=rand(1,30);
if(
$pobs==3){
$invers=1;
}
else
{
$invers=2;
}
}
elseif(
$avulsion_loose>=30)
{
$pobs=rand(1,20);
if(
$pobs==3){
$invers=1;
}
else
{
$invers=2;
}
}
elseif(
$avulsion_loose>=20)
{
$pobs=rand(1,10);
if(
$pobs==3){
$invers=1;
}
else
{
$invers=2;
}
}
elseif(
$avulsion_loose>=1)
{
$pobs=rand(1,5);
if(
$pobs==3){
$invers=1;
}
else
{
$invers=2;
}
}
}
else
{
$invers=3;
}


if(
$user['police_fine']>0)
{
echo 
"<table class='wdt msg-table'><tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-police.png'></td>";
echo 
"<td align='left' style='vertical-align: top'>";
echo 
"Плановый рейд. Предъявите документы для проверки.</td></tr></table></td></tr></table>";

echo 
"<table class='wdt msg-table-transit'>";
echo 
"<tr><td align='center'><b style='font-size: 14pt'>Проверка документов</b><hr></td></tr>";
echo 
"<tr><td align='center' style='padding-bottom: 0px;'><img src='http://stracingstat1.stracing.mobi/race/img/car/lamborghini_police.png' style='width: 50%' alt='police'>";
echo 
"<img style='width: 50%; margin-top: -15px;' src='http://stracingstat1.stracing.mobi/race/img/car_shadow.png' alt='shadow'></td></tr>";

echo 
"<tr><td align='center' style='padding-top: 0px;'>";
echo 
"<table width='100%'>";
echo 
"<tr><td width='50%' style='padding-top: 0px;'>";
echo 
"<form action='/dev/race.php?show_documents' method='post'><input class='race-btn' type='submit' value='Проверить документы'></form></td></tr></table></td></tr></table>";
include_once 
'../sys/inc/tfoot.php';
}
else
{

if(
$user['fuel']>=10)
{







if(
$invers==1){

$police_fine=rand(1,5);
if(
$police_fine==&& $mycar['gos_region_transit']>0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
elseif(
$police_fine==&& $mycar['gos_region']==0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
elseif(
$police_fine==&& $user['police_fine_today']==0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
if(
$mtu && $mt && $mt['id']!=$select_user_taxi['id'])
{
mysql_query("UPDATE `taxi` SET `reputation` = `reputation`+$reputation WHERE `id` = '".$mt['id']."'");
$_SESSION['set_reputation']=1;
}
if(
$mtu && $mt && $select_user_taxist && $select_user_taxi && $select_user_taxi['clients']>&& $mt['id']!=$select_user_taxi['id'])
{
$client=rand(1,20);
if(
$client==3){
mysql_query("UPDATE `taxi` SET `clients` = `clients`+1 WHERE `id` = '".$mt['id']."'");
mysql_query("UPDATE `taxi` SET `clients` = `clients`-1 WHERE `id` = '".$select_user_taxi['id']."'");
mysql_query("UPDATE `taxi_user` SET `clients` = '".($mtu['clients']+1)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
$_SESSION['clients']=1;
}
}
if(
$mtu && $mt)
{
mysql_query("UPDATE `taxi_user` SET `win` = '".($mtu['win']+1)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
}
if(
$user['nitro']>0){
mysql_query("UPDATE `user` SET `nitro` = '".($user['nitro']-1)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
if(
$user['lapka']>0){
mysql_query("UPDATE `user` SET `lapka` = '".($user['lapka']-1)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
mysql_query("UPDATE `user` SET `money` = '".($user['money']+$money)."', `fuel` = '".($user['fuel']-$fuel)."', `exp` = '".($user['exp']+$exp_win)."', `rating` = '".($user['rating']+$rating)."', `count_race`='".($user['count_race']+1)."' WHERE `id` = '".$user['id']."' LIMIT 1");
mysql_query("UPDATE `quest_user` SET `win_col` = `win_col`+1, `win_row_col` = `win_row_col`+1, `race_col` = `race_col`+1 WHERE `status` = 'active' AND `id_user` = '".$user['id']."'");
mysql_query("INSERT INTO `lograce` SET `id_user` = '".$user['id']."', `id_eremy` = '".$select_user['id']."', `result` = 'win', `win_money` = '$money', `time` = '$time'");

echo 
"<table class='wdt msg-table-win'>";
echo 
"<tr><td width='15px' style='vertical-align: top'><img src='/style/img/icons/win.png'></td><td>";
echo 
"<b style='font-size: 14pt'>";
if(
$today_race>1)
{
echo 
"<img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'>";
}
elseif(
$today_race>0)
{
echo 
"<img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'>";
}
else
{
echo 
"<img src='/style/img/icons/flag.png'>";
}
echo 
" Победа!</b><br>Опыт: <b>+$exp_win</b><br>Награда: <img src='/style/img/icons/money.png'><b>$money</b>";
if(
$mtu && $mt)
{
if(isset(
$_SESSION['set_reputation']))
{
echo 
"<br>Репутация: <img src='/style/img/icons/reputation.png'><b>+$reputation</b>";
unset(
$_SESSION['set_reputation']);
}
}
if(isset(
$_SESSION['clients']))
{
echo 
"<br>Клиенты: <img src='/style/img/icons/clients.png'><b>+1</b>";
unset(
$_SESSION['clients']);
}
echo 
"<br>Рейтинг: <img src='/style/img/icons/rating.png'><b>+$rating</b>";
echo 
"<br>Машина: <b>$info[name]</b><br><img src='/style/img/icons/garage_black.png'><a style='font-size: 10pt; color: black; text-decoration: underline;' href='/dev/info.php?id=".$select_user['id']."'>машины соперника</a></td></tr><tr>";
echo 
"<td colspan='2' align='center'><table width='100%'><tr><td colspan='2' align='center'><img src='/style/img/car/$info[screen].png' style='width: 60%'>";
if(
$info['neon']!=0){
echo 
"<img style='width:60%; margin-top:-15px;' src='/style/img/images/neon/$info[neon].png'>";
}
else
{
echo 
"<img style='width:60%; margin-top:-15px;' src='/style/img/images/car_shadow.png'>";
}
echo 
"</td></tr><tr><td colspan='2' align='center'>";
if(
$today_race>1)
{
echo 
"<b class='gray'>Этот гонщик устал, выбери нового из списка ниже</b>";
}
echo 
"</td></tr><tr>";
echo 
"<td width='50%'><form action='/dev/garage.php' method='post'><input class='no-btn' type='submit' value='В гараж'></form></td>";
if(
$today_race<2)
{
echo 
"<td width='50%'><form action='/dev/race.php?start=".$select_user['id']."' method='post'><input class='race-btn' type='submit' value='Гонка'></form></td></tr></table></td></tr></table>";
}
else
{
echo 
"<td width='50%'><input class='inactive-btn' type='submit' value='Гонка'></td></tr></table></td></tr></table>";
}
}













elseif(
$invers==2){

$police_fine=rand(1,5);
if(
$police_fine==&& $mycar['gos_region_transit']>0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
elseif(
$police_fine==&& $mycar['gos_region']==0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
elseif(
$police_fine==&& $user['police_fine_today']==0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}

if(
$user['rating']>0){
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']-$rating)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
if(
$user['nitro']>0){
mysql_query("UPDATE `user` SET `nitro` = '".($user['nitro']-1)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
if(
$user['lapka']>0){
mysql_query("UPDATE `user` SET `lapka` = '".($user['lapka']-1)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
mysql_query("UPDATE `user` SET `fuel` = '".($user['fuel']-$fuel)."', `exp` = '".($user['exp']+$exp_loose)."' WHERE `id` = '".$user['id']."' LIMIT 1");
mysql_query("UPDATE `quest_user` SET `loose_col` = `loose_col`+1, `win_row_col` = '0', `race_col` = `race_col`+1 WHERE `status` = 'active' AND `id_user` = '".$user['id']."'");
mysql_query("INSERT INTO `lograce` SET `id_user` = '".$user['id']."', `id_eremy` = '".$select_user['id']."', `result` = 'loose', `win_money` = '$money', `time` = '$time'");

echo 
"<table class='wdt msg-table-loose'>";
echo 
"<tr><td width='15px' style='vertical-align: top'><img src='/style/img/icons/loose.png'></td><td>";
echo 
"<b style='font-size: 14pt'>";
if(
$today_race>1)
{
echo 
"<img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'>";
}
elseif(
$today_race>0)
{
echo 
"<img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'>";
}
else
{
echo 
"<img src='/style/img/icons/flag.png'>";
}
echo 
" Поражение!</b><br>Опыт: <b>+$exp_loose</b>";
if(
$user['rating']>0){
echo 
"<br>Рейтинг: <img src='/style/img/icons/rating.png'><b>-$rating</b>";
}
echo 
"<br>Машина: <b>$info[name]</b><br><img src='/style/img/icons/garage_black.png'><a style='font-size: 10pt; color: black; text-decoration: underline;' href='/dev/info.php?id=".$select_user['id']."'>машины соперника</a></td></tr><tr>";
echo 
"<td colspan='2' align='center'><table width='100%'><tr><td colspan='2' align='center'><img src='/style/img/car/$info[screen].png' style='width: 60%'>";
if(
$info['neon']!=0){
echo 
"<img style='width:60%; margin-top:-15px;' src='/style/img/images/neon/$info[neon].png'>";
}
else
{
echo 
"<img style='width:60%; margin-top:-15px;' src='/style/img/images/car_shadow.png'>";
}
echo 
"</td></tr><tr><td colspan='2' align='center'>";
if(
$today_race>1)
{
echo 
"<b class='gray'>Этот гонщик устал, выбери нового из списка ниже</b>";
}
echo 
"</td></tr><tr>";
echo 
"<td width='50%'><form action='/dev/garage.php' method='post'><input class='no-btn' type='submit' value='В гараж'></form></td>";
if(
$today_race<2)
{
echo 
"<td width='50%'><form action='/dev/race.php?start=".$select_user['id']."' method='post'><input class='race-btn' type='submit' value='Гонка'></form></td></tr></table></td></tr></table>";
}
else
{
echo 
"<td width='50%'><input class='inactive-btn' type='submit' value='Гонка'></td></tr></table></td></tr></table>";
}
}
















elseif(
$invers==3){
$pob=rand(1,2);
if(
$pob==1){

$police_fine=rand(1,5);
if(
$police_fine==&& $mycar['gos_region_transit']>0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
elseif(
$police_fine==&& $mycar['gos_region']==0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
elseif(
$police_fine==&& $user['police_fine_today']==0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}

if(
$mtu && $mt && $mt['id']!=$select_user_taxi['id'])
{
mysql_query("UPDATE `taxi` SET `reputation` = `reputation`+$reputation WHERE `id` = '".$mt['id']."'");
$_SESSION['set_reputation']=1;
}
if(
$mtu && $mt && $select_user_taxist && $select_user_taxi && $select_user_taxi['clients']>&& $mt['id']!=$select_user_taxi['id'])
{
$client=rand(1,20);
if(
$client==3){
mysql_query("UPDATE `taxi` SET `clients` = `clients`+1 WHERE `id` = '".$mt['id']."'");
mysql_query("UPDATE `taxi` SET `clients` = `clients`-1 WHERE `id` = '".$select_user_taxi['id']."'");
mysql_query("UPDATE `taxi_user` SET `clients` = '".($mtu['clients']+1)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
$_SESSION['clients']=1;
}
}
if(
$mtu && $mt)
{
mysql_query("UPDATE `taxi_user` SET `win` = '".($mtu['win']+1)."' WHERE `id_user` = '".$user['id']."' LIMIT 1");
}
if(
$user['nitro']>0){
mysql_query("UPDATE `user` SET `nitro` = '".($user['nitro']-1)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
if(
$user['lapka']>0){
mysql_query("UPDATE `user` SET `lapka` = '".($user['lapka']-1)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
mysql_query("UPDATE `user` SET `money` = '".($user['money']+$money)."', `fuel` = '".($user['fuel']-$fuel)."', `exp` = '".($user['exp']+$exp_win)."', `rating` = '".($user['rating']+$rating)."' WHERE `id` = '".$user['id']."' LIMIT 1");
mysql_query("UPDATE `quest_user` SET `win_col` = `win_col`+1, `win_row_col` = `win_row_col`+1, `race` = `race`+1 WHERE `status` = 'active' AND `id_user` = '".$user['id']."'");
mysql_query("INSERT INTO `lograce` SET `id_user` = '".$user['id']."', `id_eremy` = '".$select_user['id']."', `result` = 'win', `win_money` = '$money', `time` = '$time'");
echo 
"<table class='wdt msg-table-win'>";
echo 
"<tr><td width='15px' style='vertical-align: top'><img src='/style/img/icons/win.png'></td><td>";
echo 
"<b style='font-size: 14pt'>";
if(
$today_race>1)
{
echo 
"<img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'>";
}
elseif(
$today_race>0)
{
echo 
"<img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'>";
}
else
{
echo 
"<img src='/style/img/icons/flag.png'>";
}
echo 
" Победа!</b><br>Опыт: <b>+$exp_win</b><br>Награда: <img src='/style/img/icons/money.png'><b>$money</b>";
if(
$mtu && $mt)
{
if(isset(
$_SESSION['set_reputation']))
{
echo 
"<br>Репутация: <img src='/style/img/icons/reputation.png'><b>+$reputation</b>";
unset(
$_SESSION['set_reputation']);
}
}
if(isset(
$_SESSION['clients']))
{
echo 
"<br>Клиенты: <img src='/style/img/icons/clients.png'><b>+1</b>";
unset(
$_SESSION['clients']);
}
echo 
"<br>Рейтинг: <img src='/style/img/icons/rating.png'><b>+$rating</b>";
echo 
"<br>Машина: <b>$info[name]</b><br><img src='/style/img/icons/garage_black.png'><a style='font-size: 10pt; color: black; text-decoration: underline;' href='/dev/info.php?id=".$select_user['id']."'>машины соперника</a></td></tr><tr>";
echo 
"<td colspan='2' align='center'><table width='100%'><tr><td colspan='2' align='center'><img src='/style/img/car/$info[screen].png' style='width: 60%'>";
if(
$info['neon']!=0){
echo 
"<img style='width:60%; margin-top:-15px;' src='/style/img/images/neon/$info[neon].png'>";
}
else
{
echo 
"<img style='width:60%; margin-top:-15px;' src='/style/img/images/car_shadow.png'>";
}
echo 
"</td></tr><tr><td colspan='2' align='center'>";
if(
$today_race>1)
{
echo 
"<b class='gray'>Этот гонщик устал, выбери нового из списка ниже</b>";
}
echo 
"</td></tr><tr>";echo "<td width='50%'><form action='/dev/garage.php' method='post'><input class='no-btn' type='submit' value='В гараж'></form></td>";
if(
$today_race<2)
{
echo 
"<td width='50%'><form action='/dev/race.php?start=".$select_user['id']."' method='post'><input class='race-btn' type='submit' value='Гонка'></form></td></tr></table></td></tr></table>";
}
else
{
echo 
"<td width='50%'><input class='inactive-btn' type='submit' value='Гонка'></td></tr></table></td></tr></table>";
}
}
else
{

$police_fine=rand(1,5);
if(
$police_fine==&& $mycar['gos_region_transit']>0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
elseif(
$police_fine==&& $mycar['gos_region']==0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
elseif(
$police_fine==&& $user['police_fine_today']==0){
mysql_query("UPDATE `user` SET `police_fine` = '1', `police_fine_today` = '1', `police_fine_time` = '$time', `police_fine_car` = '".$mycar['id']."' WHERE `id` = '".$user['id']."' LIMIT 1");
}

if(
$user['rating']>0){
mysql_query("UPDATE `user` SET `rating` = '".($user['rating']-$rating)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
if(
$user['nitro']>0){
mysql_query("UPDATE `user` SET `nitro` = '".($user['nitro']-1)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
if(
$user['lapka']>0){
mysql_query("UPDATE `user` SET `lapka` = '".($user['lapka']-1)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
mysql_query("UPDATE `user` SET `fuel` = '".($user['fuel']-$fuel)."', `exp` = '".($user['exp']+$exp_loose)."' WHERE `id` = '".$user['id']."' LIMIT 1");
mysql_query("UPDATE `quest_user` SET `loose_col` = `loose_col`+1, `win_row_col` = '0', `race_col` = `race_col`+1 WHERE `status` = 'active' AND `id_user` = '".$user['id']."'");
mysql_query("INSERT INTO `lograce` SET `id_user` = '".$user['id']."', `id_eremy` = '".$select_user['id']."', `result` = 'loose', `win_money` = '$money', `time` = '$time'");

echo 
"<table class='wdt msg-table-loose'>";
echo 
"<tr><td width='15px' style='vertical-align: top'><img src='/style/img/icons/loose.png'></td><td>";
echo 
"<b style='font-size: 14pt'>";
if(
$today_race>1)
{
echo 
"<img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'>";
}
elseif(
$today_race>0)
{
echo 
"<img src='/style/img/icons/flag.png'><img src='/style/img/icons/flag.png'>";
}
else
{
echo 
"<img src='/style/img/icons/flag.png'>";
}
echo 
" Поражение!</b><br>Опыт: <b>+$exp_loose</b>";
if(
$user['rating']>0){
echo 
"<br>Рейтинг: <img src='/style/img/icons/rating.png'><b>-$rating</b>";
}
echo 
"<br>Машина: <b>$info[name]</b><br><img src='/style/img/icons/garage_black.png'><a style='font-size: 10pt; color: black; text-decoration: underline;' href='/dev/info.php?id=".$select_user['id']."'>машины соперника</a></td></tr><tr>";
echo 
"<td colspan='2' align='center'><table width='100%'><tr><td colspan='2' align='center'><img src='/style/img/car/$info[screen].png' style='width: 60%'>";
if(
$info['neon']!=0){
echo 
"<img style='width:60%; margin-top:-15px;' src='/style/img/images/neon/$info[neon].png'>";
}
else
{
echo 
"<img style='width:60%; margin-top:-15px;' src='/style/img/images/car_shadow.png'>";
}
echo 
"</td></tr><tr><td colspan='2' align='center'>";
if(
$today_race>1)
{
echo 
"<b class='gray'>Этот гонщик устал, выбери нового из списка ниже</b>";
}
echo 
"</td></tr><tr>";echo "<td width='50%'><form action='/dev/garage.php' method='post'><input class='no-btn' type='submit' value='В гараж'></form></td>";
if(
$today_race<2)
{
echo 
"<td width='50%'><form action='/dev/race.php?start=".$select_user['id']."' method='post'><input class='race-btn' type='submit' value='Гонка'></form></td></tr></table></td></tr></table>";
}
else
{
echo 
"<td width='50%'><input class='inactive-btn' type='submit' value='Гонка'></td></tr></table></td></tr></table>";
}
}
}
}
else
{
header("Location:/dev/race.php");
}
}
}
elseif(isset(
$_SESSION['new_level']))
{
echo 
"<table class='wdt msg-table'><tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-mex.png'></td><td align='left' style='vertical-align: top'>";
echo 
"<b>Новый уровень!</b> Тебе стали доступны новые машины в автосалоне.<br>Баксы: +$user[level] <img src='/style/img/icons/baks.png'></td></tr></table></td></tr></table>";
unset(
$_SESSION['new_level']);
}
elseif(isset(
$_SESSION['new_car']))
{
echo 
"<table class='wdt msg-table'><tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-mex.png'></td><td align='left' style='vertical-align: top'>";
echo 
"Поздравляю с покупкой нового авто! Пора проверить его в деле. Выбери себе соперника.</td></tr></table></td></tr></table>";
unset(
$_SESSION['new_car']);
}
elseif(
$user['fuel']<10)
{
echo 
"<table class='wdt msg-table'><tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-fuel.png'></td><td align='left' class='black' style='vertical-align: top'>";
echo 
"У тебя закончился бензин. <br> >>>> <a href='/dev/gas.php?buy_fuel' style='color: #ffffff'> Заправиться </a> <<<< <br>Использовано : $user[fuel_today] из 200 заправок</td></tr></table></td></tr></table>";
}
else
{
echo 
"<table class='wdt msg-table'><tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-mex.png'></td><td align='left' style='vertical-align: top'>";
echo 
"Подбери себе противника для заезда.</td></tr></table></td></tr></table>";
}





echo 
"<table class='wdt green-header'><tr><td align='left'>Доступные гонки: </td></tr></table>";
$user_spis mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `car_id` != '0' AND `id` != '".$user['id']."'"),0);
if (
$user_spis==0)
{
echo 
"<table class='wdt msg-table'><tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-mex.png'></td><td align='left' style='vertical-align: top'>";

echo 
"Прости, но пока гоняться не с кем!</td></tr></table></td></tr></table>";
}

$q=mysql_query("SELECT * FROM `user` WHERE `car_id` != '0' AND `id` != '".$user['id']."' ORDER BY RAND() DESC LIMIT 5");
echo 
"<table class='wdt gray-table' cellpadding='0px' cellspacing='0px' border='0px' style='vertical-align: top;'>";
while(
$post=mysql_fetch_array($q)){
$today_race=mysql_result(mysql_query("SELECT COUNT(*) FROM `lograce` WHERE `id_user` = '".$user['id']."' AND `id_eremy` = '".$post['id']."'"),0);
$post_user=mysql_fetch_array(mysql_query("SELECT * FROM `taxi_user` WHERE `id_user` = '".$post['id']."'"));
$post_user_taxi=mysql_fetch_array(mysql_query("SELECT * FROM `taxi` WHERE `id` = '".$post_user['id_taxi']."'"));
$garage=mysql_fetch_array(mysql_query("SELECT * FROM `garage` WHERE `id` = '".$post['car_id']."'"));
$stock=$garage['stock_power']+1061;
$settuning=$garage['power'];

if(
$post['nitro_bonus']>0){
$post_n2o_power=$post['nitro_bonus'];
}
else
{
$post_n2o_power=0;
}
if(
$post_user_taxi['bonus_power']>0){
$post_taxi_bonus_power=$post_user_taxi['bonus_power'];
}
else
{
$post_taxi_bonus_power=0;
}
$post_power=$garage['power']+$post_n2o_power+$post_taxi_bonus_power;

echo 
"<tr><td class='td-cell' align='center' style='width: 50%; vertical-align: bottom;' valign='top'><table border='0px' width='100%' height='40px' cellpadding='0px' cellspacing='0px'>";
echo 
"<tr><td height='40px' width='100%' style='vertical-align: top;'><img src='/style/img/car/$garage[screen].png' class='wdt'>";
if(
$garage['neon']!=0){
echo 
"<img class='wdt' style='margin-top: -15px;' src='/style/img/images/neon/$garage[neon].png' alt='t'>";
}
else
{
echo 
"<img class='wdt' style='margin-top: -15px;' src='/style/img/images/car_shadow.png' alt='t'>";
}
echo 
"</td></tr><tr align='center'><td align='center'>";

if(
$garage['gos_region']>0)        
{

if(
$garage['gos_region_transit']>0)
{
if(
$garage['gos_region']<10)        
{
echo 
"<img width='95' src='http://club2108.ru/numgen/index.php?num=$garage[gos_bb_one]$garage[gos_number]$garage[gos_bb_two]$garage[gos_bb_free]0$garage[gos_region]&b=7' alt='number'><br/>";
}
else
{
echo 
"<img width='95' src='http://club2108.ru/numgen/index.php?num=$garage[gos_bb_one]$garage[gos_number]$garage[gos_bb_two]$garage[gos_bb_free]$garage[gos_region]&b=7' alt='number'><br/>";
}
}
else
{
if(
$garage['gos_region']<10)        
{
echo 
"<img width='95' src='http://club2108.ru/numgen/index.php?num=$garage[gos_bb_one]$garage[gos_number]$garage[gos_bb_two]$garage[gos_bb_free]0$garage[gos_region]&b=1' alt='number'><br/>";
}
else
{
echo 
"<img width='95' src='http://club2108.ru/numgen/index.php?num=$garage[gos_bb_one]$garage[gos_number]$garage[gos_bb_two]$garage[gos_bb_free]$garage[gos_region]&b=1' alt='number'><br/>";
}
}
}

echo 
"</td></tr></table></td>";
echo 
"<td class='td-cell' align='center' style='width: 50%; vertical-align: bottom;'><table class='wdt'><tr><td><table class='wdt'>";
echo 
"<tr><td style='width: 70%; vertical-align: top;'>";
if(
$post_user_taxi)
{
echo 
"<b class='yellow'>[$post_user_taxi[label]]</b>";
}
echo 
" <b class='white'>$post[nick]</b></td><td rowspan='2'><img width='50' src = '/style/img/avatars/$post[avatar].png' alt=''></td></tr>";
echo 
"<tr><td style='width: 70%; vertical-align: top;'>";

if(
$settuning >= $stock)
{
echo 
"<img src='/style/img/icons/fire.png'>";
}
else
{
echo 
"<img src='/style/img/icons/power.png'>";
}

echo 
"<b class='orange' style='font-size: 10pt'> $post_power л.с.</b><br></td></tr></table></td></tr>";
echo 
"<tr><td><table class='wdt'><tr><td width='10%'><a href='/dev/info.php?id=$post[id]'><img src='/style/img/icons/kgarage.png'></a></td>";

if(
$user['fuel']<10)
{
echo 
"<td><input class='inactive-btn' type='submit' value='Гонка'></td></tr></table></td></tr></table></td></tr>";
}
elseif(
$today_race>2)
{
echo 
"<td><input class='inactive-btn' type='submit' value='Гонка'></td></tr></table></td></tr></table></td></tr>";
}
else
{
echo 
"<td><form action='/dev/race.php?start=".$post['id']."' method='post'><input class='race-btn' type='submit' value='Гонка'></form></td></tr></table></td></tr></table></td></tr>";
}
}








echo 
"<table class='wdt brown-header'><tr> <td align='left'>История гонок: </td></tr></table>";
$log_spis mysql_result(mysql_query("SELECT COUNT(*) FROM `lograce` WHERE `id_user` = '$user[id]' OR `id_eremy` = '$user[id]'"),0);
if (
$log_spis==0)
{
echo 
"<table class='wdt'>";
echo 
"<td class='white' align='left' style='background-color: #222222'><b>Нет истории</b></td></tr><tr>";
}
$sob mysql_query("SELECT * FROM `lograce` WHERE `id_user` = '".$user['id']."' OR `id_eremy` = '".$user['id']."' ORDER BY  `id` DESC LIMIT 10");
while(
$logs mysql_fetch_array($sob)) {
$ank3=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".$logs['id_eremy']."'"));
$ank4=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".$logs['id_user']."'"));
if(
$user['id']==$logs['id_user']){
if(
$logs['result']=='win'){
echo 
"<table class='wdt'>";
echo 
"<tr><td class='white' align='left' style='background-color: #222222; width: 16px;'><img src='/style/img/icons/win.png'></td><td class='white' align='left' style='background-color: #222222'>Ты выиграл гонщика <b class='yellow'>$ank3[nick] - </b><b class='orange'>$logs[win_money] <img src='/style/img/icons/money.png'></b></td></tr><tr>";
}
if(
$logs['result']=='loose'){
echo 
"<table class='wdt'>";
echo 
"<tr><td class='white' align='left' style='background-color: #222222; width: 16px;'><img src='/style/img/icons/loose.png'></td><td class='white' align='left' style='background-color: #222222'>Ты проиграл гонщику <b class='yellow'>$ank3[nick]</b></td></tr><tr>";
}
}
if(
$user['id']==$logs['id_eremy']){
if(
$logs['result']=='win'){
echo 
"<table class='wdt'>";
echo 
"<tr><td class='white' align='left' style='background-color: #222222; width: 16px;'><img src='/style/img/icons/loose.png'></td><td class='white' align='left' style='background-color: #222222'>Тебя вызвал <b class='yellow'>$ank4[nick]</b>, ты проиграл</td></tr><tr>";
}
if(
$logs['result']=='loose'){
echo 
"<table class='wdt'>";
echo 
"<tr><td class='white' align='left' style='background-color: #222222; width: 16px;'><img src='/style/img/icons/win.png'></td><td class='white' align='left' style='background-color: #222222'>Тебя вызвал <b class='yellow'>$ank4[nick]</b>, ты победитель</td></tr><tr>";
}
}
}

echo 
"</table>";
include_once 
'../sys/inc/tfoot.php';
?>
Онлайн: 0
Реклама