<?
define('PROTECTOR', 1);
$head = 'elexirs';//фикс. места
$textl='Инвентарь';
@include('files/db.php');
@include('files/auth.php');
@include('files/func.php');
@include('files/core.php');
@include('files/head.php');
@include('files/zag.php');
$req = mysql_query("SELECT * FROM `res` WHERE `usr` = '$log' and `id`='$_GET[id]'");
$avto=mysql_num_rows($req);
if($avto==0){
echo'Ошибка, такой вещи нет!';
include('files/down.php');
exit;}
$mag = mysql_fetch_array($req);
if($mag[tip]!='elexir'){
echo'Ошибка, доступ закрыт!';
@include('files/down.php');
exit;}
switch($mag[what]){
case 'hp':
$newp=$mag[give]+$udata[hp];
if($newp>$udata[hpall]){$newp=$udata[hpall];}
mysql_query("UPDATE `users` SET `hp` = '$newp' WHERE usr = '$log'");
if($mag[kol]==1){
mysql_query("UPDATE res SET kol = '0' WHERE `usr` = '$log' and `id`='$_GET[id]'");}else{
$mag[kol]--;
mysql_query("UPDATE res SET kol = '$mag[kol]' WHERE `usr` = '$log' and `id`='$_GET[id]'");}
echo"Вы использовали $mag[name]!<br/>";
break;
case 'mp':
$newp=$mag[give]+$udata[mp];
if($newp>$udata[mpall]){$newp=$udata[mpall];}
mysql_query("UPDATE `users` SET `mp` = '$newp' WHERE usr = '$log'");
if($mag[kol]==1){
mysql_query("UPDATE res SET kol = '0' WHERE `usr` = '$log' and `id`='$_GET[id]'");}else{
$mag[kol]--;
mysql_query("UPDATE res SET kol = '$mag[kol]' WHERE `usr` = '$log' and `id`='$_GET[id]'");}
echo"Вы использовали $mag[name]!<br/>";
break;}
echo'<a href="javascript:history.go(-1)">Назад</a>';
include('files/down.php');
?>