2018-01-28 16:40:49 +00:00
|
|
|
<?php
|
2021-08-25 15:24:12 +00:00
|
|
|
// Что ты такое?
|
2022-01-26 23:15:33 +00:00
|
|
|
use Battles\Database\Db;
|
2021-08-25 15:24:12 +00:00
|
|
|
use Battles\User;
|
|
|
|
|
2020-10-29 23:30:05 +00:00
|
|
|
require_once "../config.php";
|
2022-01-26 23:15:33 +00:00
|
|
|
if (!User::getInstance()->getAdmin()) {
|
2021-08-25 15:24:12 +00:00
|
|
|
exit('Access denied!');
|
|
|
|
}
|
2022-01-26 23:15:33 +00:00
|
|
|
$nec = Db::getInstance()->fetchAll('select * from podzem2');
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2021-08-25 15:24:12 +00:00
|
|
|
?>
|
|
|
|
<style>
|
|
|
|
.row {
|
|
|
|
cursor: default;
|
|
|
|
border: 1px solid black;
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2021-08-25 15:24:12 +00:00
|
|
|
.column {
|
|
|
|
padding: 10px;
|
|
|
|
float: left;
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2021-08-25 15:24:12 +00:00
|
|
|
.left {
|
|
|
|
width: 300px;
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2021-08-25 15:24:12 +00:00
|
|
|
.right {
|
|
|
|
width: 400px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.row:after {
|
|
|
|
content: "";
|
|
|
|
display: table;
|
|
|
|
clear: both;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<div class="row">
|
|
|
|
<div class="column left">
|
|
|
|
<?php
|
|
|
|
foreach ($nec as $row) {
|
|
|
|
echo sprintf('<a href="edit_podzem.php?name=%s">%s</a><br>', $row['name'], $row['name']);
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<div class="column right">
|
|
|
|
<form action="" method="get">
|
|
|
|
<?php if (empty($_GET['new'])): ?>
|
|
|
|
<input name="new" type="submit" value="Создать новую">
|
|
|
|
<?php
|
|
|
|
if (!empty($_GET['news'] && !empty($_GET['name']))) {
|
2022-01-26 23:15:33 +00:00
|
|
|
$SQL2 = Db::getInstance()->execute('insert into podzem2 (name) value ?', $_GET['name']);
|
2021-08-25 15:24:12 +00:00
|
|
|
exit("<script>location.href='edit.php'</script>");
|
|
|
|
} ?>
|
|
|
|
<?php else: ?>
|
|
|
|
<input style="font-size:12px;" name="name" type="text" size="10" value="Название">
|
|
|
|
<input name="news" type="submit" value="Создать">
|
|
|
|
<?php endif; ?>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|