Файл: dev/bank.php
Строк: 133
<?php
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['exchange']) && intval($_GET['exchange'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `bank_exchange` WHERE `id` = '".intval($_GET['exchange'])."'"),0)!=0)
{
$exchange=mysql_fetch_array(mysql_query("SELECT * FROM `bank_exchange` WHERE `id`='".intval($_GET['exchange'])."'"));
$money=$exchange['money'];
$baks=$exchange['baks'];
if($user['baks']>=$baks)
{
mysql_query("UPDATE `user` SET `money` = '".($user['money']+$money)."', `baks` = '".($user['baks']-$baks)."'WHERE `id` = '".$user['id']."' LIMIT 1");
$_SESSION['exchange']=1;
header("Location: /dev/bank.php");
exit;
}
}
if(isset($_SESSION['exchange']))
{
echo "<table class='wdt msg-table'>";
echo "<tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-bank.png'></td>";
echo "<td align='left' style='vertical-align: top'>Обмен монет успешно совершен. Приятно иметь дело с такими людьми!</td></tr></table></td></tr></table>";
unset($_SESSION['exchange']);
}
else
{
echo "<table class='wdt msg-table'>";
echo "<tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-bank.png'></td>";
echo "<td align='left' style='vertical-align: top'>Привет! Осмотрись тут, Ты можешь купить баксы и обменять их на монеты.</td></tr></table></td></tr></table>";
}
echo "<table class='wdt brown-header'>";
echo "<tr><td align='left'>Покупка баксов:</td></tr></table>";
echo "<table class='wdt gray-table'>";
echo '<div class="bmenu mbank"><a href="/worldkassa_baks/index.php"><span class="bgl"><span class="bgi baks">Баксы</span></span></a></div>';
echo '<div class="bmenu mbank"><a href="/worldkassa_money/index.php"><span class="bgl"><span class="bgi money">Монеты</span></span></a></div>';
echo '<div class="bmenu mbank"><a href="/worldkassa_turnir_money/index.php"><span class="bgl"><span class="bgi hp">Тур. очки</span></span></a></div>';
echo "<table class='wdt brown-header'>";
echo "<tr><td align='left'>Обмен валюты:</td></tr></table>";
echo "<table class='wdt gray-table'>";
$q=mysql_query("SELECT * FROM `bank_exchange` ORDER BY `money` ASC, `baks` ASC");
while($post=mysql_fetch_array($q)){
echo "<tr><td class='td-cell white' style='height: 55px;' align='left'>";
echo "<b style='color: orange; font-size: 12pt; font: Tahoma;'>".m_format($post['money'])."</b> <b style='color: orange; font-size: 12pt; font: Tahoma;'>монет</b><br>";
echo "<b style='color: #999999; font-size: 12pt; font: Tahoma;'>за</b> <b style='color: #99cc66; font-size: 12pt; font: Tahoma;'>".m_format($post['baks'])." баксов</b></td>";
echo "<td class='td-cell white' style='height: 55px;' align='right'>";
if($user['baks']>=$post['baks'])
{
echo "<form action='/dev/bank.php?exchange=".$post['id']."' method='post'><input class='btn' type='submit' value='Обмен'></form></td></tr>";
}
else
{
echo "<input class='inactive-btn' type='submit' value='Обмен'></td></tr>";
}
}
echo "<table class='wdt gray-table'>";
echo "<tr><td class='white td-cell' align='center' style='height:30px;'><form action ='/dev/garage.php' method='post'><input class='no-btn' type='submit' value='Назад'></form></td></tr></table>";
include_once '../sys/inc/tfoot.php';
?>