<?php
require_once '../core/system.php';
echo admin();
$header = 'Админ Панель!';
require_once '../core/head.php';
?>
<?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();


}
}
}
?>

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

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

            Уровень открытие в покупках : <br/><input type='text' name='level' size='3' maxlength='2' /><br/>
            Цена: <br/><input type='text' size='6' name='price' /><br/>
            <input type='submit' name='submit' class='btn' value='Добавить' />
        </form>
    </div>
    
    
    <?include "../core/foot.php";?>