Вход Регистрация
Файл: use.php
Строк: 33
<?php
include_once ('./core/base.php');
falseauth();

include_once (
'./core/head.php');

$id=fl($_GET['id']);

$item $base -> query('SELECT * FROM `users_items` WHERE `id` = "'.$id.'" LIMIT 1') -> fetch_assoc();

if(
$item != 0) {

//Если зелье
if($item['what'] == 'potion'){
    
$new_hp $u['hp'] + $item['hp_regen'];
    if(
$new_hp $u['max_hp']) $new_hp $u['max_hp'];
    
$new_mp $u['mp'] + $item['mp_regen'];
    if(
$new_mp $u['max_mp']) $new_mp $u['max_mp'];
    
$base -> query('UPDATE `users` SET `hp` = "'.$new_hp.'", `mp` = "'.$new_mp.'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
    
$new_amount $item['amount'] - 1;
    if(
$new_amount <= 0){
        if(
$item['id'] == $u['belt_slot_1']) $slot 1;
        if(
$item['id'] == $u['belt_slot_2']) $slot 2;
        if(
$item['id'] == $u['belt_slot_3']) $slot 3;
        
$base -> query('UPDATE `users` SET `belt_slot_'.$slot.'` = "0" WHERE `id` = "'.$u['id'].'" LIMIT 1');
        
$base -> query('DELETE FROM `users_items` WHERE `id` = "'.$item['id'].'"');
    }
    else 
$base -> query('UPDATE `users_items` SET `amount` = "'.$new_amount.'" WHERE `id` = "'.$item['id'].'" LIMIT 1');
    
$_SESSION['message'] = ''.$item['name'].' использовано.';
    
header('Location: /inventory/res/'.$item['what'].'/');
    exit;
}

}else{

header('Location: /inventory/res/');
exit;

}

include_once (
'./core/foot.php');
?>
Онлайн: 1
Реклама