Прикручиваем шаблон. Хороним идиотские ошибки. Делаем новые, более идиотские.

This commit is contained in:
Igor Barkov (iwork) 2020-09-30 15:37:05 +03:00
parent dd8b9e847c
commit 633b551889

View File

@ -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('Берёзка');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="css/main.css" rel="stylesheet"/>
<script src="js/main.js"></script>
</head>
<body>
<script src="js/main.js"></script>
<h1>Магазин Берёзка</h1>
<a href=# onclick=hrefToFrame('city.php?cp')> ← выйти на Центральную площадь</a>
<div><?php if (!empty($status)) err($status); ?></div>
<div><?= $status ?></div>
<table border=0 width=100% cellspacing="0" cellpadding="4">
<tr>
<td valign=top align=left>
@ -202,5 +197,4 @@ switch ($shopCategoryTypeNumber) {
</td>
</tr>
</table>
</body>
</html>
<?php } ?>