Вход Регистрация
Файл: dev/autosalon.php
Строк: 245
<?
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(
$_GET['buy']) && intval($_GET['buy'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `autosalon` WHERE `id` = '".intval($_GET['buy'])."'"),0)!=0)
{
$car=mysql_fetch_array(mysql_query("SELECT * FROM `autosalon` WHERE `id`='".intval($_GET['buy'])."'"));
$mb mysql_result(mysql_query("SELECT COUNT(name) FROM `garage` WHERE `name` = '".$car['name']."' AND `id_user` = '".$user['id']."'"),0);

if(
$set['every_day_bonus']=='1')
{
$money=$car['price_money']/2;
}
else
{
$money=$car['price_money'];
}
$baks=$car['price_baks'];

if(
$user['level']>=$car['level'] && $mb == 0)
{
if(
$user['money']>=$money && $user['baks']>=$baks)
{
mysql_query("UPDATE `user` SET `money` = '".($user['money']-$money)."', `baks` = '".($user['baks']-$baks)."'WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("INSERT INTO `garage` SET `id_user` = '".$user['id']."', `screen` = '".$car['screen']."', `name` = '".$car['name']."', `power` = '".$car['power']."', `stock_power` = '".$car['power']."', `country` = '".$car['country']."', `model` = '".$car['model']."', `marka` = '".$car['marka']."', `typecar` = '".$car['typecar']."', `class` = '".$car['class']."', `price_money` = '".$car['price_sell']."', `price_baks` = '".$car['price_sell_baks']."'");
$id=mysql_insert_id();
mysql_query("UPDATE `user` SET `car_id` = '$id' WHERE `id` = '".$user['id']."' LIMIT 1");
$_SESSION['new_car']=1;
header("Location:/dev/race.php");
}
else
{
$_SESSION['no_money']=1;
header("Location:/dev/dealer.php");
}
}
else
{
header("Location:/dev/autosalon.php");
}
}

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>Хочешь купить новую машину? Твоя старая машина сохранится у тебя в гараже.<br>У тебя на счету <img src='/style/img/icons/hp.png'><b>".m_format($user['turnir_money'])."</b> турнирных очков.</td></tr></table>";

echo 
"<table class='wdt garage-table'><tr><td align='right' style='padding-top: 4px; padding-left: 10px'>";
echo 
"<table class='wdt'>";
echo 
"<tr><td style='vertical-align: top;padding-top: 3px;' align='left' rowspan='4'><table>";


echo 
"</table></td><td align='left' class='white' style='vertical-align: top' width='40%'><b>$mycar[name]</b> <b class='class-$mycar[class] bold-text'>$mycar[class]</b></td></tr>";
echo 
"<tr><td align='left' class='white' style='font-size: 12px'>Рейтинг: <b class='yellow'><img src='/style/img/icons/rating.png' alt='Rating'> ".m_format($user['rating'])."</b></td></tr>";
echo 
"<tr><td align='left' style='font-size: 12px'> Бензин: <img src='/style/img/icons/fuel.png' alt='ing'> <b>$user[fuel]/$user[max_fuel]</b></td></tr></table></td></tr><tr><td></td></tr>";
echo 
"<tr><td><table class='wdt'>";
echo 
"<tr><td align='center' style='padding-bottom: 0px; padding-left: 10px; padding-right: 10px;' valign='bottom'></br><img class='wdt' src='/style/img/car/$mycar[screen].png' alt='car'>";
if(
$mycar['neon']!=0){
echo 
"<img class='wdt' style='margin-top: -19px;' src='/style/img/images/neon/$mycar[neon].png' alt='t'>";
}
else
{
echo 
"<img class='wdt' style='margin-top: -19px;' src='/style/img/images/car_shadow.png' alt='t'>";
}
echo 
"</td></tr></table></td></tr></table>";

echo 
"<table class='wdt green-header'><tr><td align='left'>Автосалон:</td></tr></table>";


if(isset(
$_GET['mini'])){
mysql_query("UPDATE `user` SET `mini` = '".($user['mini']==01)."' WHERE `id` = '".$user['id']."'");
header("Location:/dev/autosalon.php");
exit;
}

if(
$user['mini']==1)
{
$q=mysql_query("SELECT * FROM `autosalon` WHERE `level` <= '".$user['level']."' AND `screen` NOT IN (SELECT `screen` FROM `garage` WHERE `id_user` = '$user[id]') ORDER BY `power` ASC");
}
else
{
$q=mysql_query("SELECT * FROM `autosalon` WHERE `level` <= '".$user['level']."' AND `screen` NOT IN (SELECT `screen` FROM `garage` WHERE `id_user` = '$user[id]') ORDER BY `power` DESC LIMIT 5");
}
while(
$post=mysql_fetch_array($q)){
if(
$set['every_day_bonus']=='1')
{
$money_post=$post['price_money']/2;
}
else
{
$money_post=$post['price_money'];
}

echo 
"<table class='wdt green-table'><tr>";
echo 
"<td class='white td-cell green-table-act' align='left' style='width:140px; padding-top: 2px; vertical-align:middle;'><table  style='vertical-align:middle;'><tr><td align='left'> <b>$post[name]</b></td></tr>";
echo 
"<tr><td align='left'><img src='/style/img/car/$post[screen].png' width='128px' alt=''/><br/>";
echo 
"<img style='width:128px; margin-top:-15px;' src='/style/img/images/car_shadow.png' alt=''></td></tr></table></td>";
echo 
"<td class='td-cell' align='left'><table class='wdt'>";
echo 
"<tr><td><b class='white'>Класс:</b> <b class='class-$post[class] bold-text'>$post[class]</b><br/><b class='orange'>Мощность: $post[power] л.с.</b></td></tr><tr><td>";

if(
$post['price_money']>0)
{
if(
$user['money']>=$money_post)
{
echo 
"<div style='float:left; padding-right:10px;'><img src='/style/img/icons/money.png' alt='coins'> <b class='white'>".m_format($money_post)."</b></div>";
}
else
{
echo 
"<div style='float:left; padding-right:10px;'><img src='/style/img/icons/money.png' alt='coins'> <b class='red'>".m_format($money_post)."</b></div>";
}
}

if(
$post['price_baks']>0)
{
if(
$user['baks']>=$post['price_baks'])
{
echo 
"<div style='float:left; padding-right:10px;'><img src='/style/img/icons/baks.png' alt='coins'> <b class='green'>".m_format($post['price_baks'])."</b></div>";
}
else
{
echo 
"<div style='float:left; padding-right:10px;'><img src='/style/img/icons/baks.png' alt='coins'> <b class='red'>".m_format($post['price_baks'])."</b></div>";
}
}
echo 
"</td></tr>";

if(
$user['money']>=$money_post && $user['baks']>=$post['price_baks'])
{
echo 
"<tr><td><form action='/dev/autosalon.php?buy=".$post['id']."' method='post'><input class='race-btn' type='submit' value='Купить'></form></td>";
if(
$user['acces']==5){
echo 
"<td><form action='../01019147adm/apedit_car_autosalon.php?id=".$post['id']."' method='post'><input class='yes-btn' type='submit' value='Ред.'></form></td>";
}
echo 
"</tr></table></td></tr><tr>";
}
else
{
echo 
"<tr><td><input class='inactive-btn' type='submit' value='Купить'></td>";
if(
$user['acces']==5){
echo 
"<td><form action='../01019147adm/apedit_car_autosalon.php?id=".$post['id']."' method='post'><input class='yes-btn' type='submit' value='Ред.'></form></td>";
}
echo 
"</tr></table></td></tr><tr>";
}
}


if(
$user['mini']==0)
{
echo 
"<td class='white td-cell' align='center' colspan='2' style='height:30px;'><form action='/dev/autosalon.php?mini' method='post'><input class='wdt race-btn' type='submit' value='Все доступные модели'></form></td></tr></table>";
}
else
{
echo 
"<td class='white td-cell' align='center' colspan='2' style='height:30px;'><form action='/dev/autosalon.php?mini' method='post'><input class='wdt race-btn' type='submit' value='Свернуть список'></form></td></tr></table>";
}

echo 
"<table class='wdt brown-header'><tr><td align='left'>Будут доступны на ".($user['level']+1)."-м уровне:</td></tr></table>";
$nextcar mysql_result(mysql_query("SELECT COUNT(*) FROM `autosalon` WHERE `level` =  '".($user['level']+1)."'"),0);
if (
$nextcar==0)
{
echo 
"<table class='wdt gray-table'>";
echo 
"<tr><td class='td-cell white'><b>Нет доступных машин на следующем уровне!</b></td></tr></table>";
}

                        
$q2=mysql_query("SELECT * FROM `autosalon` WHERE `level` =  '".($user['level']+1)."' ORDER BY `power` ASC");
while(
$anons=mysql_fetch_array($q2)){
echo 
"<table class='wdt gray-table'><tr>";
echo 
"<tr><td class='white td-cell' align='left' style='width: 140px'><table><tr><td align='left'><b>$anons[name]</b></td></tr>";

echo 
"<tr><td align='left'><img src='/style/img/car/$anons[screen].png' width='128px' alt=''><br>";

echo 
"<img style='width: 128px; margin-top: -15px;' src='/style/img/images/car_shadow.png' alt=''></td></tr></table></td>";
echo 
"<td class='td-cell' align='left'><table class='wdt'><tr><td><b class='white'>Класс:</b> <b><b class='class-$anons[class] bold-text'>$anons[class]</b><br><b class='orange'>Мощность: $anons[power] л.с.</b></td></tr></table></td></tr>";
}
echo 
"<table class='wdt gray-table'>";
echo 
"<tr><td class='white td-cell' align='center' style='height:30px;'><form action ='/dev/map.php' method='post'><input class='no-btn' type='submit' value='Назад'></form></td></tr></table>";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
include_once 
'../sys/inc/tfoot.php';
?>
Онлайн: 3
Реклама