<?
header ("Content-type: text/html; charset=windows-1251");
if (substr_count($_SERVER['HTTP_REFERER'],'main.php')>0):
	require ($_SERVER['DOCUMENT_ROOT'].'/maintenance/vars.php');
	require (ROOT.'/maintenance/dbconn.php');
	require (ROOT.'/maintenance/vcode.php');
	require (ROOT.'/maintenance/functions.php');
	if (VALID):
		$v = fetch("SELECT * FROM inventory WHERE ID='".$_REQUEST["w_sell"]."'");
		$pers = user(UID);
		require (ROOT."/maintenance/hp_restore.php");
		query ("UPDATE users SET money=money+".$v["price"]." WHERE uid=".UID);
		query ("DELETE FROM inventory WHERE ID=".$v["ID"]." and owner=".UID." and weared=0");
		echo 'Предмет <b>&laquo;'.$v["name"].'&raquo;</b> продан. На счет зачислено <b>'.$v["price"].' LM</b>|'.VCODE;
	endif;
else:
	echo 'ERROR';
endif;

?>