Файл: azone/mob.php
Строк: 125
<?php
require ($_SERVER['DOCUMENT_ROOT'].'/lib/core.php');
require ($_SERVER['DOCUMENT_ROOT'].'/theme/header.php');
require ($_SERVER['DOCUMENT_ROOT'].'/lib/zag.php');
if($user['admin']!=='1'){
header('Location: /main');
exit;
}
$all_mob = mysql_num_rows(mysql_query("SELECT * FROM `l2_all_mobs`"));
switch($sd){
default:
echo "<a href='/azone/mob/add'>Создать монстра</a><br>";
echo "<a href='/azone/mob/all'>Все монстры</a> <small>($all_mob)</small><br>";
break;
case 'add':
if(empty($_POST['submit'])){
echo "<form action='/azone/mob/add' method='post'>
Название:<br>
<input type='text' name='name'><br>
На Английском:<br>
<input type='text' name='lat'><br>
Уровень:<br>
<input type='text' name='level'><br>
Расса монстра:<br>
<select name='race'>
<option value='angel'>Ангел</option>
<option value='gigant'>Гигант</option>
<option value='gumanoid'>Гуманоид</option>
<option value='demon'>Демон</option>
<option value='drakon'>Дракон</option>
<option value='duh'>Дух</option>
<option value='animal'>Животное</option>
<option value='bug'>Жук</option>
<option value='zver'>Зверь</option>
<option value='kamael'>Камаэль</option>
<option value='human'>Человек</option>
<option value='magic'>Магическое создание</option>
<option value='undead'>Нежить</option>
<option value='plant'>Растение</option>
<option value='fay'>Фея</option>
</select><br>
Локация:<br>
<select name='location'>
<option value='0'>Выберите локацию</option>";
$q = mysql_query("SELECT * FROM `l2_location`");
While($w = mysql_fetch_assoc($q)){
echo "<option value='$w[id]'>$w[name]</option>";
}
echo "</select><br>
<img src='/pic/dropexp.png'> <input type='text' name='exp'><br>
<img src='/pic/dropsp.png'> <input type='text' name='sp'><br>
<img src='/pic/dropaden.png'> <input type='text' name='min_aden'> - <input type='text' name='max_aden'><br>
HP: <input type='text' name='hp'><br>
Patt: <input type='text' name='patt' size='5'> Matt: <input type='text' name='matt' size='5'><br>
Pdef: <input type='text' name='pdef' size='5'> Mdef: <input type='text' name='def' size='5'><hr>
<input type='submit' name='submit' value='Создать' class='ta'></form>";
}else{
mysql_query("INSERT INTO `l2_all_mobs` SET
`name`='$_POST[name]',
`lat`='$_POST[lat]',
`level`='$_POST[level]',
`race`='$_POST[race]',
`exp`='$_POST[exp]',
`sp`='$_POST[sp]',
`min_aden`='$_POST[min_aden]',
`max_aden`='$_POST[max_aden]',
`hp`='$_POST[hp]',
`hpall`='$_POST[hp]',
`patt`='$_POST[patt]',
`pdef`='$_POST[pdef]',
`matt`='$_POST[matt]',
`mdef`='$_POST[mdef]'") or die(mysql_error());
echo "<a href='/azone/mob/add'>Далее</a>";
//header('Location: /azone/mob/add');
//exit;
}
back('/azone/mob');
break;
case 'all':
$num = 204;
$page = (int)mysql_real_escape_string(htmlspecialchars(strip_tags($_GET['page'])));
$result = mysql_query("SELECT * FROM `l2_all_mobs`") or die(mysql_error());
$posts = mysql_num_rows($result);
$total = intval(($posts - 1) / $num) + 1;
$page = intval($page);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$q = mysql_query("SELECT * FROM `l2_all_mobs` ORDER BY `id` ASC LIMIT $start, $num");
While($w = mysql_fetch_assoc($q)){
echo "<a href='/info/mob/$w[id]'>$w[name] <small>($w[lat])</small></a><br>";
}
echo "<hr>";
if ($page != 1) $pervpage = '<a href=?page=1>««</a>
<a href=?page='. ($page - 1) .'>«</a> ';
if ($page != $total) $nextpage = ' <a href=?page='. ($page + 1) .'>»</a>
<a href=?page=' .$total. '>»»</a>';
if($page - 2 > 0) $page2left = ' <a href=?page='. ($page - 2) .'>'. ($page - 2) .'</a> | ';
if($page - 1 > 0) $page1left = '<a href=?page='. ($page - 1) .'>'. ($page - 1) .'</a> | ';
if($page + 2 <= $total) $page2right = ' | <a href=?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' | <a href=?page='. ($page + 1) .'>'. ($page + 1) .'</a>';
echo $pervpage.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.$nextpage;
back('/azone/mob');
break;
}
require ($_SERVER['DOCUMENT_ROOT'].'/lib/down.php');
require ($_SERVER['DOCUMENT_ROOT'].'/theme/foot.php');
?>