battles/fancy/buy.php
2018-01-28 18:40:49 +02:00

39 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?
session_start();
if(!isset($_SESSION['uid'])) { die(); }
include('../config.php');
include('../functions.php');
$is_now = mysql_fetch_array(mysql_query('SELECT `id`, `uid` FROM `abils_user` WHERE `uid` = "'.$user['id'].'" LIMIT 1'));
$cost = array(1, 2, 10, 0.50, 0.80, 1, 1, 0.10, 0.20, 4, 0.02, 20, 10, 1, 1);
$mag = array('sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone');
if(isset($_POST['type'], $_POST['user'])) {
if(isset($user['id'])) {
$price = $cost[$_POST['type']-1];
$abil = $mag[$_POST['type']-1];
if(isset($banks['id'])) {
if($banks['ekr'] >= $price) {
if(isset($is_now['id'])) {
if($user['battle'] == 0) {
if(add_user_abil($abil, $price) == true) {
echo 'success';
} else {
echo 'Error';
}
} else {
echo 'Не в бою ...';
}
} else {
echo 1;
}
} else {
echo 'Не хватает средств';
}
} else {
echo '<small>Выберите счёт в банке</small>';
}
} else {
echo "Вы не авторизированы";
}
}