battles/fancy/buy_klan.php

44 lines
1.5 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?
session_start();
if(!isset($_SESSION['uid'])) { die(); }
include('../config.php');
include('../functions.php');
if($user['klan'] == '') { die(); }
$is_now = mysql_fetch_array(mysql_query('SELECT `id`, `klan` FROM `abils_klan` WHERE `klan` = "'.$user['klan'].'" LIMIT 1'));
$clan = mysql_fetch_array(mysql_query('SELECT `id`, `glava` FROM `clans` WHERE `id` = "'.$user['klan'].'" 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']-21];
$abil = $mag[$_POST['type']-21];
if(isset($banks['id'])) {
if($banks['ekr'] >= $price && $user['id'] == $clan['glava']) {
if(isset($is_now['id'])) {
if($user['battle'] == 0) {
if(add_klan_abil($abil, $price) == true) {
echo 'success';
} else {
echo 'Error';
}
} else {
echo 'Не в бою ...';
}
} else {
echo 'NULL';
}
} elseif($user['id'] != $clan['glava']) {
echo 'Вы не глава клана';
} else {
echo 'Не хватает средств';
}
} else {
echo '<small>Выберите счёт в банке</small>';
}
} else {
echo "Вы не авторизированы ...";
}
}