added headers and status
This commit is contained in:
parent
ab5cd2b9cc
commit
9c299cabed
@ -21,6 +21,7 @@ $get = urldecode(filter_input(INPUT_SERVER, 'QUERY_STRING'));
|
||||
$itemCost = (int)filter_input(INPUT_POST, 'cost', FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
|
||||
$itemId = (int)filter_input(INPUT_POST, 'putId', FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
|
||||
$returningItemId = (int)filter_input(INPUT_GET, 'back', FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
|
||||
$byingItemId = (int)filter_input(INPUT_GET, 'set', FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
|
||||
|
||||
if ($itemCost && $itemId) {
|
||||
$commission = ceil($itemCost / 10); # 10% от суммы с округлением вверх.
|
||||
@ -46,14 +47,7 @@ if ($returningItemId) {
|
||||
} else $status = "Предмет не найден на полках магазина!";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($_GET['set'])) {
|
||||
|
||||
if (!$_POST['count'] || !is_numeric($_POST['count']) || $_POST['count'] <= 0) {
|
||||
$_POST['count'] = 1;
|
||||
}
|
||||
if (is_numeric($set) && $set > 0) {
|
||||
if ($byingItemId) {
|
||||
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `dressed`=0 AND `id` = '{$set}' and `owner`!='" . $user['id'] . "' AND `setsale` > 0"));
|
||||
$userfrom = mysql_fetch_array(mysql_query("SELECT `login`,`id` FROM `users` WHERE `id` = '" . $dress['owner'] . "' LIMIT 1;"));
|
||||
$d = mysql_fetch_array(mysql_query("SELECT sum(`massa`) FROM `inventory` WHERE `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `setsale` = 0 ; "));
|
||||
@ -93,9 +87,6 @@ if (isset($_GET['set'])) {
|
||||
} else {
|
||||
echo "<font color=red><b>Вещь не найдена в магазине</b></font>";
|
||||
}
|
||||
} else {
|
||||
echo "<font color=red><b>Не надо так делать</b></font>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($get === 'sale') {
|
||||
@ -213,8 +204,12 @@ switch ($shopCategoryTypeNumber) {
|
||||
<link rel=stylesheet href="css/main.css">
|
||||
<script src="js/main.js"></script>
|
||||
<meta charset="utf-8">
|
||||
<title>Рынок</title>
|
||||
</HEAD>
|
||||
<body>
|
||||
<h1>Рынок</h1>
|
||||
<a href=# onclick=hrefToFrame('city.php?cp')> ← выйти на Центральную площадь</a>
|
||||
<div><?php if (!empty($status)) err($status); ?></div>
|
||||
<div style="float: right;">
|
||||
<button onclick="hrefToFrame('?sale')">Сдать вещи в магазин</button>
|
||||
<button onclick="hrefToFrame('?unsale')">Забрать вещи из магазина</button>
|
||||
@ -230,8 +225,7 @@ switch ($shopCategoryTypeNumber) {
|
||||
<?php
|
||||
if ($get === 'sale') {
|
||||
echo "Выставить товар на продажу.<br>Комиссия за услуги магазина составляет 10% от цены, по которой вы предлагаете предмет.";
|
||||
}
|
||||
elseif ($get === 'unsale') echo "Забрать свой товар";
|
||||
} elseif ($get === 'unsale') echo "Забрать свой товар";
|
||||
else echo "Отдел «" . $shopCategoryType . "»"; ?>
|
||||
</TH>
|
||||
</TR>
|
||||
@ -277,7 +271,7 @@ switch ($shopCategoryTypeNumber) {
|
||||
|
||||
} else {
|
||||
$data = db::c()->query('SELECT DISTINCT `img`, `name`, `nalign`, `massa` FROM `inventory` WHERE `dressed` = 0 AND `setsale` > 0 AND `present` = "?s" AND `otdel` = "?s" GROUP BY `img` ORDER BY `cost` ASC', '', $_GET['otdel']);
|
||||
$replacements = ['+1','+2','+3','+4','+5',' (мф)'];
|
||||
$replacements = ['+1', '+2', '+3', '+4', '+5', ' (мф)'];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$item_name = str_replace($replacements, '', $row['name']);
|
||||
$item = db::c()->query('SELECT COUNT(`id`), MIN(`duration`), MIN(`maxdur`), MAX(`duration`), MAX(`maxdur`), MIN(`setsale`), MAX(`setsale`) FROM `inventory` WHERE `dressed` = 0 AND `setsale` > 0 AND `present` = "?s" AND `name` LIKE "?S%"', '', $item_name)->fetch_row();
|
||||
@ -292,7 +286,8 @@ switch ($shopCategoryTypeNumber) {
|
||||
(Масса: <?= $row['massa'] ?>) <BR>
|
||||
<b>Цена: <?= round($item[5], 2) ?> - <?= round($item[6], 2) ?> кр.</b>
|
||||
<small>(количество: <?= $item[0] ?>)</small>
|
||||
<BR>Долговечность: <?= $item[1] ?>-<?= $item[2] ?>/<?= $item[3] ?> -<?= $item[4] ?><BR>
|
||||
<BR>Долговечность: <?= $item[1] ?>-<?= $item[2] ?>/<?= $item[3] ?>
|
||||
-<?= $item[4] ?><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<?
|
||||
|
5
inf.php
5
inf.php
@ -36,8 +36,9 @@ if (empty($user['id'])): ?>
|
||||
<td style="width: 250px; vertical-align: top;">
|
||||
<?= showinf_pers($user['id']);
|
||||
if (!empty($user['married'])): ?>
|
||||
<a href="inf.php?<?= $user['married'] ?>" target=_blank><img src="i/married.gif"
|
||||
title="В браке с <?= $user['married'] ?>"></a>";
|
||||
<a href="inf.php?<?= $user['married'] ?>" target=_blank>
|
||||
<img src="i/married.gif" title="В браке с <?= $user['married'] ?>">
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td style="vertical-align: top; width: 100px; text-align: center;">
|
||||
|
Loading…
Reference in New Issue
Block a user