Просмотр файла pages/edit.php

Размер файла: 19.23Kb
<?php
// by Jahak
include '../system/inc/connect.php';
include '../system/inc/core.php';
$title = $edit['title'];
include '../system/inc/header.php';

if(!$user){
	header('Location: /index.php');
}

$ank['id'] = intval($_GET['uid']);
if (!$ank['id']) {
	$ank['id'] = $user['id'];
}
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id`='$ank[id]'"));

switch ($_GET['act'])
{
	// Контакты
	case 'kont':
	echo '<div class="menu"><a href="?">'.$edit['osnovnoe'].'</a> | <a href="?act=interes">'.$edit['interes'].'</a> | <a href="?act=znakom">'.$edit['znakom'].'</a> | <a href="?act=tipaz">'.$edit['tipaz'].'</a> | <a href="?act=dopoln">'.$edit['dopoln'].'</a> | '.$edit['kont'].'</div>';
	if(isset($_POST['submit'])){
		$email = input($_POST['email']);
		if (!$email) {
				$err = $edit['full_mail'];
			}
			if(!isset($err)){
			mysql_query("UPDATE `user` SET
			`email` = '$email'
			WHERE `id` = '$ank[id]'
			");
			mysql_query("OPTIMIZE TABLE `user`");
			echo '<div class="messages">'.$edit['been_saved'].'</div>';
			header("refresh:1;url=edit?act=kont");
		}
		if (isset($err)) {
				echo '<div class="err">' . $err . '</div>';
			}
		}
	echo '<div class="menu"><form name="form" action="?act=kont&amp;knt" method="post">
<b>E-mail:</b><br /><input name="email" type="text" maxlength="50" value="' . output($ank['email']) . '" /><hr noshade size="1">
<!-- <b>Мобильный телефон:</b><br /><input name="" type="text" maxlength="50" value="' . output($ank['']) . '" /><hr noshade size="1">
<b>Дополнительный телефон:</b><br /><input name="" type="text" maxlength="50" value="' . output($ank['']) . '" /><hr noshade size="1">
<b>Skype:</b><br /><input name="" type="text" maxlength="50" value="' . output($ank['']) . '" /><hr noshade size="1">
<b>Личный сайт:</b><br /><input name="" type="text" maxlength="50" value="' . output($ank['']) . '" /><hr noshade size="1"> -->
<input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
	break;
	// Дополнительно
	case 'dopoln':
	echo '<div class="menu"><a href="?">'.$edit['osnovnoe'].'</a> | <a href="?act=interes">'.$edit['interes'].'</a> | <a href="?act=znakom">'.$edit['znakom'].'</a> | <a href="?act=tipaz">'.$edit['tipaz'].'</a> | '.$edit['dopoln'].' | <a href="?act=kont">'.$edit['kont'].'</a></div>';
	if(isset($_POST['submit'])){
		$what_i_do = num($_POST['what_i_do']);
		$profession = input($_POST['profession']);
		$smoke = num($_POST['smoke']);

		mysql_query("UPDATE `user` SET
		`what_i_do` = '$what_i_do',
		`profession` = '$profession',
		`smoke` = '$smoke'
		WHERE `id` = '$ank[id]'
		");
		mysql_query("OPTIMIZE TABLE `user`");
		echo '<div class="messages">'.$edit['been_saved'].'</div>';
		header("refresh:1;url=edit?act=dopoln");
	}
	echo '<div class="menu"><form name="form" action="?act=dopoln&amp;dpn" method="post">';
	echo '<b>Чем я занимаюсь:</b><br /><input name="what_i_do" type="radio" value="1"' . ($ank["what_i_do"] == 1 ? ' checked' : '') . '/>&nbsp;Учусь в школе<br />
<input name="what_i_do" type="radio" value="2"' . ($ank["what_i_do"] == 2 ? ' checked' : '') . '/>&nbsp;Учусь в колледже/лицее<br />
<input name="what_i_do" type="radio" value="3"' . ($ank["what_i_do"] == 3 ? ' checked' : '') . '/>&nbsp;Учусь в ВУЗе<br />
<input name="what_i_do" type="radio" value="4"' . ($ank["what_i_do"] == 4 ? ' checked' : '') . '/>&nbsp;Учусь в военном училище<br />
<input name="what_i_do" type="radio" value="5"' . ($ank["what_i_do"] == 5 ? ' checked' : '') . '/>&nbsp;Служу в армии<br />
<input name="what_i_do" type="radio" value="6"' . ($ank["what_i_do"] == 6 ? ' checked' : '') . '/>&nbsp;Работаю<br />
<input name="what_i_do" type="radio" value="7"' . ($ank["what_i_do"] == 6 ? ' checked' : '') . '/>&nbsp;Не работаю<br />
<input name="what_i_do" type="radio" value="8"' . ($ank["what_i_do"] == 6 ? ' checked' : '') . '/>&nbsp;Сижу на зоне<br />
<input name="what_i_do" type="radio" value="0"' . ($ank["what_i_do"] == 0 ? ' checked' : '') . '/>&nbsp;Не отображать<hr noshade size="1">
<b>Профессия:</b><br /><input name="profession" type="text" size="22" maxlength="77" value="' . output($ank['profession']) . '" /><hr noshade size="1">
<b>Курю ли я:</b><br /><input name="smoke" type="radio" value="1"' . ($ank["smoke"] == 1 ? ' checked' : '') . '/>&nbsp;Не курю<br />
<input name="smoke" type="radio" value="2"' . ($ank["smoke"] == 2 ? ' checked' : '') . '/>&nbsp;Курю<br />
<input name="smoke" type="radio" value="3"' . ($ank["smoke"] == 3 ? ' checked' : '') . '/>&nbsp;Иногда<br />
<input name="smoke" type="radio" value="4"' . ($ank["smoke"] == 4 ? ' checked' : '') . '/>&nbsp;Бросаю<br />
<input name="smoke" type="radio" value="0"' . ($ank["smoke"] == 0 ? ' checked' : '') . '/>&nbsp;Не отображать<br /><hr noshade size="1">';
	echo '<input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
	break;
	// Типаж
	case 'tipaz':
	echo '<div class="menu"><a href="?">'.$edit['osnovnoe'].'</a> | <a href="?act=interes">'.$edit['interes'].'</a> | <a href="?act=znakom">'.$edit['znakom'].'</a> | '.$edit['tipaz'].' | <a href="?act=dopoln">'.$edit['dopoln'].'</a> | <a href="?act=kont">'.$edit['kont'].'</a></div>';
	if(isset($_POST['submit'])){
		$growth = num($_POST['growth']);
		$weight = num($_POST['weight']);
		$eyes = input($_POST['eyes']);
		$hair_color = input($_POST['hair_color']);
		$physique = num($_POST['physique']);
		$character = input($_POST['character']);
		$na_tele = num($_POST['na_tele']);
		$na_tele1 = num($_POST['na_tele1']);

		mysql_query("UPDATE `user` SET
		`growth` = '$growth',
		`weight` = '$weight',
		`eyes` = '$eyes',
		`hair_color` = '$hair_color',
		`physique` = '$physique',
		`character` = '$character',
		`na_tele` = '$na_tele',
		`na_tele1` = '$na_tele1'
		WHERE `id` = '$ank[id]'
		");
		mysql_query("OPTIMIZE TABLE `user`");
		echo '<div class="messages">'.$edit['been_saved'].'</div>';
		header( "refresh:1;url=edit?act=tipaz" );
	}
	echo '<div class="menu"><form name="form" action="?act=tipaz&amp;tpz" method="post">
<b>Рост:</b><br /><input name="growth" type="text" size="3" maxlength="3" value="' . output($ank['growth']) . '" /><hr noshade size="1">
<b>Вес:</b><br /><input name="weight" type="text" size="3" maxlength="3" value="' . output($ank['weight']) . '" /><hr noshade size="1">
<b>Цвет глаз:</b><br /><input name="eyes" type="text" maxlength="50" value="' . output($ank['eyes']) . '" /><hr noshade size="1">
<b>Цвет волос:</b><br /><input name="hair_color" type="text" maxlength="50" value="' . output($ank['hair_color']) . '" /><hr noshade size="1">
<b>Телосложение:</b><br /><input name="physique" type="radio" value="1"' . ($ank["physique"] == 1 ? ' checked' : '') . '/>&nbsp;Обычное<br />
<input name="physique" type="radio" value="2"' . ($ank["physique"] == 2 ? ' checked' : '') . '/>&nbsp;Худощавое<br />
<input name="physique" type="radio" value="3"' . ($ank["physique"] == 3 ? ' checked' : '') . '/>&nbsp;Спортивное<br />
<input name="physique" type="radio" value="4"' . ($ank["physique"] == 4 ? ' checked' : '') . '/>&nbsp;Мускулистое<br />
<input name="physique" type="radio" value="5"' . ($ank["physique"] == 5 ? ' checked' : '') . '/>&nbsp;Плотное<br />
<input name="physique" type="radio" value="5"' . ($ank["physique"] == 6 ? ' checked' : '') . '/>&nbsp;Полное<br />
<input name="physique" type="radio" value="0"' . ($ank["physique"] == 0 ? ' checked' : '') . '/>&nbsp;Не отображать<hr noshade size="1">
<b>Характер:</b><br /><input name="character" type="text" maxlength="50" value="' . output($ank['character']) . '" /><hr noshade size="1">
<b>На теле есть:</b><br /><input name="na_tele" type="checkbox" value="1"' . ($ank["na_tele"] == 1 ? ' checked' : '') . '/>&nbsp;Пирсинг&nbsp;&nbsp;
<input name="na_tele1" type="checkbox" value="1"' . ($ank["na_tele1"] == 1 ? ' checked' : '') . '/>&nbsp;Татуировки<hr noshade size="1">
<input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
	break;
	// Знакомства
	case 'znakom':
	echo '<div class="menu"><a href="?">'.$edit['osnovnoe'].'</a> | <a href="?act=interes">'.$edit['interes'].'</a> | '.$edit['znakom'].' | <a href="?act=tipaz">'.$edit['tipaz'].'</a> | <a href="?act=dopoln">'.$edit['dopoln'].'</a> | <a href="?act=kont">'.$edit['kont'].'</a></div>';
	if(isset($_POST['submit'])){
		$orientation = num($_POST['orientation']);
		$dating1 = num($_POST['dating1']);
		$dating2 = num($_POST['dating2']);
		$dating3 = num($_POST['dating3']);
		$dating4 = num($_POST['dating4']);
		$dating5 = num($_POST['dating5']);
		$dating6 = num($_POST['dating6']);
		$dating7 = num($_POST['dating7']);
		$dating8 = num($_POST['dating8']);
		$family = num($_POST['family']);
		$opartnere = input($_POST['opartnere']);

		mysql_query("UPDATE `user` SET
		`orientation` = '$orientation',
		`dating1` = '$dating1',
		`dating2` = '$dating2',
		`dating3` = '$dating3',
		`dating4` = '$dating4',
		`dating5` = '$dating5',
		`dating6` = '$dating6',
		`dating7` = '$dating7',
		`dating8` = '$dating8',
		`family` = '$family',
		`opartnere` = '$opartnere'
		WHERE `id` = '$ank[id]'
		");
		mysql_query("OPTIMIZE TABLE `user`");
		echo '<div class="messages">'.$edit['been_saved'].'</div>';
		header( "refresh:1;url=edit?act=znakom" );
	}
	echo '<div class="menu"><form name="form" action="?act=znakom&amp;znm" method="post">
<b>Ориентация:</b><br /><select name="orientation">
<option value="0">Не выбрано</option>';
		if ($ank['sex'] == 0) {
			echo '<option value="1" ' . ($ank["orientation"] == 1 ? ' selected="selected"' : '') . '>Гетеро</option>
<option value="2" ' . ($ank["orientation"] == 2 ? ' selected="selected"' : '') . '>Гей</option>
<option value="3" ' . ($ank["orientation"] == 3 ? ' selected="selected"' : '') . '>Би</option></select>';
		} else {
			echo '<option value="1" ' . ($ank["orientation"] == 1 ? ' selected="selected"' : '') . '>Гетеро</option>
<option value="2" ' . ($ank["orientation"] == 2 ? ' selected="selected"' : '') . '>Лесби</option>
<option value="3" ' . ($ank["orientation"] == 3 ? ' selected="selected"' : '') . '>Би</option></select>';
		}
		echo '<hr noshade size="1">
<b>Цель '.$edit['znakom'].':</b><br />
<input name="dating1" type="checkbox" value="1"' . ($ank["dating1"] == 1 ? ' checked' : '') . '/>&nbsp;Дружба и общение<br />
<input name="dating2" type="checkbox" value="1"' . ($ank["dating2"] == 1 ? ' checked' : '') . '/>&nbsp;Флирт, СМС-переписка<br />
<input name="dating3" type="checkbox" value="1"' . ($ank["dating3"] == 1 ? ' checked' : '') . '/>&nbsp;Любовь, отношения<br />
<input name="dating4" type="checkbox" value="1"' . ($ank["dating4"] == 1 ? ' checked' : '') . '/>&nbsp;Брак, создание семьи<br />
<input name="dating5" type="checkbox" value="1"' . ($ank["dating5"] == 1 ? ' checked' : '') . '/>&nbsp;Виртуальный секс<br />
<input name="dating6" type="checkbox" value="1"' . ($ank["dating6"] == 1 ? ' checked' : '') . '/>&nbsp;Секс в реале<br />
<input name="dating7" type="checkbox" value="1"' . ($ank["dating7"] == 1 ? ' checked' : '') . '/>&nbsp;Ищу спонсора<br />
<input name="dating8" type="checkbox" value="1"' . ($ank["dating8"] == 1 ? ' checked' : '') . '/>&nbsp;Стану спонсором<hr noshade size="1">
<b>Состою в браке:</b><br /><input name="family" type="radio" value="1"' . ($ank["family"] == 1 ? ' checked' : '') . '/>&nbsp;Нет<br />
<input name="family" type="radio" value="2"' . ($ank["family"] == 2 ? ' checked' : '') . '/>&nbsp;Да<br />
<input name="family" type="radio" value="3"' . ($ank["family"] == 3 ? ' checked' : '') . '/>&nbsp;Уже нет<br />
<input name="family" type="radio" value="0"' . ($ank["family"] == 0 ? ' checked' : '') . '/>&nbsp;Не отображать<hr noshade size="1">
<b>О желаемом партнере:</b><br /><textarea style="width: 329px; height: 56px;" name="opartnere">' . $ank['opartnere'] . '</textarea><hr noshade size="1">
<input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
	break;
	// Интересы
	case 'interes':
	echo '<div class="menu"><a href="?">'.$edit['osnovnoe'].'</a> | '.$edit['interes'].' | <a href="?act=znakom">'.$edit['znakom'].'</a> | <a href="?act=tipaz">'.$edit['tipaz'].'</a> | <a href="?act=dopoln">'.$edit['dopoln'].'</a> | <a href="?act=kont">'.$edit['kont'].'</a></div>';
	if(isset($_POST['submit'])){
		$about_me = input($_POST['about_me']);
		$interests = input($_POST['interests']);
		$favorite_music = input($_POST['favorite_music']);
		$favorite_movies = input($_POST['favorite_movies']);
		$favorite_books = input($_POST['favorite_books']);

		mysql_query("UPDATE `user` SET
		`about_me` = '$about_me',
		`interests` = '$interests',
		`favorite_music` = '$favorite_music',
		`favorite_movies`='$favorite_movies',
		`favorite_books`='$favorite_books'
		WHERE `id` = '$ank[id]'
		");
		mysql_query("OPTIMIZE TABLE `user`");
		echo '<div class="messages">'.$edit['been_saved'].'</div>';
		header( "refresh:1;url=edit?act=interes" );
	}
	echo '<div class="menu"><form name="form" action="?act=interes&amp;inters" method="post">
<b>О себе:</b><br /><textarea style="width: 329px; height: 56px;" name="about_me">' . $ank['about_me'] . '</textarea><hr noshade size="1">
<b>'.$edit['interes'].':</b><br /><textarea style="width: 329px; height: 56px;" name="interests">' . $ank['interests'] . '</textarea><hr noshade size="1">
<b>Любимая музыка:</b><br /><textarea style="width: 329px; height: 56px;" name="favorite_music">' . $ank['favorite_music'] . '</textarea><hr noshade size="1">
<b>Любимые фильмы:</b><br /><textarea style="width: 329px; height: 56px;" name="favorite_movies">' . $ank['favorite_movies'] . '</textarea><hr noshade size="1">
<b>Любимые книги:</b><br /><textarea style="width: 329px; height: 56px;" name="favorite_books">' . $ank['favorite_books'] . '</textarea><hr noshade size="1">
<input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
	break;
	// Основное
	default:
	echo '<div class="menu">'.$edit['osnovnoe'].' | <a href="?act=interes">'.$edit['interes'].'</a> | <a href="?act=znakom">'.$edit['znakom'].'</a> | <a href="?act=tipaz">'.$edit['tipaz'].'</a> | <a href="?act=dopoln">'.$edit['dopoln'].'</a> | <a href="?act=kont">'.$edit['kont'].'</a></div>';
	if(isset($_POST['submit'])){
		$name = input($_POST['name']);
		$surname = input($_POST['surname']);
		$sex = intval($_POST['sex']);
		$d = num($_POST['d']);
		$m = num($_POST['m']);
		$g = num($_POST['g']);
		$status = input($_POST['status']);
		if ($d > 31) {
				$err = 'Неверная дата';
			}
			if ($m > 12) {
				$err = 'Неверный месяц';
			}
			if ($g > 1995) {
				$err = 'Разрешено регистрироваться лицам старше 18 лет!';
			}
			if (!$d or !$m or !$g) {
				$err = 'Введите пожалуйста дату рождения!';
			}
			if (!$name) {
				$err = 'Введите пожалуйста Ваше имя.';
			}
			if(!isset($err)){
			mysql_query("UPDATE `user` SET
			`name` = '$name',
			`surname` = '$surname',
			`sex` = '$sex',
			`d`='$d',
			`m`='$m',
			`g`='$g',
			`status` = '$status'
			WHERE `id` = '$ank[id]'
			");
			mysql_query("OPTIMIZE TABLE `user`");
			echo '<div class="messages">'.$edit['been_saved'].'</div>';
			header( "refresh:1;url=edit" );
		}
		if (isset($err)) {
				echo '<div class="err">' . $err . '</div>';
			}
		}
	echo '<div class="menu"><form name="form" action="?main" method="post">
<b>Ник:</b><br /><input name="nick" type="text" value="' . output($ank['nick']) . '" disabled="disabled" title="Ник изменть нельзя" /> <a href="/service/">сменить ник</a><hr noshade size="1">
<b>Статус:</b><br /><input name="status" type="text" value="' . output($ank['status']) . '" /><hr noshade size="1">
<b>Имя:</b><br /><input name="name" type="text" value="' . output($ank['name']) . '" /><hr noshade size="1">
<b>Фамилия:</b><br /><input name="surname" type="text" value="' . output($ank['surname']) . '" /><hr noshade size="1">';
	/* if ($ank['sex'] == 1) {
		echo '<b>Девичья фамилия:</b><br /><input name="surname" type="text" value="' . output($ank['surname']) . '" /><hr noshade size="1">';
	} */
	echo '<b>Пол:</b><br /><select name="sex">
<option value="0"' . ($ank["sex"] == 0 ? ' selected' : '') . '>Мужской</option>
<option value="1"' . ($ank["sex"] == 1 ? ' selected' : '') . '>Женский</option>
</select><hr noshade size="1">
<b>День рождения:</b><br />
<select name="d">
<option value="0">--</option>' . PHP_EOL;
	for ($i = 1; $i < 32; $i++) {
		echo '<option value="' . $i . '"' . ($i == $ank["d"] ? ' selected="selected"' : '') . '>' . $i . '</option>' . PHP_EOL;
	}
	echo '</select>
<select name="m">
<option value="0">Месяц</option>
<option value="1"' . ($ank["m"] == 1 ? ' selected="selected"' : '') . '>Января</option>
<option value="2"' . ($ank["m"] == 2 ? ' selected="selected"' : '') . '>Февраля</option>
<option value="3"' . ($ank["m"] == 3 ? ' selected="selected"' : '') . '>Марта</option>
<option value="4"' . ($ank["m"] == 4 ? ' selected="selected"' : '') . '>Апреля</option>
<option value="5"' . ($ank["m"] == 5 ? ' selected="selected"' : '') . '>Мая</option>
<option value="6"' . ($ank["m"] == 6 ? ' selected="selected"' : '') . '>Июня</option>
<option value="7"' . ($ank["m"] == 7 ? ' selected="selected"' : '') . '>Июля</option>
<option value="8"' . ($ank["m"] == 8 ? ' selected="selected"' : '') . '>Августа</option>
<option value="9"' . ($ank["m"] == 9 ? ' selected="selected"' : '') . '>Сентября</option>
<option value="10"' . ($ank["m"] == 10 ? ' selected="selected"' : '') . '>Октября</option>
<option value="11"' . ($ank["m"] == 11 ? ' selected="selected"' : '') . '>Ноября</option>
<option value="12"' . ($ank["m"] == 12 ? ' selected="selected"' : '') . '>Декабря</option>
</select>
<select name="g">
<option value="0">----</option>';
	$date = date("Y") - 19;
	for ($i = $date; $i >= 1940; $i--) {
		echo '<option value="' . $i . '"' . ($i == $ank["g"] ? ' selected="selected"' : '') . '>' . $i . '</option>' . PHP_EOL;
	}
	echo '</select><hr noshade size="1">';
	$sity = mysql_fetch_assoc(mysql_query("SELECT `name` FROM `city` WHERE `city_id` = '$ank[city]'"));
	$icon = mysql_fetch_assoc(mysql_query("SELECT `ico` FROM `country` WHERE `country_id` = '$ank[strana]'"));
	echo '<b>Город, страна:</b> ';
	if($ank['city'] != 0) {
		echo $sity['name'].' <img src="/images/flag/'.$icon['ico'].'" alt="" /> <a href="my_life.php">изменить</a><hr noshade size="1">';
	} else {
		echo '<a href="my_life.php">Выбрать</a><hr noshade size="1">';
	}
	echo '<input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
	break;
}

include '../system/inc/footer.php';