Файл: public_html/modules/panel/addmobs.php
Строк: 54
<?php
include_once ('../../core/base.php');
$header = 'Добавить мобов';
include_once ('../../core/head.php');
falseauth();
adm();
$locations = $db->query("SELECT * FROM `locations`");
if(isset($_GET['add']))
{
$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']);
$image = $_FILES['image'];
$fi = finfo_open(FILEINFO_MIME_TYPE);
$mime = (string) finfo_file($fi, $image['tmp_name']);
if(strpos($mime, 'image') === false) redirect('/access/addmob');
$db->query("INSERT INTO `locations_mobs` SET `location_id` = '".$location."', `name` = '".$name."', `mob_level` = '".$level."', `power` = '".$power."', `health` = '".$health."',
`block` = '".$block."', `exp` = '".$exp."', `silver` = '".$silver."'");
move_uploaded_file($image['tmp_name'], $_SERVER['DOCUMENT_ROOT'].'/images/monsters/'.$db->insert_id.'.png');
redirect('/access/mobs');
}
echo '<div class="b">
<form action="?add" method="post" enctype="multipart/form-data">
Локация:<br>
<select name="location">';
while($loc = $locations->fetch_object())
{
echo '<option value="'.$loc->id.'">'.$loc->name.'</option>';
}
echo '</select>
Имя моба:<br>
<input type="text" name="name" required><br>
Уровень моба:<br>
<input type="text" name="level" required><br>
Сила:<br>
<input type="text" name="power" required><br>
Здоровье:<br>
<input type="text" name="health" required><br>
Защита:<br>
<input type="text" name="block" required><br>
Опыт:<br>
<input type="text" name="exp" required><br>
Серебро:<br>
<input type="text" name="silver" required><br>
Иконка:<br>
<input type="file" name="image" required><br><br>
<input type="submit" name="add" value="Добавить">
</form>
</div>';
include_once ('../../core/foot.php');