Файл: user/lvl.php
Строк: 26
<?
require_once('../core/index.php');
require_once('../core/func.php');
avt();
$title='';
require_once('../design/head.php');
if(isset($_GET['up'])){
$count=$db->query("SELECT id FROM `backpack` WHERE `id`='".$_GET['id']."' AND `id_user`='".$user['id']."'")->rowCount();
if($count==0){$_SESSION['msg']='Ошибка'; header('Location:/user/backpack');exit();}
$h1 = $db->query("SELECT * FROM `backpack` WHERE `id`='".$_GET['id']."'")->fetch();
$thing = $db->query("SELECT * FROM `thing` WHERE `id`='".$h1['id_thing']."' AND 'status'='0'")->fetch();
$count=$db->query("SELECT id FROM `backpack` WHERE `id_thing`='".$_GET['id']."' AND `lvl`='25'")->rowCount();
if($count>=5){$_SESSION['msg']='Вы не можете повысить уровень героя после 25 уровня'; header('Location:/user/backpack');exit();}
if ($h1['count'] >= $h1['lvl']+'1') {
request("UPDATE `backpack` SET `lvl` = `lvl`+'1', `count` = `count`-`lvl` WHERE `id` =?", array($_GET['id']));
$_SESSION['msg']='Уровень повышен';
header('Location:/user/backpack');}
else{
$_SESSION['msg']='Не достаточно карт';
header('Location:/user/backpack');
}}
require_once('../design/foot.php');
?>