<?php
require_once '../core/system.php';
echo admin();
$header = 'Админ Панель!';
include_once '../core/head.php';

if(isset($_POST['submit'])){
    if(!empty($_POST['pets']) && !empty($_POST['petsname']) && !empty($_POST['silapets']) && !empty($_POST['price']) && !empty($_POST['level'])){
        $pets = trim(mysql_real_escape_string(strip_tags($_POST['pets'])));
        $petsname = trim(mysql_real_escape_string(strip_tags($_POST['petsname'])));
        $silapets = trim(mysql_real_escape_string(strip_tags($_POST['silapets'])));
         $vinoslpets = trim(mysql_real_escape_string(strip_tags($_POST['vinoslpets'])));
          $healthpets = trim(mysql_real_escape_string(strip_tags($_POST['healthpets'])));
        $level = trim(mysql_real_escape_string(strip_tags($_POST['level'])));
        $price = trim(mysql_real_escape_string(strip_tags($_POST['price'])));
        $sql1 = mysql_query("SELECT pets,id FROM `pets` ORDER BY `id`") or die(mysql_error());
        $addavt2 = mysql_fetch_assoc($sql1);
    if($pets == $addavt2['pets']){
        echo "<div class='err'>Такой питомец уже есть<br/><a href='index.php?addavto' style='color:#fff;'>Назад</a></div>";
    }else{
        mysql_query("INSERT INTO `pets`(pets,petsname,silapets,vinoslpets,healthpets,price,level) VALUES('$pets','$petsname','$silapets','$vinoslpets','$healthpets','$price','$level')") or die(mysql_error());
        echo "<meta http-equiv='refresh' content='0; URL=index.php?addavto' />";
        exit();


}
}
}

echo "<div class='menu'>
        <form class='player' action='addpets.php' method='post'>
            Путь к питомцу (IMG) : <br/><input type='text' name='pets' value='images/'/><br/>
            Имя питомца : <br/><input type='text' name='petsname' /><br/>
            Cила : <br/><input type='text' name='silapets' size='4' /><br/>
                        Выносливость : <br/><input type='text' name='vinoslpets' size='4' /><br/>

            Здоровье : <br/><input type='text' name='healthpets' size='3' /><br/>

            Уровень открытия в покупках : <br/><input type='text' name='level' size='3' maxlength='2' /><br/>
            Цена: <br/><input type='text' name='price' /><br/>
            <input type='submit' name='submit' class='btn' value='Добавить' />
        </form>
    </div>
<div class='mini-line'></div>
<div class='player menuList'>
<li><a href='$admin_tools_link'><img src='/images/icon/arrow.png' />$admin_tools_title_name</a></li></div>
";    
    
include_once '../core/foot.php';
?>