From 633b55188956efe15e5ecc0dc0909f9a718c83d7 Mon Sep 17 00:00:00 2001 From: "Igor Barkov (iwork)" Date: Wed, 30 Sep 2020 15:37:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BA=D1=80=D1=83=D1=87?= =?UTF-8?q?=D0=B8=D0=B2=D0=B0=D0=B5=D0=BC=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE?= =?UTF-8?q?=D0=BD.=20=D0=A5=D0=BE=D1=80=D0=BE=D0=BD=D0=B8=D0=BC=20=D0=B8?= =?UTF-8?q?=D0=B4=D0=B8=D0=BE=D1=82=D1=81=D0=BA=D0=B8=D0=B5=20=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=B1=D0=BA=D0=B8.=20=D0=94=D0=B5=D0=BB=D0=B0=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B5,=20=D0=B1=D0=BE=D0=BB?= =?UTF-8?q?=D0=B5=D0=B5=20=D0=B8=D0=B4=D0=B8=D0=BE=D1=82=D1=81=D0=BA=D0=B8?= =?UTF-8?q?=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ashop.php | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/ashop.php b/ashop.php index 89f2922..c8e0704 100644 --- a/ashop.php +++ b/ashop.php @@ -36,13 +36,14 @@ while ($row = $shopItems->fetch_assoc()) { } if (!empty($_GET['buy'])) { - $dress = db::c()->query('SELECT * FROM `ashop` WHERE `id`=?i', $_GET['buy'])->fetch_assoc(); - $itemWeight = db::c()->query('SELECT sum(`massa`) AS `m` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0', $user['id'])->fetch_assoc(); - if (($dress['massa'] + $itemWeight['m']) > (get_meshok())) $status = 'Недостаточно места в рюкзаке.'; - elseif ($bank['ekr'] >= $dress['ecost'] AND ($dress['count'] > 0 OR $dress['count'] == -1)) { - - $goden = ''; - if (isset($dress['goden'])) $goden = $dress['goden'] * 24 * 60 * 60 + time(); // Ну вот нахуя? +$dress = db::c()->query('SELECT * FROM `ashop` WHERE `id`=?i', $_GET['buy'])->fetch_assoc(); +$itemWeight = db::c()->query('SELECT sum(`massa`) AS `m` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0', $user['id'])->fetch_assoc(); +if (($dress['massa'] + $itemWeight['m']) > (get_meshok())) { + $status = 'Недостаточно места в рюкзаке.'; +} elseif ($bank['ekr'] >= $dress['ecost'] && ($dress['count'] > 0 || $dress['count'] == -1)) { + $goden = ''; + if (isset($dress['goden'])) { + $goden = $dress['goden'] * 24 * 60 * 60 + time(); // Ну вот нахуя?} db::c()->query(' INSERT INTO `inventory` ( @@ -63,11 +64,11 @@ if (!empty($_GET['buy'])) { $dress['nlevel'], $dress['nalign'], $goden, $dress['goden'], $dress['razdel'], $dress['artefact'], $dress['koll']); $inventoryItemId = db::c()->getLastInsertId(); - if ($dress['count'] != -1) db::c()->query('UPDATE `ashop` SET `count` = `count`- 1 WHERE `id` = ?i', $_GET['buy']); - + if ($dress['count'] != -1) { + db::c()->query('UPDATE `ashop` SET `count` = `count`- 1 WHERE `id` = ?i', $_GET['buy']); + } $deloText = "{$user['login']} купил товар «{$dress['name']}» id:({$inventoryItemId}) в магазине «Берёзка» за {$dress['ecost']} екр."; addToDelo($deloText); - $status = "Вы купили «{$dress['name']}» за {$dress['ecost']} екр."; db::c()->query('UPDATE `bank` SET `ekr` = `ekr` - ?i WHERE `id` = ?i', $dress['ecost'], $_SESSION['uid']); // Для обновления данных о деньгах на странице @@ -138,18 +139,12 @@ switch ($shopCategoryTypeNumber) { $shopCategory = "Букеты"; break; } +Template::header('Берёзка'); ?> - - - - - - - - +

Магазин Берёзка

← выйти на Центральную площадь -
+
@@ -202,5 +197,4 @@ switch ($shopCategoryTypeNumber) {
- - + \ No newline at end of file