<?
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';

$set['title']='Зоопарк'; // caaieiaie no?aieou
include_once '../../sys/inc/thead.php';

echo "<div class=\"aut\">Зоопарк</div><br />";
only_reg(); // только для зарегистрированы



if($_GET['mode']=='')
{
$q_id = mysql_query("SELECT COUNT(*) FROM `zoo` WHERE `id` = '$id2';");
{
$q = mysql_query("SELECT * FROM `zoo` WHERE `id` = '$id2';");
$main_menu = mysql_fetch_array($q);
echo "<form method=\"post\" action=\"add.php?mode=add\">\n";
echo "Кличка:<br/><input name=\"klichka\" class=\"form\" value=\"\" type=\"text\" /><br />\n";
echo "Порода:<br/><input name=\"poroda\" class=\"form\" value=\"\" type=\"text\" /><br />\n";
echo "Описание:<br/><input name=\"opis\" class=\"form\" value=\"\" type=\"text\" /><br />\n";
echo "Среда обитания:<br/><input name=\"sreda\" class=\"form\" value=\"\" type=\"text\" /><br />\n";
echo "Пол: <select class=\"form\" name=\"pol\"><br/>\n";
echo "<option value=\"1\">Мужской</option>\n";
echo "<option value=\"0\">Женский</option>\n";
echo "<option value=\"2\">Средний</option>\n";
echo "</select><br/>\n";
echo "<br /><input value=\"Добавить\" class=\"form\" type=\"submit\" />\n";
echo "</form>\n";
}
}
if($_GET['mode']=='add')
{
$q_c = mysql_query("SELECT COUNT(*) FROM `zoo` ORDER BY id ASC;");
$k_links=mysql_result($q_c, 0);
$id_d=$k_links+1;
$_POST['klichka']=mysql_escape_string($_POST['klichka']);
$_POST['poroda']=mysql_escape_string($_POST['poroda']);
$_POST['opis']=mysql_escape_string($_POST['opis']);
$_POST['sreda']=mysql_escape_string($_POST['sreda']);
$tim=time();
if (mysql_query("INSERT INTO `zoo` (id, klichka, time, poroda, opis, pol, id_c,sreda)
values('$id_d','".$_POST['klichka']."', '".$tim."', '".$_POST['poroda']."','".$_POST['opis']."','".$_POST['pol']."','".$user['id']."','".$_POST['sreda']."');"))
{
echo"Готово!<br />";
}
else
{
echo"Ошибка<br />";
}
}
echo "<a href=\"/city\">&#8592; VipSpaces-City</a><br />\n";
include_once '../../sys/inc/tfoot.php';
?>