<?php
require_once '../core/system.php';
echo admin();
$header = 'Админ Панель!';
require_once '../core/head.php';
if($user[prava] >= 5 ){
if(isset($_GET['add'])){
$name = check($_POST['name']);
$type = check($_POST['type']);
$cena = abs(intval($_POST['cena']));

$sila= abs(intval($_POST['sila']));

$max_health= abs(intval($_POST['max_health']));

$lovk= abs(intval($_POST['lovk']));

$zash= abs(intval($_POST['zash']));

$mana= abs(intval($_POST['mana']));

$stata = $sila.';'.$max_health.';'.$lovk.';'.$zash.';'.$mana;
$id = abs(intval($_POST['id_komp']));
if(empty($name) or empty($type) or empty($cena) or mysql_result(mysql_query("SELECT count(id) from `runa` where `name` = '".$name."'"),0) >= 1){
echo'Ошибка.';
}else{
echo'Предмет добавлен!<br/>';
mysql_query("INSERT INTO `runa` set `name` = '".$name."', `stats` = '".$stata."', `type` = '".$type."', `url` = '".mysql_real_escape_string($_POST['url'])."', `cena` = '".$cena."', `id_komp` = '".$id."'");
}
}
echo'<form action="?add" method="post">Название предмета:<br/><input type="text" name="name"/><br/>';
$list = mysql_query("SELECT id,name from `runas` order by `id` asc");
while($l = mysql_fetch_assoc($list)){
echo'<input type="radio" name="id_komp" value="'.$l['id'].'"/> '.$l['name'].'<br/>';
}
echo'Тип:<br/>';

echo'<input type="radio" name="type" value="Вода"/> Вода<br/>';

echo'<input type="radio" name="type" value="Огонь"/> Огонь<br/>';

echo'<input type="radio" name="type" value="Земля"/> Земля<br/>';

echo'<input type="radio" name="type" value="Воздух"/> Воздух<br/>';



echo'
Цена:<br/><input type="number" name="cena" value="1"/> золотых<br/>
Ссылка на изображение: <br/><input type="text" name="url"/><br/>
Сила:<br/><input type="number" name="sila" value="0"/><br/>
Жизнь:<br/><input type="number" name="max_health" value="0"/><br/>
Ловкость:<br/><input type="number" name="lovk" value="0"/><br/>
Защита:<br/><input type="number" name="zash" value="0"/><br/>
Мана:<br/><input type="number" name="mana" value="0"/><br/>
<input type="submit" value="Добавить"/></form>';

echo "<div class='mini-line'></div>";
echo "<div class='player menuList'>";
echo "<li><a href='$admin_tools_link'><img src='/images/icon/arrow.png'>$admin_tools_title_name</a></li>";
echo "</div>";
}
require_once H.'core/foot.php';
?>