Файл: html/admin/lvl.php
Строк: 82
<?php
require_once ('../system/func.php');
require_once ('../system/header.php');
if (!$user OR $user['access'] < 3) {
?><script>showContent("/");</script><?php
exit;
}
$res_099 = $mc->query("SELECT * FROM exp ORDER BY `exp`.`lvl` ASC");
$arrtablopit_01 = array();
while ($row = $res_099->fetch_array(MYSQLI_ASSOC)) {
$arrtablopit_01[] = $row;
}
?>
<center>
<h2>
<strong>-Редактор Уровня-</strong>
</h2>
<form id="form1">
<input type='text' name='lvl' style="width:100px" placeholder="lvl">
<input type='text' name='exp' style="width:100px" placeholder="exp">
<input class="button butt1" style="width:50px" value="add">
</form>
<script>
$(".butt1").click(function () {
showContent("/admin/lvl.php?create=addbd" + "&" + $("#form1").serialize());
});
</script>
<?php
if (isset($_GET['cteate'])&& $_GET['create'] == "addbd") {
if (isset($_GET['lvl']) && isset($_GET['exp'])) {
$mc->query("INSERT INTO `exp`("
. "`id`,"
. "`lvl`,"
. "`exp`"
. ") VALUES ("
. "'NULL',"
. "'" . $_GET['lvl'] . "',"
. "'" . $_GET['exp'] . "'"
. ")");
?><script>showContent("/admin/lvl.php?msg="+encodeURIComponent("added"));</script><?php
} else {
?><script>showContent("/admin/lvl.php?create=add&msg="+encodeURIComponent("error_added"));</script><?php
}
}
if (isset($_GET['create'])&& $_GET['create'] == "save") {
if (isset($_GET['id']) && isset($_GET['lvl']) && isset($_GET['exp'])) {
$mc->query("UPDATE `exp` SET `lvl` = '".$_GET['lvl']."' , `exp`='".$_GET['exp']."' WHERE `id` = '".$_GET['id']."'");
?><script>showContent("/admin/lvl.php?msg="+encodeURIComponent("saved"));</script><?php
exit(0);
} else {
?><script>showContent("/admin/lvl.php?create=add&msg="+encodeURIComponent("error_saved"));</script><?php
exit(0);
}
}
if (isset($_GET['create'])&& $_GET['create'] == "del") {
if (isset($_GET['id']) && isset($_GET['lvl']) && isset($_GET['exp'])) {
$mc->query("DELETE FROM `exp` WHERE `exp`.`id` = '".$_GET['id']."'");
?><script>showContent("/admin/lvl.php?msg="+encodeURIComponent("deleted"));</script><?php
exit(0);
} else {
?><script>showContent("/admin/lvl.php?create=add&msg="+encodeURIComponent("error_saved"));</script><?php
exit(0);
}
}
for ($i = count($arrtablopit_01) - 1; $i >= 0; $i--) {
$arrtablopit_01[$i]['exp']
?>
<form id="form1<?php echo $arrtablopit_01[$i]['id'];?>">
<input name='id' value="<?php echo $arrtablopit_01[$i]['id'];?>" hidden>
<input name='lvl' style="width:100px" placeholder="lvl" value="<?php echo $arrtablopit_01[$i]['lvl'];?>">
<input name='exp' style="width:100px" placeholder="exp" value="<?php echo $arrtablopit_01[$i]['exp'];?>">
<input class="button butt1<?php echo $arrtablopit_01[$i]['id'];?>" style="width:50px" value="save">
<input class="button butt2<?php echo $arrtablopit_01[$i]['id'];?>" style="width:50px" value="del">
</form>
<script>
$(".butt1<?php echo $arrtablopit_01[$i]['id'];?>").click(function () {
showContent("/admin/lvl.php?create=save" + "&" + $("#form1<?php echo $arrtablopit_01[$i]['id'];?>").serialize());
});
$(".butt2<?php echo $arrtablopit_01[$i]['id'];?>").click(function () {
showContent("/admin/lvl.php?create=del" + "&" + $("#form1<?php echo $arrtablopit_01[$i]['id'];?>").serialize());
});
</script>
<?php
}
?>
</center>
<?php $footval='adminmoney'; include '../system/foot/foot.php';?>