<?
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(); // только для зарегистрированы



$id_zv=intval($_GET['id_zv']);
if ($id_zv=='')
{
header ("Location: index.php?".SID."");
exit;
}
if($_GET['mode']=='')
{
$q = mysql_query("SELECT * FROM `zoo` WHERE `id`='$id_zv';");
while ($m = mysql_fetch_array($q))
{
echo "<form method=\"post\" action=\"set.php?mode=set_ok&amp;id_zv=$id_zv\">\n";
echo "Кличка:<br/><input name=\"klichka\" class=\"form\" value=\"".$m['klichka']."\" type=\"text\" /><br />\n";
echo "Порода:<br/><input name=\"poroda\" class=\"form\" value=\"".$m['poroda']."\" type=\"text\" /><br />\n";
echo "Описание:<br/><input name=\"opis\" class=\"form\" value=\"".$m['opis']."\" type=\"text\" /><br />\n";
echo "Среда обитания:<br/><input name=\"sreda\" class=\"form\" value=\"".$m['sreda']."\" 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']=='set_ok')
{
$id_zv=intval($_GET['id_zv']);
$id_zv=htmlspecialchars(stripslashes(trim($id_zv)));
$_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']);
$_POST['pol']=mysql_escape_string($_POST['pol']);
if (mysql_query("UPDATE `zoo` SET `klichka` = '".$_POST['klichka']."', `poroda` = '".$_POST['poroda']."', `opis` = '".$_POST['opis']."',`sreda`='".$_POST['sreda']."',`pol`='".$_POST['pol']."' WHERE `id` = '$id_zv';"))
{
echo"Ваш зверь успешно отредактирован!<br />";
}
else
{
echo"Ошибко<br />";
}
}
echo"<a href='index.php?'>ZOOпapк</a><br />";
echo "<a href=\"/city\">&#8592; VipSpaces-City</a><br />\n";

include_once '../../sys/inc/tfoot.php';


?>