<?
echo"<a href=\"game.php\"> </a>";
echo"<a href=\"game.php?speak=fred&id=fr_buy\"></a>";
$itemSEL=mysql_query("SET NAMES cp1251");
$itemSEL=mysql_query("SELECT * FROM fred_items WHERE idname_fred_items=\"$itemsMenu\"");
$itemsFET=mysql_fetch_assoc($itemSEL);

$mUs=mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$mUs2=mysql_fetch_assoc($mUs);
$Uit=mysql_query("SELECT * FROM inv WHERE ID_USERS=\"$_SESSION[s]\" AND IL_NO!=\"1\" AND NEVE!=\"1\"");
if($itemsFET[counts_fred_items]<1){echo'<div class="main_title"><center><font color="red"><img src="img/bad.png">     </font></center></div>';die;}
if($itemsFET[costs_fred_items]>$mUs2[money]){echo'<div class="main_title"><center><font color="red"><img src="img/bad.png">    </font></center></div>';die;}

if($itemsFET[costs_fred_items]<=$mUs2[money]){
if(mysql_num_rows($Uit)>=$mUs2[MAX_VES]){echo'<div class="main_title"><center><font color="red"><img src="img/bad.png">       </font></center></div>';die;}
echo '<b>   <u>'.$itemsFET[name_fred_items].'</u></b>';
$users_items_add = mysql_query("SET NAMES cp1251");   

$users_items_add=mysql_query("INSERT INTO inv 
(IL_LVL,IL_CLASS,IL_ALL_CLASS,IL_NAME,
IL_COST,IL_KEY,IL_MIN_DMG,IL_MAX_DMG,
IL_STR,IL_DEX,IL_MIN_PROCH,
IL_MAX_PROCH,IL_IMAGE,IL_SRC,IL_NO,ID_USERS,
IL_VES,IL_COUNT) 
VALUES(
'$itemsFET[fa_lvl_items]','$itemsFET[type]',
'$itemsFET[fred_class]','$itemsFET[name_fred_items]',
'$itemsFET[costs_fred_items]','$itemsFET[idname_fred_items]','$itemsFET[fr_min_DMG]','$itemsFET[fr_max_DMG]',
'$itemsFET[fr_items_STR]','$itemsFET[fr_items_DEX]',
'$itemsFET[fr_items_MAXPROCH]','$itemsFET[fr_items_MAXPROCH]',
'$itemsFET[img_fred_items]','$itemsFET[fr_il_key]',
'0','$_SESSION[s]','$itemsFET[fa_ves]','1')");//    
$itKm=$itemsFET[counts_fred_items]-1;
$uKi=mysql_query("UPDATE fred_items SET counts_fred_items=\"$itKm\" WHERE idname_fred_items=\"$itemsMenu\"");
$moMin=$mUs2[money]-$itemsFET[costs_fred_items];
$Ummin=mysql_query("UPDATE users SET money=\"$moMin\" WHERE NICK=\"$_SESSION[s]\"");
}
die;
?>