Code clean.
This commit is contained in:
parent
2fe8b04d18
commit
f6b469ddef
12
buy.php
12
buy.php
@ -1,9 +1,11 @@
|
||||
<?php
|
||||
//Покупка абилок? Тут?!
|
||||
session_start();
|
||||
if (!isset($_SESSION['uid'])) exit;
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header('Location: Index.php');
|
||||
exit;
|
||||
}
|
||||
include('config.php');
|
||||
#include('functions.php');
|
||||
$is_now = db::c()->query('SELECT `id`, `uid` FROM `abils_user` WHERE `uid` = ?i', $user['id'])->fetch_assoc();
|
||||
|
||||
function add_user_abil($ab, $cost)
|
||||
@ -12,9 +14,9 @@ function add_user_abil($ab, $cost)
|
||||
if (isset($ab) && $banks['ekr'] >= $cost) {
|
||||
$isset = mysql_fetch_array(mysql_query('SELECT `id`, `' . $ab . '` FROM `abils_user` WHERE `uid` = "' . $user['id'] . '" LIMIT 1'));
|
||||
$isset[$ab] += 1;
|
||||
mysql_query('UPDATE `abils_user` SET `' . $ab . '` = "' . $isset[$ab] . '" WHERE `uid` = "' . $user['id'] . '" LIMIT 1');
|
||||
mysql_query('UPDATE `abils_user` SET `' . $ab . '` = "' . $isset[$ab] . '" WHERE `uid` = "' . $user['id'] . '"');
|
||||
$banks['ekr'] -= $cost;
|
||||
mysql_query('UPDATE `bank` SET `ekr` = "' . $banks['ekr'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1');
|
||||
mysql_query('UPDATE `bank` SET `ekr` = "' . $banks['ekr'] . '" WHERE `id` = "' . $user['id'] . '"');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -31,7 +33,7 @@ if (isset($_POST['type'], $_POST['user'])) {
|
||||
if ($banks['ekr'] >= $price) {
|
||||
if (isset($is_now['id'])) {
|
||||
if ($user['battle'] == 0) {
|
||||
if (add_user_abil($abil, $price) == true) {
|
||||
if (add_user_abil($abil, $price)) {
|
||||
echo 'success';
|
||||
} else {
|
||||
echo 'Error';
|
||||
|
Loading…
Reference in New Issue
Block a user