Вход Регистрация
Файл: weatut.ru/pay.php
Строк: 35
<?php
require_once ('system/func.php');
$title 'Золото';
require_once (
'system/header.php');
if(isset(
$_GET[gold]) and $user[koll_gold] > 0){
if(
$user[crystals] < $user[koll_gold]*500){
$_SESSION[msg] = "Не хватает ".ico('icons','crystal.png')." ".($user[koll_gold]*500-$user[crystals])." кристаллов";
header("Location: ?");
exit();
}
mysql_query("update `users` set `gold` = '".($user['gold']+$user[koll_gold])."', `crystals` = '".($user['crystals']-$user[koll_gold]*500)."', `koll_gold` = '0' where (`id` = '".$user['id']."')");
$_SESSION[msg] = "Вы успешно обменяли кристаллы на золото";
header('Location: ?');
exit();
}
auth(); // Закроем от гостей
if(isset($_GET['crystals'])){
switch(
$_GET['crystals']){
case 
500:
$gold 1;
break;
case 
1000:
$gold 2;
break;
case 
5000:
$gold 10;
$break;
}
if(!
$gold){
header('Location: /pay');
exit();
}
if(
$user['gold'] < $gold){
$_SESSION['msg'] = "Ошибка, не хватает ".ico('icons','gold.png')." ".($gold-$user['gold'])." золота";
header('Location: /pay?'.$random);
exit();
}else{
mysql_query("update `users` set `gold` = '".($user['gold']-$gold)."', `crystals` = '".($user['crystals'] + num($_GET['crystals']))."' where (`id` = '".$user['id']."')");
$_SESSION['msg'] = "Вы успешно купили ".ico('icons','crystal.png')." ".num($_GET['crystals'])." кристаллов";
header('Location: /pay?'.$random);
exit();
}
}

if(
$user[koll_gold] > 0)echo '<a href="?gold" class="link">'.ico('icons','gold.png').' Купить '.$user[koll_gold].' за '.ico('icons','crystal.png').' '.($user[koll_gold]*500).'</a>';
echo 
'<a href="?crystals=500" class="link">'.ico('icons','crystal.png').' Купить 500 кристаллов за 1 золото</a>';
echo 
'<a href="?crystals=1000" class="link">'.ico('icons','crystal.png').' Купить 1000 кристаллов за 2 золота</a>';
echo 
'<a href="?crystals=5000" class="link">'.ico('icons','crystal.png').' Купить 5000 кристаллов за 10 золота</a>';
require_once (
'system/footer.php');
?>
Онлайн: 0
Реклама