<?
include '../config.php';
include '../func.php';
head();
aut();
ban();
echo "<div style=\" background-color: #0b0f2e; color: #ffffff;\">";
if (isset($user))
{

echo "$verh";
if (isset($user) & $user['cilynders_power']>=5)
{
if (isset($user) & $user['cilynders_fuel']>=8)
{ 
if (isset($user) & $user['game_over']!=1)
{ 
$act = isset($_GET['act']) ? $_GET['act'] : '';
$rand = mt_rand(100, 999);
switch ($act) {
case "go":


$get_baks = mt_rand(3, 7);
$get_baks2 = mt_rand(1, 9);
$itogo_baks = "$get_baks$get_baks2";

$get_ratingg = mt_rand(1, 3);
$get_ratingg2 = mt_rand(1, 9);
$itogo_ratingg = "$get_ratingg$get_ratingg2";

$get_rating = mt_rand(1, 4);
$get_rating2 = mt_rand(1, 9);
$itogo_rating = "$get_rating$get_rating2";
$get_speed = mt_rand(1, 15);
$get_power = mt_rand(1, 3);
$ta4ka_user = mt_rand(1, 6);
$ta4ka_bot = mt_rand(1, 6);
$protivnik = $ta4ka_user;
$avto_user = $ta4ka_bot;

//////////////////////////////////////////////Проигрыш

if ($protivnik > $avto_user)
{
$zaezd_rezult = ($user['zaezd_rezult'] = $get_speed);
mysql_query("UPDATE `profile` SET `zaezd_rezult` = '" . $zaezd_rezult . "' WHERE `id` = '$user[id]' LIMIT 1");

$game_over_rezult = ($user['game_over_rezult'] = 2);
mysql_query("UPDATE `profile` SET `game_over_rezult` = '" . $game_over_rezult . "' WHERE `id` = '$user[id]' LIMIT 1");
$game_over = ($user['game_over'] = 1);
mysql_query("UPDATE `profile` SET `game_over` = '" . $game_over . "' WHERE `id` = '$user[id]' LIMIT 1");

$power_winner_c = ($user['winner_power'] + $get_power);
mysql_query("UPDATE `profile` SET `winner_power` = '" . $power_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$fuel_winner_c = ($user['cilynders_fuel'] - 7);
mysql_query("UPDATE `profile` SET `cilynders_fuel` = '" . $fuel_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$zaezd_winner_c = ($user['cilynders_zaezd'] + 1);
mysql_query("UPDATE `profile` SET `cilynders_zaezd` = '" . $zaezd_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$zaezd_m_winner_c = ($user['cilynders_zaezd_one'] + 1);
mysql_query("UPDATE `profile` SET `cilynders_zaezd_one` = '" . $zaezd_m_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$rating_winner_c = ($user['winner_rating'] - $itogo_ratingg);
mysql_query("UPDATE `profile` SET `winner_rating` = '" . $rating_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");


echo "<div style=\"float:left; padding-right: 4px;\"><img src=\"img/girl.gif\" alt=\"\" /></div><td class='p_m'>
 - $user[login], не повезло, ты проиграл. Возможно в следующий раз ты окажешься сильнее.</br>";
 echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";
echo "<center><div style=\"margin-top: 1px #585985 solid; border-top: 1px #585985 solid;padding: 1px;background-color: #2f2e58;\"><span style=\"border-color: #000000; border: 2px; padding-buttom: 5px;\">
</div>
<img src=\"img/loser.gif\" alt=\"\" /></br>";
echo "Отстал:  $get_speed М.</br>";
echo "<img src=\"img/rating.gif\" alt=\"\" /> - $itogo_ratingg ";
echo "<img src=\"img/fuel.gif\" alt=\"\" /> - 7 </br><img src=\"img/power.gif\" alt=\"\" /> -$get_power%</center>";
echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";
echo "<a href=\"start.php?game=over\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/next.gif\"  alt=\"\" /> Далее</div></a>";
echo "<div class=\"hr\"></div>";
echo "</div>";

}

//////////////////////////////////////////////Победа

if ($protivnik < $avto_user)
{
$power_winner_c = ($user['winner_power'] + $get_power);
mysql_query("UPDATE `profile` SET `winner_power` = '" . $power_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$game_over_rezult = ($user['game_over_rezult'] = 1);
mysql_query("UPDATE `profile` SET `game_over_rezult` = '" . $game_over_rezult . "' WHERE `id` = '$user[id]' LIMIT 1");
$game_over = ($user['game_over'] = 1);
mysql_query("UPDATE `profile` SET `game_over` = '" . $game_over . "' WHERE `id` = '$user[id]' LIMIT 1");
$zaezd_rezult = ($user['zaezd_rezult'] = $get_speed);
mysql_query("UPDATE `profile` SET `zaezd_rezult` = '" . $zaezd_rezult . "' WHERE `id` = '$user[id]' LIMIT 1");


$baks_winner_c = ($user['winner_baks'] + $itogo_baks);
mysql_query("UPDATE `profile` SET `winner_baks` = '" . $baks_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$fuel_winner_c = ($user['cilynders_fuel'] - 7);
mysql_query("UPDATE `profile` SET `cilynders_fuel` = '" . $fuel_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$zaezd_winner_c = ($user['cilynders_zaezd'] + 1);
mysql_query("UPDATE `profile` SET `cilynders_zaezd` = '" . $zaezd_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$zaezd_m_winner_c = ($user['cilynders_zaezd_one'] + 1);
mysql_query("UPDATE `profile` SET `cilynders_zaezd_one` = '" . $zaezd_m_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$rating_winner_c = ($user['winner_rating'] + $itogo_rating);
mysql_query("UPDATE `profile` SET `winner_rating` = '" . $rating_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");

echo "<div style=\"float:left; padding-right: 4px;\"><img src=\"img/girl.gif\" alt=\"\" /></div><td class='p_m'>
 - $user[login], ты выиграл! Забирай свою награду, теперь твой рейтинг стал еще выше.</br>";
 echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";
echo "<center><div style=\"margin-top: 1px #585985 solid; border-top: 1px #585985 solid;padding: 1px;background-color: #2f2e58;\"><span style=\"border-color: #000000; border: 2px; padding-buttom: 5px;\">
</div>
<img src=\"img/winner.gif\" alt=\"\" /></br>";
echo "Отрыв:  $get_speed М.</br>";
echo "<img src=\"img/baks.gif\" alt=\"\" /> + $itogo_baks ";
echo "<img src=\"img/rating.gif\" alt=\"\" /> + $itogo_rating ";
echo "<img src=\"img/fuel.gif\" alt=\"\" /> - 7 <br /> <img src=\"img/power.gif\" alt=\"\" /> -$get_power%</center>";
echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";
echo "<a href=\"start.php?game=over\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/next.gif\"  alt=\"\" /> Далее</div></a>";
echo "<div class=\"hr\"></div>";
echo "</div>";

}
//////////////////////////////////////////////Победа
if ($protivnik == $avto_user) {
$power_winner_c = ($user['winner_power'] + $get_power);
mysql_query("UPDATE `profile` SET `winner_power` = '" . $power_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$game_over_rezult = ($user['game_over_rezult'] = 1);
mysql_query("UPDATE `profile` SET `game_over_rezult` = '" . $game_over_rezult . "' WHERE `id` = '$user[id]' LIMIT 1");
$game_over = ($user['game_over'] = 1);
mysql_query("UPDATE `profile` SET `game_over` = '" . $game_over . "' WHERE `id` = '$user[id]' LIMIT 1");
$zaezd_rezult = ($user['zaezd_rezult'] = $get_speed);
mysql_query("UPDATE `profile` SET `zaezd_rezult` = '" . $zaezd_rezult . "' WHERE `id` = '$user[id]' LIMIT 1");

$baks_winner_c = ($user['winner_baks'] + $itogo_baks);
mysql_query("UPDATE `profile` SET `winner_baks` = '" . $baks_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$fuel_winner_c = ($user['cilynders_fuel'] - 7);
mysql_query("UPDATE `profile` SET `cilynders_fuel` = '" . $fuel_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$zaezd_winner_c = ($user['cilynders_zaezd'] + 1);
mysql_query("UPDATE `profile` SET `cilynders_zaezd` = '" . $zaezd_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$zaezd_m_winner_c = ($user['cilynders_zaezd_one'] + 1);
mysql_query("UPDATE `profile` SET `cilynders_zaezd_one` = '" . $zaezd_m_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");
$rating_winner_c = ($user['winner_rating'] + $itogo_rating);
mysql_query("UPDATE `profile` SET `winner_rating` = '" . $rating_winner_c . "' WHERE `id` = '$user[id]' LIMIT 1");

echo "<div style=\"float:left; padding-right: 4px;\"><img src=\"img/girl.gif\" alt=\"\" /></div><td class='p_m'>
 - $user[login], ты выиграл! Забирай свою награду, теперь твой рейтинг стал еще выше.</br>";
 echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";
echo "<center><div style=\"margin-top: 1px #585985 solid; border-top: 1px #585985 solid;padding: 1px;background-color: #2f2e58;\"><span style=\"border-color: #000000; border: 2px; padding-buttom: 5px;\">
</div>
<img src=\"img/winner.gif\" alt=\"\" /></br>"; 
echo "Отрыв:  $get_speed М.</br>";
echo "<img src=\"img/baks.gif\" alt=\"\" /> + $itogo_baks ";
echo "<img src=\"img/rating.gif\" alt=\"\" /> + $itogo_rating ";
echo "<img src=\"img/fuel.gif\" alt=\"\" /> - 7</br><img src=\"img/power.gif\" alt=\"\" /> -$get_power%</center>";
echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";

echo "<a href=\"start.php?game=over\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/next.gif\"  alt=\"\" /> Далее</div></a>";
echo "<div class=\"hr\"></div>";
echo "</div>";
include_once '../sys/inc/tfoot.php';
}




echo '<br/><br/><b><a href="go.php?act=go&amp;rand=' . $rand .'">Играть</a></b><br/><br/>';

sleep(2);


break;

default:

echo '<b><a href="index.php?act=go&amp;rand=' . $rand .'">Играть</a></b><br/><br/>
<a href="index.php?act=faq&amp;">Помощь</a><br/>';
echo "Баллы: $user[many]<br />\n";
echo "<a href=\"index.php\">&#187;Назад</a>\n";
break;
}
}
if (isset($user) & $user['game_over']==1)
{
if (isset($user) & $user['game_over_rezult']==1)
{
echo "<div style=\"float:left; padding-right: 4px;\"><img src=\"img/girl.gif\" alt=\"\" /></div><td class='p_m'>
 - $user[nick], ты выиграл! Забирай свою награду, теперь твой рейтинг стал еще выше.</br>";
echo "<center><div style=\"margin-top: 1px #585985 solid; border-top: 1px #585985 solid;padding: 1px;background-color: #2f2e58;\"><span style=\"border-color: #000000; border: 2px; padding-buttom: 5px;\">
</div>
<img src=\"img/winner.gif\" alt=\"\" /></br>"; 
echo "Отрыв:  $user[zaezd_rezult] М.</br>";
echo "<img src=\"img/baks.gif\" alt=\"\" /> + $user[winner_baks] ";
echo "<img src=\"img/rating.gif\" alt=\"\" /> + $user[winner_rating] ";
echo "<img src=\"img/fuel.gif\" alt=\"\" /> - 7<br/><img src=\"img/power.gif\" alt=\"\" /> $user[winner_power]%</center>";
}
if (isset($user) & $user['game_over_rezult']==2)
{
echo "<div style=\"float:left; padding-right: 4px;\"><img src=\"img/girl.gif\" alt=\"\" /></div><td class='p_m'>
 - $user[nick], не повезло, ты проиграл. Возможно в следующий раз ты окажешься сильнее.</br>";
 echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";

 echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";
echo "<center><div style=\"margin-top: 1px #585985 solid; border-top: 1px #585985 solid;padding: 1px;background-color: #2f2e58;\"><span style=\"border-color: #000000; border: 2px; padding-buttom: 5px;\">
</div>
<img src=\"img/loser.gif\" alt=\"\" /></br>";
echo "Отстал:  $user[zaezd_rezult] М.</br>";
echo "<img src=\"img/rating.gif\" alt=\"\" /> $user[winner_rating] ";
echo "<img src=\"img/fuel.gif\" alt=\"\" /> - 7<br/><img src=\"img/power.gif\" alt=\"\" /> $user[winner_power]%</center>";
}
}
echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";

echo "<a href=\"start.php?game=over\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/next.gif\"  alt=\"\" /> Далее</div></a>";
echo "<div class=\"hr\"></div>";
}else{
echo "<div style=\"float:left; padding-right: 4px;\"><img src=\"img/girl.gif\" alt=\"\" /></div><td class='p_m'>
 - <b>$user[login]</b>, ";
echo " у тебя мало бензина, поэтому ты не можешь учавствовать в заезде, езжай на заправку - Для участия в заезде, тебе необходимо иметь 8 литров в баке, как заправишься приезжай еще.</br>";
echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";

echo "<a href=\"avtozap.php\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/zapr.gif\"  alt=\"\" /> Автозаправка</div></a>";
echo "<div class=\"hr\"></div>";

echo "<a href=\"index.php\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/cityss.gif\"  alt=\"\" /> Город</div></a>";

echo "<div class=\"hr\"></div>";
echo "<a href=\"profil.php\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/profiles.gif\"  alt=\"\" /> Профиль</div></a>";


echo "<div class=\"hr\"></div>";
echo "<a href=\"garage.php\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/garages.gif\"  alt=\"\" /> В гараж</div></a>";

}
}else{
echo "<div style=\"float:left; padding-right: 4px;\"><img src=\"img/girl.gif\" alt=\"\" /></div><td class='p_m'>
 - <b>$user[login]</b>, ";
echo " состояние твоего авто не пригодно для заезда, тебе пора в автосервис.</br>";
echo "<div style=\"display:block; padding:4px; background:url(img/hr.png) repeat-x scroll 0 0 #504F6E;\"></div>";

echo "<a href=\"avtoservis.php\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/servis.gif\"  alt=\"\" /> Автосервис</div></a>";
echo "<div class=\"hr\"></div>";

echo "<a href=\"index.php\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/cityss.gif\"  alt=\"\" /> Город</div></a>";

echo "<div class=\"hr\"></div>";
echo "<a href=\"profil.php\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/profiles.gif\"  alt=\"\" /> Профиль</div></a>";


echo "<div class=\"hr\"></div>";
echo "<a href=\"garage.php\"><div style=\"background-image: url('img/menu.png');color:#ffffff;font-size:16px; padding-left: 4px; padding:1px;\"><img width=\"24\" height=\"24\" src=\"img/garages.gif\"  alt=\"\" /> В гараж</div></a>";

}
}else{
echo "<div style=\"float:left; padding-right: 4px;\"><img src=\"img/girl.gif\" alt=\"\" /></div><td class='p_m'>
 - Приветствую тебя Гость,
добро пожаловать в захватывающию онлайн игру <b>Speed Of Race</b>.</br>В игре тебя ждет захватывающая гонка, в которой ты можешь заработать денег, 
и стать лидером среди участников гонки!</br>
 - Гость, я вижу 
 что ты еще не зарегистрироан, пройди <a href=\"/reg.php\">регистрацию</a> на этом сайте, и тогда тебе будет доступна игра <b>Speed Of Race</b>!.</td>";

}
echo "</div>";
navig();
foot();
?>