Файл: azone/item.php
Строк: 214
<?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_item = mysql_num_rows(mysql_query("SELECT * FROM `l2_all_item`"));
switch($sd){
default:
echo "<a href='/azone/item/add'>Создать вещь</a><br>
<a href='/azone/item/all'>Все вещи игры</a> <small>($all_item)</small><br>";
break;
case 'add':
if(empty($_POST['submit'])){
echo "<form action='/azone/item/add' method='post'>
Название:<br>
<input type='text' name='name'><br>
На Английском:<br>
<input type='text' name='lat'><br>
Картинка(url):<br>
<input type='text' name='img'><br>
Грейд:
<select name='grade'>
<option value='NG'>NG</option>
<option value='D'>D</option>
<option value='C'>C</option>
<option value='B'>B</option>
<option value='A'>A</option>
<option value='S'>S</option>
<option value='S80'>S80</option>
<option value='R'>R</option>
<option value='R95'>R95</option>
<option value='R99'>R99</option>
</select><br>
Тип предмета:<br>
<select name='tip_item'>
<option value='weapon'>Оружие</option>
<option value='armor'>Броня</option>
<option value='bija'>Бижутерия</option>
<option value='resource'>Ресурс</option>
<option value='potion'>Эликсик</option>
<option value='other'>Разное</option>
</select><br>
Вид оружия:<br>
<select name='view_weapon'>
<option value=''>Выберите вид оружия</option>
<option value='dagger'>Кинжал</option>
<option value='dual_dagger'>Парные кинжалы</option>
<option value='sword'>Меч</option>
<option value='two_sword'>Парные Мечи</option>
<option value='dual_sword'>Двуручный Меч</option>
<option value='rapier'>Рапира</option>
<option value='ancientsword'>Древний Меч</option>
<option value='bow'>Лук</option>
<option value='crossbows'>Арбалет</option>
<option value='club'>Дубинка</option>
<option value='dual_club'>Парные Дубинки</option>
<option value='two_club'>Двуручная Дубинка</option>
<option value='spear'>Копьё</option>
<option value='magweapon'>Магическое Оружие</option>
<option value='knuckles'>Кастеты</option>
</select><br>
Вид Брони/Бижутерии:<br>
<select name='view_armor'>
<option value=''>Выберите вид брони/бижутерии</option>
<option value='helmet'>Шлем</option>
<option value='armor'>Броня</option>
<option value='down'>Низ Брони</option>
<option value='gloves'>Перчатки</option>
<option value='boot'>Сапоги</option>
<option value='shield'>Щит</option>
<option value='necklace'>Ожерелье</option>
<option value='ring'>Кольцо</option>
<option value='ear'>Серьга</option>
</select><hr>
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>
Бонусы:<br>
Patt: <input type='text' name='bonus_patt' size='5'> Matt: <input type='text' name='bonus_matt' size='5'><br>
Pdef: <input type='text' name='bonus_pdef' size='5'> Mdef: <input type='text' name='bonus_def' size='5'><br>
+HP: <input type='text' name='hp' size='5'> +MP: <input type='text' name='mp' size='5'> +CP: <input type='text' name='cp' size='5'><hr>
SoulShot: <input type='text' name='soulshot' size='5' value='0'> SpiritShot: <input type='text' name='spiritshot' size='5' value='0'><br>
Можно модифицировать?(0-да,1-нет)<br>
<select name='mod'>
<option value='0'>Да</option>
<option value='1'>Нет</option>
</select><br>
Описание:<br>
<textarea name='text' class='ta' rows='7'></textarea><br>
<input type='submit' name='submit' value='Создать' class='ta'></form>";
}else{
if($_POST['grade']=='NG'){$level=0;}
if($_POST['grade']=='D'){$level=20;}
if($_POST['grade']=='C'){$level=40;}
if($_POST['grade']=='B'){$level=52;}
if($_POST['grade']=='A'){$level=61;}
if($_POST['grade']=='S'){$level=76;}
if($_POST['grade']=='S80'){$level=80;}
if($_POST['grade']=='R'){$level=85;}
if($_POST['grade']=='R95'){$level=95;}
if($_POST['grade']=='R99'){$level=99;}
mysql_query("INSERT INTO `l2_all_item` SET
`name`='$_POST[name]',
`lat`='$_POST[lat]',
`grade`='$_POST[grade]',
`level`='$level',
`tip_item`='$_POST[tip_item]',
`view_weapon`='$_POST[view_weapon]',
`view_armor`='$_POST[view_armor]',
`patt`='$_POST[patt]',
`pdef`='$_POST[pdef]',
`matt`='$_POST[matt]',
`mdef`='$_POST[mdef]',
`bonus_patt`='$_POST[bonus_patt]',
`bonus_pdef`='$_POST[bonus_pdef]',
`bonus_matt`='$_POST[bonus_matt]',
`bonus_mdef`='$_POST[bonus_mdef]',
`hp`='$_POST[hp]',
`mp`='$_POST[mp]',
`cp`='$_POST[cp]',
`soulshot`='$_POST[soulshot]',
`spiritshot`='$_POST[spiritshot]',
`text`='$_POST[text]',
`mod`='$_POST[mod]'");
$next_id = mysql_insert_id();
mysql_query("UPDATE `l2_all_item` SET `img`='$next_id.png' WHERE `id`='$next_id'");
$file = file_get_contents($_POST['img']);
file_put_contents($_SERVER['DOCUMENT_ROOT']."/pic/item/$next_id.png", $file);
header('Location: /azone/item/add');
exit;
}
back('/azone/item');
break;
case 'all':
$num = 204;
$page = (int)mysql_real_escape_string(htmlspecialchars(strip_tags($_GET['page'])));
$result = mysql_query("SELECT * FROM `l2_all_item`") 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_item` ORDER BY `id` ASC LIMIT $start, $num");
While($w = mysql_fetch_assoc($q)){
echo "<a href='/info/item/$w[id]'><img class='listimg' src='/pic/item/$w[img]'></a>";
}
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/item');
break;
}
require ($_SERVER['DOCUMENT_ROOT'].'/lib/down.php');
require ($_SERVER['DOCUMENT_ROOT'].'/theme/foot.php');
?>