battles/podzem/edit.php

51 lines
2.2 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?php
session_start();
require_once "../config.php";
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
if ($user['admin']) {
?>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
<table width="700" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="300" align="left" valign="top">
<?
$nec = mysql_query("SELECT * FROM podzem2");
while ($sc = mysql_fetch_array($nec)) {
print"<a href='edit_podzem.php?name=" . $sc['name'] . "'>" . $sc['name'] . "</a><br />";
2018-01-28 16:40:49 +00:00
}
?>
2018-01-28 16:40:49 +00:00
</td>
<td width="400" align="left" valign="top">
2018-01-28 16:40:49 +00:00
<form action="" method="get">
<? if (!$_GET['new']) { ?>
<input name="new" type="submit" value="Создать новую"/>
<?
if ($_GET['new']) {
print "<script>location.href='main.php?act=none'</script>";
exit;
}
if ($_GET['news']) {
$SQL2 = mysql_query("INSERT INTO podzem2(name) VALUES('" . $_GET['name'] . "')");
print "<script>location.href='edit.php'</script>";
exit;
}
2018-01-28 16:40:49 +00:00
} else { ?>
<input style="font-size:12px;" name="name" type="text" size="10" value="Название"/>
<input name="news" type="submit" value="Создать"/>
<?
} ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
2018-01-28 16:40:49 +00:00
}
?>