<?php
$id = protect($_GET['id']);
$select = mysql_query("SELECT * FROM `inventory_user` WHERE `id`='".$id."' AND `user_id`='".$user['id']."' AND `kol`>0 LIMIT 1");

if(mysql_num_rows($select)==0){
	echo '<div id="error">Предмет использован/продан!</div>';
	foot();
	exit;
}
$row = mysql_fetch_assoc($select);
if($row['cat_id']==2){
mysql_query("UPDATE `users` SET
`armor`=0
WHERE `id`='".$user['id']."'");
}elseif($row['cat_id']==3){
mysql_query("UPDATE `users` SET
`helmet`=0
WHERE `id`='".$user['id']."'");
}elseif($row['cat_id']==4){
mysql_query("UPDATE `users` SET
`shoes`=0
WHERE `id`='".$user['id']."'");
}elseif($row['cat_id']==5){
mysql_query("UPDATE `users` SET
`gloves`=0
WHERE `id`='".$user['id']."'");
}elseif($row['cat_id']==6){
mysql_query("UPDATE `users` SET
`amulet`=0
WHERE `id`='".$user['id']."'");
}elseif($row['cat_id']==7){
mysql_query("UPDATE `users` SET
`weapon`=0
WHERE `id`='".$user['id']."'");
}
header("Location: inventory.php?cat=".$row['cat_id']);

?>