Файл: public_html/modules/panel/mobs.php
Строк: 63
<?php
include_once ('../../core/base.php');
$header = 'Панель управления::Функционал игры';
include_once ('../../core/head.php');
falseauth();
panel();
switch($_GET['case'])
{
case 'edit':
$id = fl($_GET['id']);
$mob = $db->query("SELECT * FROM `locations_mobs` WHERE `id` = '".$id."'")->fetch_object();
$locations = $db->query("SELECT * FROM `locations`");
if(isset($_GET['edit']))
{
$location = fl($_POST['location']);
$name = fl($_POST['name']);
$level = fl($_POST['level']);
$power = fl($_POST['power']);
$health = fl($_POST['health']);
$block = fl($_POST['block']);
$exp = fl($_POST['exp']);
$silver = fl($_POST['silver']);
$db->query("UPDATE `locations_mobs` SET `location_id` = '".$location."', `name` = '".$name."', `mob_level` = '"
.$level."', `power` = '".$power."', `health` = '".$health."',
`block` = '".$block."', `exp` = '".$exp."', `silver` = '".$silver."' WHERE `id` = '".$id."'");
redirect('/access/mobs');
}
echo '<div class="b">
<form action="?edit" method="post">
Локация:<br>
<select name="location">';
while($loc = $locations->fetch_object())
{
if($loc->id == $mob->location_id) echo '<option value="'.$loc->id.'">'.$loc->name.'</option>';
else echo '<option value="'.$loc->id.'" selected>'.$loc->name.'</option>';
}
echo '</select>
Имя моба:<br>
<input type="text" name="name" value="'.$mob->name.'" required><br>
Уровень моба:<br>
<input type="text" name="level" value="'.$mob->mob_level.'" required><br>
Сила:<br>
<input type="text" name="power" value="'.$mob->power.'" required><br>
Здоровье:<br>
<input type="text" name="health" value="'.$mob->health.'" required><br>
Защита:<br>
<input type="text" name="block" value="'.$mob->block.'" required><br>
Опыт:<br>
<input type="text" name="exp" value="'.$mob->exp.'" required><br>
Серебро:<br>
<input type="text" name="silver" value="'.$mob->silver.'" required><br>
<input type="submit" name="edit" value="Добавить">
</form>
</div>';
break;
case 'delete':
$id = fl($_GET['id']);
$db->query("DELETE FROM `locations_mobs` WHERE `id` = '".$id."'");
redirect('/access/mobs');
break;
default:
$mobs = $db->query("SELECT * FROM `locations_mobs`");
while($m = $mobs->fetch_object())
{
echo '<div class="b">
<div class="line"></div>
<table width="100%">
<tbody><tr>
<td width="70px" valign="top">
<img width="70px" height="70" src="/images/monsters/'.$m->id.'.png">
</td>
<td valign="top">
<font color="white">'.$m->name.'</font>
<div class="txt">
Уровень моба: '.$m->mob_level.'
</div>
<div class="txt">
<a href="/access/mobs/edit/'.$m->id.'">Редактировать моба</a><br>
<a href="/access/mobs/delete/'.$m->id.'">Удалить моба</a>
</div>
</td>
</tr>
</tbody></table><br>
</div>
<div class="line"></div>';
}
echo '<div class="line"></div>';
echo '<a class="link" href="/access/addmob/"> Добавить моба в окрестности </a>';
echo '<div class="line"></div>';
break;
}
include_once ('../../core/foot.php');
?>