Файл: user/anketa/setting.php
Строк: 537
<?php
require_once '../../sys/inc/start.php';
require_once '../../sys/inc/compress.php';
require_once '../../sys/inc/sess.php';
require_once '../../sys/inc/settings.php';
require_once '../../sys/inc/db_connect.php';
require_once '../../sys/inc/ipua.php';
require_once '../../sys/inc/fnc.php';
require_once '../../sys/inc/user.php';
only_reg();
$set['title'] = 'Основное';
require_once '../../sys/inc/thead.php';
if (isset($_POST['save'])) {
if (isset($_POST['sex']) && ($_POST['sex'] == 1 || $_POST['sex'] == 0)) {
$user['sex'] = intval($_POST['sex']);
mysql_query("UPDATE `user` SET `sex` = '$user[sex]' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err = 'Ошибка в поле (Пол)';
}
if (isset($_POST['ank_name']) && preg_match('#^([A-zА-я -]*)$#ui', $_POST['ank_name'])) {
$user['ank_name'] = $_POST['ank_name'];
mysql_query("UPDATE `user` SET `ank_name` = '" . mysql_real_escape_string($user['ank_name']) . "' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Неверный формат имени';
}
if (isset($_POST['ank_surname']) && preg_match('#^([A-zА-я -]*)$#ui', $_POST['ank_surname'])) {
$user['ank_surname'] = $_POST['ank_surname'];
mysql_query("UPDATE `user` SET `ank_surname` = '" . mysql_real_escape_string($user['ank_surname']) . "' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Неверный формат фамилии';
}
if (isset($_POST['ank_patronymic']) && preg_match('#^([A-zА-я -]*)$#ui', $_POST['ank_patronymic'])) {
$user['ank_patronymic'] = $_POST['ank_patronymic'];
mysql_query("UPDATE `user` SET `ank_patronymic` = '" . mysql_real_escape_string($user['ank_patronymic']) . "' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Неверный формат отчества';
}
if (isset($_POST['welcome']) && preg_match('#^([A-zА-я -]*)$#ui', $_POST['welcome'])) {
$user['welcome'] = $_POST['welcome'];
mysql_query("UPDATE `user` SET `welcome` = '" . mysql_real_escape_string($user['welcome']) . "' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Неверный формат приветствия';
}
if (isset($_POST['ank_d_r']) && (is_numeric($_POST['ank_d_r']) && $_POST['ank_d_r'] > 0 && $_POST['ank_d_r'] <= 31 || $_POST['ank_d_r'] == NULL)) {
$user['ank_d_r'] = $_POST['ank_d_r'];
if ($user['ank_d_r'] == null) {
$user['ank_d_r'] = 'null';
}
mysql_query("UPDATE `user` SET `ank_d_r` = $user[ank_d_r] WHERE `id` = '$user[id]' LIMIT 1");
if ($user['ank_d_r'] == 'null') {
$user['ank_d_r'] = NULL;
}
} else {
$err[] = 'Неверный формат дня рождения';
}
if (isset($_POST['ank_m_r']) && (is_numeric($_POST['ank_m_r']) && $_POST['ank_m_r'] > 0 && $_POST['ank_m_r'] <= 12 || $_POST['ank_m_r'] == NULL)) {
$user['ank_m_r'] = $_POST['ank_m_r'];
if ($user['ank_m_r'] == null) {
$user['ank_m_r'] = 'null';
}
mysql_query("UPDATE `user` SET `ank_m_r` = $user[ank_m_r] WHERE `id` = '$user[id]' LIMIT 1");
if ($user['ank_m_r'] == 'null') {
$user['ank_m_r'] = NULL;
}
} else {
$err[] = 'Неверный формат месяца рождения';
}
if (isset($_POST['ank_g_r']) && (is_numeric($_POST['ank_g_r']) && $_POST['ank_g_r'] > 0 && $_POST['ank_g_r'] <= date('Y') || $_POST['ank_g_r'] == NULL)) {
$user['ank_g_r'] = $_POST['ank_g_r'];
if ($user['ank_g_r'] == null) {
$user['ank_g_r'] = 'null';
}
mysql_query("UPDATE `user` SET `ank_g_r` = $user[ank_g_r] WHERE `id` = '$user[id]' LIMIT 1");
if ($user['ank_g_r'] == 'null') {
$user['ank_g_r'] = NULL;
}
} else {
$err[] = 'Неверный формат года рождения';
}
if (isset($_POST['ank_about_me']) && strlen2($_POST['ank_about_me']) <= 512) {
if (preg_match('#[^A-zА-я0-9 _-=+()*?.,]#ui', $_POST['ank_about_me'])) {
$err[] = 'В поле "О себе" используются запрещенные символы';
} else {
$user['ank_about_me'] = $_POST['ank_about_me'];
mysql_query("UPDATE `user` SET `ank_about_me` = '" . mysql_real_escape_string($user['ank_about_me']) . "' WHERE `id` = '$user[id]' LIMIT 1");
}
} else {
$err[] = 'Ошибка в поле (О себе)';
}
if (isset($_POST['region']) && preg_match('#^([A-zА-я -]*)$#ui', $_POST['region'])) {
$user['region'] = $_POST['region'];
mysql_query("UPDATE `user` SET `region` = '" . mysql_real_escape_string($user['region']) . "' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Неверный формат Области (Края)';
}
if (isset($_POST['country']) && preg_match('#^([A-zА-я -]*)$#ui', $_POST['country'])) {
$user['country'] = $_POST['country'];
mysql_query("UPDATE `user` SET `country` = '" . mysql_real_escape_string($user['country']) . "' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Неверный формат страны';
}
if (isset($_POST['ank_city']) && preg_match('#^([A-zА-я -]*)$#ui', $_POST['ank_city'])) {
$user['ank_city'] = $_POST['ank_city'];
mysql_query("UPDATE `user` SET `ank_city` = '" . mysql_real_escape_string($user['ank_city']) . "' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$err[] = 'Неверный формат названия города';
}
if (isset($_POST['ank_orientation']) && $_POST['ank_orientation'] == 0) {
$user['ank_orientation'] = 0;
mysql_query("UPDATE `user` SET `ank_orientation` = '" . ($user['ank_orientation'] = 0) . "' WHERE `id` = '$user[id]'");
}
if (isset($_POST['ank_orientation']) && $_POST['ank_orientation'] == 1) {
$user['ank_orientation'] = 1;
mysql_query("UPDATE `user` SET `ank_orientation` = '" . ($user['ank_orientation'] = 1) . "' WHERE `id` = '$user[id]'");
}
if (isset($_POST['ank_orientation']) && $_POST['ank_orientation'] == 2) {
$user['ank_orientation'] = 2;
mysql_query("UPDATE `user` SET `ank_orientation` = '" . ($user['ank_orientation'] = 2) . "' WHERE `id` = '$user[id]'");
}
if (isset($_POST['ank_orientation']) && $_POST['ank_orientation'] == 3) {
$user['ank_orientation'] = 3;
mysql_query("UPDATE `user` SET `ank_orientation` = '" . ($user['ank_orientation'] = 3) . "' WHERE `id` = '$user[id]'");
}
if (isset($_POST['ank_marriage']) && $_POST['ank_marriage'] == 0) {
$user['ank_marriage'] = 0;
mysql_query("UPDATE `user` SET `ank_marriage` = '" . ($user['ank_marriage'] = 0) . "' WHERE `id` = '$user[id]'");
}
if (isset($_POST['ank_marriage']) && $_POST['ank_marriage'] == 1) {
$user['ank_marriage'] = 1;
mysql_query("UPDATE `user` SET `ank_marriage` = '" . ($user['ank_marriage'] = 1) . "' WHERE `id` = '$user[id]'");
}
if (isset($_POST['ank_marriage']) && $_POST['ank_marriage'] == 2) {
$user['ank_marriage'] = 2;
mysql_query("UPDATE `user` SET `ank_marriage` = '" . ($user['ank_marriage'] = 2) . "' WHERE `id` = '$user[id]'");
}
if (isset($_POST['ank_marriage']) && $_POST['ank_marriage'] == 3) {
$user['ank_marriage'] = 3;
mysql_query("UPDATE `user` SET `ank_marriage` = '" . ($user['ank_marriage'] = 3) . "' WHERE `id` = '$user[id]'");
}
if (isset($_POST['ank_goal_dating8']) && $_POST['ank_goal_dating8'] == 1) {
$user['ank_goal_dating8'] = 1;
mysql_query("UPDATE `user` SET `ank_goal_dating8` = '1' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$user['ank_goal_dating8'] = 0;
mysql_query("UPDATE `user` SET `ank_goal_dating8` = '0' WHERE `id` = '$user[id]' LIMIT 1");
}
if (isset($_POST['ank_goal_dating7']) && $_POST['ank_goal_dating7'] == 1) {
$user['ank_goal_dating7'] = 1;
mysql_query("UPDATE `user` SET `ank_goal_dating7` = '1' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$user['ank_goal_dating7'] = 0;
mysql_query("UPDATE `user` SET `ank_goal_dating7` = '0' WHERE `id` = '$user[id]' LIMIT 1");
}
if (isset($_POST['ank_goal_dating6']) && $_POST['ank_goal_dating6'] == 1) {
$user['ank_goal_dating6'] = 1;
mysql_query("UPDATE `user` SET `ank_goal_dating6` = '1' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$user['ank_goal_dating6'] = 0;
mysql_query("UPDATE `user` SET `ank_goal_dating6` = '0' WHERE `id` = '$user[id]' LIMIT 1");
}
if (isset($_POST['ank_goal_dating5']) && $_POST['ank_goal_dating5'] == 1) {
$user['ank_goal_dating5'] = 1;
mysql_query("UPDATE `user` SET `ank_goal_dating5` = '1' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$user['ank_goal_dating5'] = 0;
mysql_query("UPDATE `user` SET `ank_goal_dating5` = '0' WHERE `id` = '$user[id]' LIMIT 1");
}
if (isset($_POST['ank_goal_dating4']) && $_POST['ank_goal_dating4'] == 1) {
$user['ank_goal_dating4'] = 1;
mysql_query("UPDATE `user` SET `ank_goal_dating4` = '1' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$user['ank_goal_dating4'] = 0;
mysql_query("UPDATE `user` SET `ank_goal_dating4` = '0' WHERE `id` = '$user[id]' LIMIT 1");
}
if (isset($_POST['ank_goal_dating3']) && $_POST['ank_goal_dating3'] == 1) {
$user['ank_goal_dating3'] = 1;
mysql_query("UPDATE `user` SET `ank_goal_dating3` = '1' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$user['ank_goal_dating3'] = 0;
mysql_query("UPDATE `user` SET `ank_goal_dating3` = '0' WHERE `id` = '$user[id]' LIMIT 1");
}
if (isset($_POST['ank_goal_dating2']) && $_POST['ank_goal_dating2'] == 1) {
$user['ank_goal_dating2'] = 1;
mysql_query("UPDATE `user` SET `ank_goal_dating2` = '1' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$user['ank_goal_dating2'] = 0;
mysql_query("UPDATE `user` SET `ank_goal_dating2` = '0' WHERE `id` = '$user[id]' LIMIT 1");
}
if (isset($_POST['ank_goal_dating']) && $_POST['ank_goal_dating'] == 1) {
$user['ank_goal_dating'] = 1;
mysql_query("UPDATE `user` SET `ank_goal_dating` = '1' WHERE `id` = '$user[id]' LIMIT 1");
} else {
$user['ank_goal_dating'] = 0;
mysql_query("UPDATE `user` SET `ank_goal_dating` = '0' WHERE `id` = '$user[id]' LIMIT 1");
}
if (!isset($err)) {
msg('Изменения успешно приняты');
header("Refresh: 1; url=/user/anketa/setting.php");
echo "<a href = '/forum/'><div class = 'foot'><img src = '/style/icons/left.png' /> Назад</div></a>";
require_once '../../sys/inc/tfoot.php';
}
}
err();
aut();
echo "<div class = 'tabs'>";
echo "<a class = 'active'>Основное</a>";
echo "<a href = 'character_type.php'>Типаж</a>";
echo "<a href = 'interest.php'>Интересы</a>";
echo "<a href = 'dop.php'>Дополнительно</a>";
echo "<a href = 'connected.php'>Контакты</a>";
echo "</div>";
echo "<form method='post' class='tabcontent' action='?$passgen'>n";
echo "<div class='f8'>";
echo "Фамилия:<br /><input type='text' name='ank_surname' value='" . output_text($user['ank_surname'], false) . "' maxlength='32' /><br />n";
echo "Имя:<br /><input type='text' name='ank_name' value='" . output_text($user['ank_name'], false) . "' maxlength='32' /><br />n";
echo "Очество:<br /><input type='text' name='ank_patronymic' value='" . output_text($user['ank_patronymic'], false) . "' maxlength='32' /><br />n";
echo "</div><div class='f8'>Приветствие: (150 симв.)<br />";
echo "<input type='text' name='welcome' value='" . output_text($user['welcome'], false) . "' maxlength='150' /><br /></div>";
echo "<div class='f8'>";
echo "Страна: *<br/><input type='text' name='country' value='$user[country]' maxlength='32' /><br />";
echo "Область (Край):<br/><input type='text' name='region' value='$user[region]' maxlength='32' /><br />";
echo "Город:<br/><input type='text' name='ank_city' value='$user[ank_city]' maxlength='32' /><br />";
echo "* Страну можно указать названием как русским так и английским. Внимательно посмотрите правельность написания вашей страны, от этого зависит вывод флагов фашей страны.</div>";
echo "<div class='f8'><b>Цель знакомств:</b><br />";
echo "<label><input type='checkbox' name='ank_goal_dating'" . ($user['ank_goal_dating'] == 1 ? ' checked="checked"' : null) . " value='1' /> Дружба и общение</label><br />n";
echo "<label><input type='checkbox' name='ank_goal_dating2'" . ($user['ank_goal_dating2'] == 1 ? ' checked="checked"' : null) . " value='1' /> Флирт, СМС-переписка</label><br />n";
echo "<label><input type='checkbox' name='ank_goal_dating3'" . ($user['ank_goal_dating3'] == 1 ? ' checked="checked"' : null) . " value='1' /> Любовь, отношения</label><br />n";
echo "<label><input type='checkbox' name='ank_goal_dating4'" . ($user['ank_goal_dating4'] == 1 ? ' checked="checked"' : null) . " value='1' /> Брак, создание семьи</label><br />n";
echo "<label><input type='checkbox' name='ank_goal_dating5'" . ($user['ank_goal_dating5'] == 1 ? ' checked="checked"' : null) . " value='1' /> Виртуальный секс</label><br />n";
echo "<label><input type='checkbox' name='ank_goal_dating6'" . ($user['ank_goal_dating6'] == 1 ? ' checked="checked"' : null) . " value='1' /> Секс в реале</label><br />n";
echo "<label><input type='checkbox' name='ank_goal_dating7'" . ($user['ank_goal_dating7'] == 1 ? ' checked="checked"' : null) . " value='1' /> Ищу спонсора</label><br />n";
echo "<label><input type='checkbox' name='ank_goal_dating8'" . ($user['ank_goal_dating8'] == 1 ? ' checked="checked"' : null) . " value='1' /> Стану спонсором</label><br /></div>n";
echo "<div class='f8'><b>Состою в браке:</b><br />";
echo " <input name='ank_marriage' type='radio' " . ($user['ank_marriage'] == 0 ? ' checked="checked"' : null) . " value='0' /> Не скажу!<br />";
echo " <input name='ank_marriage' type='radio' " . ($user['ank_marriage'] == 1 ? ' checked="checked"' : null) . " value='1' /> Нет<br />";
echo " <input name='ank_marriage' type='radio' " . ($user['ank_marriage'] == 2 ? ' checked="checked"' : null) . " value='2' /> Да<br />";
echo " <input name='ank_marriage' type='radio' " . ($user['ank_marriage'] == 3 ? ' checked="checked"' : null) . " value='3' /> Уже нет<br />";
echo "</div>";
echo "<div class='f8'>";
echo "<b>Ориентация:</b>";
echo "<br /> <input name='ank_orientation' type='radio' " . ($user['ank_orientation'] == 0 ? ' checked="checked"' : null) . " value='0' /> Не скажу!<br />";
echo " <input name='ank_orientation' type='radio' " . ($user['ank_orientation'] == 1 ? ' checked="checked"' : null) . " value='1' /> Гетеро<br/>";
echo " <input name='ank_orientation' type='radio' " . ($user['ank_orientation'] == 2 ? ' checked="checked"' : null) . " value='2' /> Гей/лесби.<br/>";
echo " <input name='ank_orientation' type='radio' " . ($user['ank_orientation'] == 3 ? ' checked="checked"' : null) . " value='3' /> Би<br/>";
echo "</div><div class = 'f8'>";
echo "Пол<br />";
echo "<select name = 'sex'>";
echo "<option value = '1'" . ($user['sex'] == 1 ? " selected = 'selected'" : null) . ">Мужской</option>";
echo "<option value = '0'" . ($user['sex'] == 2 ? " selected = 'selected'" : null) . ">Женский</option>";
echo "</select><br />";
echo "Дата рождения: дд/мм/гггг<br/>";
echo "<input type = 'text' name = 'ank_d_r' placeholder = '01' value = '$user[ank_d_r]' size = '2' maxlength = '2' />";
echo "<input type = 'text' name = 'ank_m_r' placeholder = '01' value = '$user[ank_m_r]' size = '2' maxlength = '2' />";
echo "<input type = 'text' name = 'ank_g_r' placeholder = '1990' value = '$user[ank_g_r]' size = '4' maxlength = '4' /><br />";
echo "О себе<br/>";
echo "<textarea type = 'text' name = 'ank_about_me' value = '$user[ank_about_me]' maxlength = '512'>$user[ank_about_me]</textarea>";
echo "</div><div class = 'f8'>";
echo "<button name = 'save' class = 'btn'>";
echo "<img src = '/style/icons/ok.png' /> Сохранить изменения";
echo "</button></div></form><div class='foot'>";
echo "<a href='/user/anketa/?name=" . $user['nick'] . "'>Посмотреть анкету</a>";
echo "</div>n";
require_once '../../sys/inc/tfoot.php';