function set_svitok($myinfo, $item_id) { $res = mysql_fetch_array(mysql_query("SELECT * FROM inv WHERE owner='" . $myinfo["login"] . "' and id={$item_id} and wear=0 and object_razdel='magic'")); if ($res) { $sloton = 0; $t = 109; if ($myinfo["level"] >= 10) { $t = 110; } if ($myinfo["level"] >= 11) { $t = 111; } for ($i = 100; $i <= $t; $i++) { if (!$myinfo['slot' . $i]) { $sloton = $i; break; } } unset($i); if (!$sloton) { #снимаем слот 100 $sloton = 100; setdown_svitok($myinfo, 100, $myinfo['slot100']); } mysql_query("UPDATE users SET slot" . $sloton . "={$item_id} WHERE login='******'"); mysql_query("UPDATE inv SET wear=1 WHERE id={$item_id} and owner='" . $myinfo["login"] . "'"); } $now = md5(time()); Header("Location: main.php?act=inv&razdel=magic&tmp={$now}"); }
} } if ($_GET["unwear"] && !$db["battle"] && !$db["zayavka"] && is_numeric($_GET["unwear"])) { if ($db["room"] != "smert_room" && $db["room"] != "house" && $db["room"] != "zadaniya") { unWear($login, $_GET["unwear"]); } } if ($_GET["act"] == "unwear_full" && !$db["battle"] && $db["room"] != "house") { unwear_full($login); } ############################################################################################## if ($_GET["act"] == "addToSlot" && !$db["battle"] && is_numeric($_GET['id']) && $db["room"] != "house") { set_svitok($db, $_GET['id']); } if ($_GET["act"] == "setdown_svitok" && !$db["battle"] && is_numeric($_GET['id']) && is_numeric($_GET['slot']) && $db["room"] != "house") { setdown_svitok($db, $_GET['slot'], $_GET['id']); } ############################################################################################## if ($_GET["act"] == "magic" && !$db["battle"] && $db["room"] != "house") { $spell = (int) abs($_GET['spell']); $DATA = mysql_fetch_array(mysql_query("SELECT * FROM inv LEFT JOIN scroll on scroll.id=inv.object_id WHERE inv.id='" . $spell . "' and inv.owner='" . $login . "' and inv.object_razdel='magic' and inv.wear=0")); if ($DATA) { $elik_id = $DATA["object_id"]; $mtype = $DATA["mtype"]; $min_i = $DATA["min_intellekt"]; $min_v = $DATA["min_vospriyatie"]; $min_l = $DATA["min_level"]; $orden = $DATA["orden"]; $name = $DATA["name"]; $mana = $DATA["mana"]; $file = $DATA["files"];