diff --git a/functions.php b/functions.php index 435e3ba..6c2628e 100644 --- a/functions.php +++ b/functions.php @@ -4645,8 +4645,9 @@ function dressitemkomplekt($id, $idd) // убить предмет function destructitem($id) { - $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;")); - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `id` = '{$id}' LIMIT 1;")); + global $user; + $slot1 = ''; + $dress = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $user['id'], $id)->fetch_assoc(); switch ($dress['type']) { case 1: $slot1 = 'sergi'; @@ -4740,12 +4741,8 @@ function destructitem($id) } } if (($dress['owner'] == $user['id'])) { - mysql_query("DELETE FROM `inventory` WHERE `id` = '{$id}' LIMIT 1;"); - //mysql_query("INSERT INTO `delo`(`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','Выброшен предмент {$dress['name']}. Цена:{$dress['cost']} кр.',1,'".time()."');"); - //echo "Предмет \"{$dress['name']}\" утерян."; - if ($dress['dressed'] == 1) { - mysql_query("UPDATE `users` SET `" . $slot1 . "` = 0 WHERE `id` = '{$user['id']}';"); - } + if ($dress['dressed'] == 1) db::c()->query('UPDATE `users` SET ?f = 0 WHERE `id` = ?i', $slot1, $user['id']); + db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $id); } } diff --git a/shop.php b/shop.php index 53340d6..cbc1d2d 100644 --- a/shop.php +++ b/shop.php @@ -59,6 +59,32 @@ if (isset($_GET['set']) OR isset($_POST['set'])) { } else $count_ok = 1; $dress = db::c()->query('SELECT * FROM `shop` WHERE `id`=?i', $set)->fetch_assoc(); + +// db::c()->query(' +// INSERT INTO `inventory` ( +// name, maxdur, cost, img, goden, dategoden, massa, prototype, owner, +// nlevel, nsila, nlovk, ninta, nvinos, nintel, nmudra, +// nnoj, ntopor, ndubina, nmech, nalign, nfire, nwater, nair, nearth, nlight, ngray, ndark, +// minu, maxu, +// gsila, glovk, ginta, gintel, ghp, gfire, gwater, gair, gearth, glight, ggray, gdark, +// mfkrit, mfakrit, mfuvorot, mfauvorot, +// gnoj, gtopor, gdubina, gmech, +// bron1, bron2, bron3, bron4, magic, needident, +// gmp, gmeshok, artefact, encicl, koll) +// SELECT +// name, maxdur, cost, img, goden, dategoden, massa, id, ?i, +// nlevel, nsila, nlovk, ninta, nvinos, nintel, nmudra, +// nnoj, ntopor, ndubina, nmech, nalign, nfire, nwater, nair, nearth, nlight, ngray, ndark, +// minu, maxu, +// gsila, glovk, ginta, gintel, ghp, gfire, gwater, gair, gearth, glight, ggray, gdark, +// mfkrit, mfakrit, mfuvorot, mfauvorot, +// gnoj, gtopor, gdubina, gmech, +// bron1, bron2, bron3, bron4, magic, needident, +// gmp, gmeshok, artefact, encicl, koll +// FROM shop WHERE id = inventory.prototype; +// +// ', $user['id']); + if ($count_ok == 0) { err('Неправильно введено количество.'); } elseif (($dress['massa'] * $count + $itemWeight['m']) > (get_meshok())) {