Файл: obmen.php
Строк: 37
<?
require_once('core/index.php');
require_once('core/func.php');
avt();
$title='Обменный пункт';
require_once('design/head.php');
if(isset($_GET['act']) &&($_GET['act']==1 || $_GET['act']==5 || $_GET['act']==10 || $_GET['act']==50)){
if($_GET['act']>$user['rubin']){$err='Не хватает рубинов';}
if(!isset($err)){
request("UPDATE `users` SET `rubin`=`rubin`-?, `gold`=`gold`+? WHERE `id`=?", array($_GET['act'], ($_GET['act']*1000), $user['id']));
$_SESSION['msg']='Обмен совершен';
header('Location:?');
}else{
$_SESSION['msg']=$err;
header('Location:?');}
}
echo '<div class="h1">Рубинов: '.$user['rubin'].' <img src=/design/ico/png/rubin.png alt="*"></div>';
echo $user['rubin']<=0?'<div class="h1">Нет доступных рубинов к обмену</div>':null;
echo $user['rubin']>0?'<div class="h2"><a class="link540" href=?act=1>1 рубин -> 1000 золота</a></div>':null;
echo $user['rubin']>5?'<div class="h2"><a class="link540" href=?act=5>5 рубинов -> 5000 золота</a></div>':null;
echo $user['rubin']>10?'<div class="h2"><a class="link540" href=?act=10>10 рубинов -> 10000 золота</a></div>':null;
echo $user['rubin']>50?'<div class="h2"><a class="link540" href=?act=50>50 рубинов -> 50000 золота</div></a>':null;
echo '<div class="rzd"></div><div class="h2"><a class="link540" href=/market><img src="/design/ico/png/left.png"> Назад</a></div>';
require_once('design/foot.php');
?>