<?
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';

only_reg();
$set['title']='Редактор дополнительной анкеты';
include_once 'sys/inc/thead.php';
title();
if (isset($_POST['save'])){

if (isset($_POST['orient']) && ($_POST['orient']==0 || $_POST['orient']==1 || $_POST['orient']==2 || $_POST['orient']==3))
{
$user['orient']=intval($_POST['orient']);
mysql_query("UPDATE `user` SET `orient` = '$user[orient]' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[]='Ошибка в поле "Ориентация"';
if (isset($_POST['celzn']) && ($_POST['celzn']==0 || $_POST['celzn']==1 || $_POST['celzn']==2 || $_POST['celzn']==3 || $_POST['celzn']==4 || $_POST['celzn']==5 || $_POST['celzn']==6 || $_POST['celzn']==7|| $_POST['celzn']==8))
{
$user['celzn']=intval($_POST['celzn']);
mysql_query("UPDATE `user` SET `celzn` = '$user[celzn]' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[]='Ошибка в поле "Цель знакомства"';
if (isset($_POST['teloslo']) && ($_POST['teloslo']==0 || $_POST['teloslo']==1 || $_POST['teloslo']==2 || $_POST['teloslo']==3 || $_POST['teloslo']==4 || $_POST['teloslo']==5 || $_POST['teloslo']==6))
{
$user['teloslo']=intval($_POST['teloslo']);
mysql_query("UPDATE `user` SET `teloslo` = '$user[teloslo]' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[]='Ошибка в поле "Телосложение"';
if (isset($_POST['glaza']) && ($_POST['glaza']==0 || $_POST['glaza']==1 || $_POST['glaza']==2 || $_POST['glaza']==3 || $_POST['glaza']==4))
{
$user['glaza']=intval($_POST['glaza']);
mysql_query("UPDATE `user` SET `glaza` = '$user[glaza]' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[]='Неверный цвет глаз';
if (isset($_POST['volos']) && ($_POST['volos']==0 || $_POST['volos']==1 || $_POST['volos']==2 || $_POST['volos']==3 || $_POST['volos']==4 || $_POST['volos']==5 || $_POST['volos']==6 || $_POST['volos']==7))
{
$user['volos']=intval($_POST['volos']);
mysql_query("UPDATE `user` SET `volos` = '$user[volos]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err[]='Неверный цвет волос';
if (isset($_POST['ves']) && (is_numeric($_POST['ves']) && strlen($_POST['ves'])<=3 || $_POST['ves']==NULL))
{
$user['ves']=$_POST['ves'];
mysql_query("UPDATE `user` SET `ves` = '$user[ves]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err[]='Неверный вес';
if (isset($_POST['rost']) && (is_numeric($_POST['rost']) && strlen($_POST['rost'])<=3 || $_POST['rost']==NULL))
{
$user['rost']=$_POST['rost'];
mysql_query("UPDATE `user` SET `rost` = '$user[rost]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err[]='Неверный рост';
if (isset($_POST['smoking']) && ($_POST['smoking']==0 || $_POST['smoking']==1 || $_POST['smoking']==2 || $_POST['smoking']==3 || $_POST['smoking']==4))
{
$user['smoking']=intval($_POST['smoking']);
mysql_query("UPDATE `user` SET `smoking` = '$user[smoking]' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[]='Ошибка в поле "Курение"';
if (isset($_POST['alcogol']) && ($_POST['alcogol']==0 || $_POST['alcogol']==1 || $_POST['alcogol']==2 || $_POST['alcogol']==3))
{
$user['alcogol']=intval($_POST['alcogol']);
mysql_query("UPDATE `user` SET `alcogol` = '$user[alcogol]' WHERE `id` = '$user[id]' LIMIT 1");
}else $err[]='Ошибка в поле "Телосложение"';
if (!isset($err))msg('Изменения успешно приняты');
}
err();
aut();

echo "<form method='post' action='?$passgen'>\n";
echo "<div class='menu'>";
echo "Цель знакомства:<br />\n<select name='celzn'>\n";
echo "<option value='0'".($user['celzn']==0?" selected='selected'":null).">Не указано</option>\n";
echo "<option value='1'".($user['celzn']==1?" selected='selected'":null).">Дружба,общение</option>\n";
echo "<option value='2'".($user['celzn']==2?" selected='selected'":null).">Флирт, СМС-переписка</option>\n";
echo "<option value='3'".($user['celzn']==3?" selected='selected'":null).">Любовь, отношения</option>\n";
echo "<option value='4'".($user['celzn']==4?" selected='selected'":null).">Брак, создание семьи</option>\n";
echo "<option value='5'".($user['celzn']==5?" selected='selected'":null).">Виртуальный секс</option>\n";
echo "<option value='6'".($user['celzn']==6?" selected='selected'":null).">Секс в реале</option>\n";
echo "<option value='7'".($user['celzn']==7?" selected='selected'":null).">Ищу спонсора</option>\n";
echo "<option value='8'".($user['celzn']==8?" selected='selected'":null).">Стану спонсором</option>\n";
echo "</select><br />\n";
echo'<hr>';
echo "Ориентация:<br />\n<select name='orient'>\n";
echo "<option value='0'".($user['orient']==0?" selected='selected'":null).">Не указано</option>\n";
echo "<option value='1'".($user['orient']==1?" selected='selected'":null).">Гетеро</option>\n";
echo "<option value='2'".($user['orient']==2?" selected='selected'":null).">Гей/лесби</option>\n";
echo "<option value='3'".($user['orient']==3?" selected='selected'":null).">Би</option>\n";
echo "</select><br />\n";
echo "Телосложение:<br />\n<select name='teloslo'>\n";
echo "<option value='0'".($user['teloslo']==0?" selected='selected'":null).">Не указано</option>\n";
echo "<option value='1'".($user['teloslo']==1?" selected='selected'":null).">Обычное</option>\n";
echo "<option value='2'".($user['teloslo']==2?" selected='selected'":null).">худощавое</option>\n";
echo "<option value='3'".($user['teloslo']==3?" selected='selected'":null).">спортивное</option>\n";
echo "<option value='4'".($user['teloslo']==4?" selected='selected'":null).">мускулистое</option>\n";
echo "<option value='5'".($user['teloslo']==5?" selected='selected'":null).">плотное</option>\n";
echo "<option value='6'".($user['teloslo']==6?" selected='selected'":null).">полное</option>\n";
echo "</select><br />\n";
echo "Глаза:<br />\n<select name='glaza'>\n";
echo "<option value='0'".($user['glaza']==0?" selected='selected'":null).">Не указано</option>\n";
echo "<option value='1'".($user['glaza']==1?" selected='selected'":null).">Серые</option>\n";
echo "<option value='2'".($user['glaza']==2?" selected='selected'":null).">Голубые</option>\n";
echo "<option value='3'".($user['glaza']==3?" selected='selected'":null).">Карие(черные)</option>\n";
echo "<option value='4'".($user['glaza']==4?" selected='selected'":null).">Зеленые</option>\n";
echo "</select><br />\n";
echo "Волосы:<br />\n<select name='volos'>\n";
echo "<option value='0'".($user['volos']==0?" selected='selected'":null).">Не указано</option>\n";
echo "<option value='1'".($user['volos']==1?" selected='selected'":null).">Светлые</option>\n";
echo "<option value='2'".($user['volos']==2?" selected='selected'":null).">Темные</option>\n";
echo "<option value='3'".($user['volos']==3?" selected='selected'":null).">Рыжие</option>\n";
echo "<option value='4'".($user['volos']==4?" selected='selected'":null).">Мелированные</option>\n";
echo "<option value='5'".($user['volos']==5?" selected='selected'":null).">Ярко окрашенные</option>\n";
echo "<option value='6'".($user['volos']==6?" selected='selected'":null).">Седые</option>\n";
echo "<option value='7'".($user['volos']==7?" selected='selected'":null).">Голова бритая наголо</option>\n";
echo "</select><br />\n";
echo "Рост:<br />\n<input type='text' name='rost' value='$user[rost]' maxlength='3' /><br />\n";
echo "Вес:<br />\n<input type='text' name='ves' value='$user[ves]' maxlength='3' /><br />\n";
echo'<hr>';
echo "Курение:<br />\n<select name='smoking'>\n";
echo "<option value='0'".($user['smoking']==0?" selected='selected'":null).">Не указано</option>\n";
echo "<option value='1'".($user['smoking']==1?" selected='selected'":null).">не курю</option>\n";
echo "<option value='2'".($user['smoking']==2?" selected='selected'":null).">курю,но редко</option>\n";
echo "<option value='3'".($user['smoking']==3?" selected='selected'":null).">курю,как паровоз</option>\n";
echo "<option value='4'".($user['smoking']==4?" selected='selected'":null).">бросаю</option>\n";
echo "</select><br />\n";
echo "Алкоголь:<br />\n<select name='alcogol'>\n";
echo "<option value='0'".($user['alcogol']==0?" selected='selected'":null).">Не указано</option>\n";
echo "<option value='1'".($user['alcogol']==1?" selected='selected'":null).">не пью</option>\n";
echo "<option value='2'".($user['alcogol']==2?" selected='selected'":null).">только по праздникам,и в хорошей компании</option>\n";
echo "<option value='3'".($user['alcogol']==3?" selected='selected'":null).">люблю выпить</option>\n";
echo "</select><br />\n";
echo "<input type='submit' name='save' value='Сохранить' />\n";
echo "</form>\n";
echo '</div>';
echo "<a href='/anketa.php'>На главную анкету</a>";
include_once 'sys/inc/tfoot.php';
?>