Файл: public_html/worldkassa/buy.php
Строк: 102
<?
include '../system/common.php';
include '../system/functions.php';
include '../system/user.php';
if(!$user) {
header('location: /');
exit;
}
switch($_GET['action']) {
default:
$title = 'Заказ золотых';
include '../system/h.php';
?>
<div class='title'><?=$title?></div>
<div class='line'></div>
<div class='content' align='center'>
<font color='#9bc'>Золото самый ценный ресурс!</font>
</div>
<div class='line'></div>
<div class='list'>
<div class='content' align='center'>Купить золото</div>
</div>
<div class='line'></div>
<div class='menu'>
<li><table cellpadding='0' cellspacing='0'><tr>
<td valign='top'><img src='/images/gold/-4.png' alt='*'/></td>
<td valign='top' style='padding-left: 5px;'><b>Сокровище богов</b><br/>
<img src='/images/icon/gold.png' alt='*'/> <b>500M</b><br/>
<font color='#9c9'>+</font> 500M</td>
</tr></table><br/>
<font color='#909090'>Цена: (10 руб.)</td></tr></table><br/></font>
<a href='index.php?gold=110000' class='button'>Купить</a>
<li class='no_b'></li>
</div>
<?
include '../system/f.php';
break;
case 'exchange':
$title = 'Обменник';
include '../system/h.php';
$course = 500;
$g = _string(_num($_GET['g']));
if($g) {
if($_GET['buy'] == true) {
if($user['s'] < $course * $g) {
header('location: /trade/exchange/');
exit;
}
mysql_query('UPDATE `users` SET `g` = "'.($user['g'] + $g).'", `s` = "'.($user['s'] - $course * $g).'" WHERE `id` = "'.$user['id'].'"');
}
else
{
if($user['g'] < $g) {
header('location: /trade/exchange/');
exit;
}
mysql_query('UPDATE `users` SET `g` = "'.($user['g'] - $g).'", `s` = "'.($user['s'] + $course * $g).'" WHERE `id` = "'.$user['id'].'"');
}
header('location: /trade/exchange/');
}
?>
<div class='title'><?=$title?></div>
<div class='line'></div>
<div class='content' align='center'>
<img src='/images/town/gold.png' alt='*'/>
</div>
<div class='line'></div>
<div class='list'>
<div class='content' align='center'><font color='#9bc'>Обмен <img src='/images/icon/silver.png' alt='*'/> серебра на <img src='/images/icon/gold.png' alt='*'/> золото</font></div>
<div class='line'></div>
<?
for($i = 1; $i <= ($user['level'] > 10 ? 10:$user['level']); $i++) {
if($i == 1 OR $i == 5 OR $i == 10) {
if($user['s'] > $course * $i) {
?>
<li><a href='/trade/exchange/<?=$i?>/?buy=true'><img src='/images/icon/arrow.png' alt='*'/> <img src='/images/icon/silver.png' alt='*'/> <font color='#ffffff'><?=n_f($course * $i)?> → <img src='/images/icon/gold.png' alt='*'/> <?=$i?> </font></a></li>
<?
}
}
}
?>
<li class='no_b'></li>
</div>
<div class='line'></div>
<div class='list'>
<div class='content' align='center'><font color='#9bc'>Купить <img src='/images/icon/silver.png' alt='*'/> серебро</font></div>
<div class='line'></div>
<?
for($i = 1; $i <= ($user['level'] > 10 ? 10:$user['level']); $i++) {
if($i == 1 OR $i == 5 OR $i == 10) {
if($user['g'] >= $i) {
?>
<li><a href='/trade/exchange/<?=$i?>/'><img src='/images/icon/arrow.png' alt='*'/> <font color='#ffffff'><img src='/images/icon/gold.png' alt='*'/> <?=$i?> → <img src='/images/icon/silver.png' alt='*'/> <?=n_f($course * $i)?></font></a></li>
<?
}
}
}
?>
<li class='no_b'></li>
</div>
<?
include '../system/f.php';
break;
}
?>