62 lines
1.5 KiB
PHP
62 lines
1.5 KiB
PHP
<?php
|
|
// Что ты такое?
|
|
use Battles\Database\DBPDO;
|
|
use Battles\User;
|
|
|
|
require_once "../config.php";
|
|
$user = User::$current;
|
|
if (!User::$current->getAdmin()) {
|
|
exit('Access denied!');
|
|
}
|
|
$nec = DBPDO::$db->fetchAll('select * from podzem2');
|
|
|
|
?>
|
|
<style>
|
|
.row {
|
|
cursor: default;
|
|
border: 1px solid black;
|
|
}
|
|
|
|
.column {
|
|
padding: 10px;
|
|
float: left;
|
|
}
|
|
|
|
.left {
|
|
width: 300px;
|
|
}
|
|
|
|
.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']))) {
|
|
$SQL2 = DBPDO::$db->execute('insert into podzem2 (name) value ?', $_GET['name']);
|
|
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>
|