Файл: dev/seller.php
Строк: 162
<?
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($count_car<2){
header("Location:/dev/garage.php");
}
else
{
if(isset($_GET['sell']) && intval($_GET['sell'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `garage` WHERE `id` = '".intval($_GET['sell'])."' AND `id` != '".$user['car_id']."' AND `id_user` = '".$user['id']."'"),0)!=0)
{
$sell=mysql_fetch_array(mysql_query("SELECT * FROM `garage` WHERE `id`='".intval($_GET['sell'])."' AND `id_user` = '".$user['id']."'"));
$money=$sell['price_money'];
$baks=$sell['price_baks'];
if(isset($_GET['ok']) && $sell['id_user']==$user['id'])
{
mysql_query("UPDATE `user` SET `money`= '".($user['money']+$money)."', `baks`= '".($user['baks']+$baks)."' WHERE `id`='".$user['id']."'");
mysql_query("INSERT INTO `seller_logs` SET `id_user` = '".$user['id']."', `screen` = '".$sell['screen']."', `name` = '".$sell['name']."', `power` = '".$sell['power']."', `stock_power` = '".$sell['stock_power']."', `country` = '".$sell['country']."', `model` = '".$sell['model']."', `candles` = '".$sell['candles']."', `oil` = '".$sell['oil']."', `pads` = '".$sell['pads']."', `bus` = '".$sell['bus']."', `brakes` = '".$sell['brakes']."', `clutch` = '".$sell['clutch']."', `flywheel` = '".$sell['flywheel']."', `suspension` = '".$sell['suspension']."', `pistons` = '".$sell['pistons']."', `turbine` = '".$sell['turbine']."', `transmission` = '".$sell['transmission']."', `collector` = '".$sell['collector']."', `class` = '".$sell['class']."', `price_money` = '".$sell['price_money']."', `price_baks` = '".$sell['price_baks']."'");
mysql_query("DELETE FROM `garage` WHERE `id` = '".$sell['id']."'");
header("Location:/dev/seller.php");
}
# включаем подтверждение продажи
echo "<table class='wdt msg-table'><tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-auto.png'></td><td align='left' style='vertical-align: top'>";
echo "Ты действительно хочешь продать эту машину?</td></tr></table></td></tr></table>";
echo "<table class='wdt brown-header'><tr>";
echo "<td align='left'>Скупка авто:</td></tr></table>";
echo "<table class='wdt gray-table'>";
echo "<tr><td class='white td-cell' align='left' colspan='2' style='padding: 5px;'>";
echo "<img class='wdt' src='/style/img/car/$sell[screen].png' alt=''>";
if($sell['neon']!=0){
echo "<img class='wdt' style='margin-top: -15px;' src='/style/img/images/neon/$sell[neon].png' alt=''>";
}
else
{
echo "<img class='wdt' style='margin-top: -15px;' src='/style/img/images/car_shadow.png' alt=''>";
}
echo "</td></tr><tr><td class='white' align='left' width='60%' style='padding: 5px;'><b>$sell[name]</b><br> Стоимость:";
if ($sell['price_money']>0)
{
echo " <img src='/style/img/icons/money.png' alt='coins'> <b class='yellow'>".m_format($sell['price_money'])."</b>";
}
if ($sell['price_baks']>0)
{
echo " <img src='/style/img/icons/baks.png' alt='coins'> <b class='green'>".m_format($sell['price_baks'])."</b>";
}
echo "</td></tr></table>";
echo "<table class='wdt gray-table'>";
echo "<tr style='border-top: 1px solid #000;'><td align='center' width = '50%'>";
echo "<form action='/dev/seller.php' method='post'><input class='no-btn' type='submit' value='Назад'</input></form></td>";
echo "<td align='center'><form action='/dev/seller.php?sell=".$sell['id']."&ok' method='post'><input class='yes-btn' type='submit' value='Продать'></form></td></tr></table>";
include_once '../sys/inc/tfoot.php';
}
echo "<table class='wdt msg-table'><tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-auto.png'></td><td align='left' style='vertical-align: top'>";
echo "У меня ты можешь продать свои транспортные средства. Иногда я готов заплатить кучу денег за что-нибудь редкое!</td></tr></table></td></tr></table>";
echo "<table class='wdt brown-header'><tr>";
echo "<td align='left'>Машины на продажу:</td></tr></table>";
$q=mysql_query("SELECT * FROM `garage` WHERE `id_user` = '".$user['id']."' AND `id` != '".$user['car_id']."' ORDER BY `power` DESC");
while($post=mysql_fetch_array($q)){
echo "<table class='wdt gray-table'><tr>";
echo "<td class='white td-cell' align='left' colspan='2'><img class='wdt' src='/style/img/car/$post[screen].png' alt=''>";
if($post['neon']!=0){
echo "<img class='wdt' style='margin-top: -15px;' src='/style/img/images/neon/$post[neon].png' alt=''>";
}
else
{
echo "<img class='wdt' style='margin-top: -15px;' src='/style/img/images/car_shadow.png' alt=''>";
}
echo "</td></tr><tr><td class='white' align='left' width='60%'><b>$post[name]</b><br>Стоимость:";
if ($post['price_money']>0)
{
echo " <img src='/style/img/icons/money.png' alt='coins'> <b class='yellow'> ".m_format($post['price_money'])."</b>";
}
if ($post['price_baks']>0)
{
echo " <img src='/style/img/icons/baks.png' alt='gold'><b class='green'> ".m_format($post['price_baks'])."</b>";
}
echo "</td><td class='white' align='left'><form action='/dev/seller.php?sell=".$post['id']."' method='post'><input type='submit' class='yes-btn' value='Продать'></form></td></tr></table>";
}
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';
}
?>