111 lines
3.7 KiB
PHP
111 lines
3.7 KiB
PHP
|
|
<?php
|
|||
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
|
|||
|
|
|
|||
|
|
ini_set('display_errors', 1);
|
|||
|
|
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);
|
|||
|
|
|
|||
|
|
// закрываем доступ на выполнение запросов
|
|||
|
|
if (!isset($_SESSION['superadmin'])) {
|
|||
|
|
header("location:/index.php");
|
|||
|
|
die("Доступ запрещён!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (isset($_POST['add_tariff'])) {
|
|||
|
|
|
|||
|
|
$err = "";
|
|||
|
|
|
|||
|
|
$post = clearInputData($_POST);
|
|||
|
|
|
|||
|
|
if (isset($post['id'])) {
|
|||
|
|
if (strlen($err) == 0) {
|
|||
|
|
|
|||
|
|
$sqlUpdate = "UPDATE discharge_tariff SET count = '$post[count]', price = '$post[price]' WHERE id = $post[id]";
|
|||
|
|
mysql_query($sqlUpdate);
|
|||
|
|
|
|||
|
|
header("location:/admin/dischargeTariffs.php");
|
|||
|
|
exit();
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
if (strlen($err) > 0) {
|
|||
|
|
$err = $err . "<br/>";
|
|||
|
|
}
|
|||
|
|
$err .= "Не найден идентификатор тарифа в запросе.";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$get = clearInputData($_GET);
|
|||
|
|
|
|||
|
|
if (!isset($get['id'])) {
|
|||
|
|
header("location:/admin/dischargeTariffs.php");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/templates/header-admin.php");
|
|||
|
|
|
|||
|
|
if (!isset($post) && $get['id'] > 0) {
|
|||
|
|
$sql = "select * from discharge_tariff where id= $get[id]";
|
|||
|
|
$rez = mysql_query($sql);
|
|||
|
|
|
|||
|
|
$tariff = mysql_fetch_array($rez);
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
|
|||
|
|
<div class="main-title">
|
|||
|
|
<h1>Редактирование тарифа выписок ЕГРН</h1>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="users fr__users" style="margin-right: 20px;">
|
|||
|
|
|
|||
|
|
<div class="new-object">
|
|||
|
|
<form method="post">
|
|||
|
|
<div class="new-object__form">
|
|||
|
|
<?php if (isset($err) && strlen($err) > 0) { ?>
|
|||
|
|
<div class="block" style="border-bottom: none; color: red;"><?php echo $err; ?></div>
|
|||
|
|
<?php } ?>
|
|||
|
|
|
|||
|
|
<div class="block">
|
|||
|
|
<div class="line">
|
|||
|
|
<div class="label">
|
|||
|
|
<span>Количество:</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="inputs">
|
|||
|
|
<input type="number" class="text" name="count" style="width: 75%;"
|
|||
|
|
value="<? if (isset($post)) echo $post['count'];
|
|||
|
|
if (isset($tariff)) echo $tariff['count']; ?>">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="line">
|
|||
|
|
<div class="label">
|
|||
|
|
<span>Цена:</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="inputs">
|
|||
|
|
<input type="number" class="text" name="price" style="width: 75%;"
|
|||
|
|
value="<? if (isset($post)) echo $post['price'];
|
|||
|
|
if (isset($tariff)) echo $tariff['price']; ?>">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<div class="line" style="text-align: right">
|
|||
|
|
<button type="submit" class="medium-button">Сохранить</button>
|
|||
|
|
<a href="/admin/dischargeTariffs.php" class="cancel-button medium-button">Закрыть</a>
|
|||
|
|
</div>
|
|||
|
|
<input type="hidden" name="add_tariff" value="1">
|
|||
|
|
<input type="hidden" name="id" value="<?php if (isset($tariff)) {
|
|||
|
|
echo $tariff['id'];
|
|||
|
|
} else {
|
|||
|
|
if (isset($post)) {
|
|||
|
|
echo $post['id'];
|
|||
|
|
}
|
|||
|
|
} ?>">
|
|||
|
|
<div class="clear"></div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<div class="clear"></div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<?php
|
|||
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/templates/footer-admin.php");
|
|||
|
|
?>
|