<?
	// Dcms-Fiera
	// http://dcms-help.ru
	// ShaMan

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['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['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['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['xarakter']) && strlen2(esc(stripcslashes(htmlspecialchars($_POST['xarakter']))))<=512)
{
$user['xarakter']=esc(stripcslashes(htmlspecialchars($_POST['xarakter'])));
mysql_query("UPDATE `user` SET `xarakter` = '".my_esc($user['xarakter'])."' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err='Неверный формат Характера!';
#################
if (!isset($err))msg('Изменения успешно приняты');

}
err();
aut();
//(ENK) by wap-mast.ru Все права защищены!
//Барыжничество запрещино, все вопросы на форум wap-mast.ru
echo "<form method='post' action='?$passgen'>";
##################################	
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 "Цвет глаз:<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<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 /><input type='text' name='xarakter' value='$user[xarakter]' maxlength='512' /><br />";
##################################
echo "<input type='submit' name='save' value='Сохранить' /></form>";
echo "<div class='foot'>";
echo "&raquo;<a href='/ank.php'>Назад в анкету</a><br />\n";
echo "</div>";

if(isset($_SESSION['refer']) && $_SESSION['refer']!=NULL && otkuda($_SESSION['refer']))
echo "&laquo;<a href='$_SESSION[refer]'>".otkuda($_SESSION['refer'])."</a><br />\n";

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