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

Размер файла: 19.23Kb
  1. <?php
  2. // by Jahak
  3. include '../system/inc/connect.php';
  4. include '../system/inc/core.php';
  5. $title = $edit['title'];
  6. include '../system/inc/header.php';
  7.  
  8. if(!$user){
  9. header('Location: /index.php');
  10. }
  11.  
  12. $ank['id'] = intval($_GET['uid']);
  13. if (!$ank['id']) {
  14. $ank['id'] = $user['id'];
  15. }
  16. $ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id`='$ank[id]'"));
  17.  
  18. switch ($_GET['act'])
  19. {
  20. // Контакты
  21. case 'kont':
  22. 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>';
  23. if(isset($_POST['submit'])){
  24. $email = input($_POST['email']);
  25. if (!$email) {
  26. $err = $edit['full_mail'];
  27. }
  28. if(!isset($err)){
  29. mysql_query("UPDATE `user` SET
  30. `email` = '$email'
  31. WHERE `id` = '$ank[id]'
  32. ");
  33. mysql_query("OPTIMIZE TABLE `user`");
  34. echo '<div class="messages">'.$edit['been_saved'].'</div>';
  35. header("refresh:1;url=edit?act=kont");
  36. }
  37. if (isset($err)) {
  38. echo '<div class="err">' . $err . '</div>';
  39. }
  40. }
  41. echo '<div class="menu"><form name="form" action="?act=kont&amp;knt" method="post">
  42. <b>E-mail:</b><br /><input name="email" type="text" maxlength="50" value="' . output($ank['email']) . '" /><hr noshade size="1">
  43. <!-- <b>Мобильный телефон:</b><br /><input name="" type="text" maxlength="50" value="' . output($ank['']) . '" /><hr noshade size="1">
  44. <b>Дополнительный телефон:</b><br /><input name="" type="text" maxlength="50" value="' . output($ank['']) . '" /><hr noshade size="1">
  45. <b>Skype:</b><br /><input name="" type="text" maxlength="50" value="' . output($ank['']) . '" /><hr noshade size="1">
  46. <b>Личный сайт:</b><br /><input name="" type="text" maxlength="50" value="' . output($ank['']) . '" /><hr noshade size="1"> -->
  47. <input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
  48. break;
  49. // Дополнительно
  50. case 'dopoln':
  51. 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>';
  52. if(isset($_POST['submit'])){
  53. $what_i_do = num($_POST['what_i_do']);
  54. $profession = input($_POST['profession']);
  55. $smoke = num($_POST['smoke']);
  56.  
  57. mysql_query("UPDATE `user` SET
  58. `what_i_do` = '$what_i_do',
  59. `profession` = '$profession',
  60. `smoke` = '$smoke'
  61. WHERE `id` = '$ank[id]'
  62. ");
  63. mysql_query("OPTIMIZE TABLE `user`");
  64. echo '<div class="messages">'.$edit['been_saved'].'</div>';
  65. header("refresh:1;url=edit?act=dopoln");
  66. }
  67. echo '<div class="menu"><form name="form" action="?act=dopoln&amp;dpn" method="post">';
  68. echo '<b>Чем я занимаюсь:</b><br /><input name="what_i_do" type="radio" value="1"' . ($ank["what_i_do"] == 1 ? ' checked' : '') . '/>&nbsp;Учусь в школе<br />
  69. <input name="what_i_do" type="radio" value="2"' . ($ank["what_i_do"] == 2 ? ' checked' : '') . '/>&nbsp;Учусь в колледже/лицее<br />
  70. <input name="what_i_do" type="radio" value="3"' . ($ank["what_i_do"] == 3 ? ' checked' : '') . '/>&nbsp;Учусь в ВУЗе<br />
  71. <input name="what_i_do" type="radio" value="4"' . ($ank["what_i_do"] == 4 ? ' checked' : '') . '/>&nbsp;Учусь в военном училище<br />
  72. <input name="what_i_do" type="radio" value="5"' . ($ank["what_i_do"] == 5 ? ' checked' : '') . '/>&nbsp;Служу в армии<br />
  73. <input name="what_i_do" type="radio" value="6"' . ($ank["what_i_do"] == 6 ? ' checked' : '') . '/>&nbsp;Работаю<br />
  74. <input name="what_i_do" type="radio" value="7"' . ($ank["what_i_do"] == 6 ? ' checked' : '') . '/>&nbsp;Не работаю<br />
  75. <input name="what_i_do" type="radio" value="8"' . ($ank["what_i_do"] == 6 ? ' checked' : '') . '/>&nbsp;Сижу на зоне<br />
  76. <input name="what_i_do" type="radio" value="0"' . ($ank["what_i_do"] == 0 ? ' checked' : '') . '/>&nbsp;Не отображать<hr noshade size="1">
  77. <b>Профессия:</b><br /><input name="profession" type="text" size="22" maxlength="77" value="' . output($ank['profession']) . '" /><hr noshade size="1">
  78. <b>Курю ли я:</b><br /><input name="smoke" type="radio" value="1"' . ($ank["smoke"] == 1 ? ' checked' : '') . '/>&nbsp;Не курю<br />
  79. <input name="smoke" type="radio" value="2"' . ($ank["smoke"] == 2 ? ' checked' : '') . '/>&nbsp;Курю<br />
  80. <input name="smoke" type="radio" value="3"' . ($ank["smoke"] == 3 ? ' checked' : '') . '/>&nbsp;Иногда<br />
  81. <input name="smoke" type="radio" value="4"' . ($ank["smoke"] == 4 ? ' checked' : '') . '/>&nbsp;Бросаю<br />
  82. <input name="smoke" type="radio" value="0"' . ($ank["smoke"] == 0 ? ' checked' : '') . '/>&nbsp;Не отображать<br /><hr noshade size="1">';
  83. echo '<input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
  84. break;
  85. // Типаж
  86. case 'tipaz':
  87. 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>';
  88. if(isset($_POST['submit'])){
  89. $growth = num($_POST['growth']);
  90. $weight = num($_POST['weight']);
  91. $eyes = input($_POST['eyes']);
  92. $hair_color = input($_POST['hair_color']);
  93. $physique = num($_POST['physique']);
  94. $character = input($_POST['character']);
  95. $na_tele = num($_POST['na_tele']);
  96. $na_tele1 = num($_POST['na_tele1']);
  97.  
  98. mysql_query("UPDATE `user` SET
  99. `growth` = '$growth',
  100. `weight` = '$weight',
  101. `eyes` = '$eyes',
  102. `hair_color` = '$hair_color',
  103. `physique` = '$physique',
  104. `character` = '$character',
  105. `na_tele` = '$na_tele',
  106. `na_tele1` = '$na_tele1'
  107. WHERE `id` = '$ank[id]'
  108. ");
  109. mysql_query("OPTIMIZE TABLE `user`");
  110. echo '<div class="messages">'.$edit['been_saved'].'</div>';
  111. header( "refresh:1;url=edit?act=tipaz" );
  112. }
  113. echo '<div class="menu"><form name="form" action="?act=tipaz&amp;tpz" method="post">
  114. <b>Рост:</b><br /><input name="growth" type="text" size="3" maxlength="3" value="' . output($ank['growth']) . '" /><hr noshade size="1">
  115. <b>Вес:</b><br /><input name="weight" type="text" size="3" maxlength="3" value="' . output($ank['weight']) . '" /><hr noshade size="1">
  116. <b>Цвет глаз:</b><br /><input name="eyes" type="text" maxlength="50" value="' . output($ank['eyes']) . '" /><hr noshade size="1">
  117. <b>Цвет волос:</b><br /><input name="hair_color" type="text" maxlength="50" value="' . output($ank['hair_color']) . '" /><hr noshade size="1">
  118. <b>Телосложение:</b><br /><input name="physique" type="radio" value="1"' . ($ank["physique"] == 1 ? ' checked' : '') . '/>&nbsp;Обычное<br />
  119. <input name="physique" type="radio" value="2"' . ($ank["physique"] == 2 ? ' checked' : '') . '/>&nbsp;Худощавое<br />
  120. <input name="physique" type="radio" value="3"' . ($ank["physique"] == 3 ? ' checked' : '') . '/>&nbsp;Спортивное<br />
  121. <input name="physique" type="radio" value="4"' . ($ank["physique"] == 4 ? ' checked' : '') . '/>&nbsp;Мускулистое<br />
  122. <input name="physique" type="radio" value="5"' . ($ank["physique"] == 5 ? ' checked' : '') . '/>&nbsp;Плотное<br />
  123. <input name="physique" type="radio" value="5"' . ($ank["physique"] == 6 ? ' checked' : '') . '/>&nbsp;Полное<br />
  124. <input name="physique" type="radio" value="0"' . ($ank["physique"] == 0 ? ' checked' : '') . '/>&nbsp;Не отображать<hr noshade size="1">
  125. <b>Характер:</b><br /><input name="character" type="text" maxlength="50" value="' . output($ank['character']) . '" /><hr noshade size="1">
  126. <b>На теле есть:</b><br /><input name="na_tele" type="checkbox" value="1"' . ($ank["na_tele"] == 1 ? ' checked' : '') . '/>&nbsp;Пирсинг&nbsp;&nbsp;
  127. <input name="na_tele1" type="checkbox" value="1"' . ($ank["na_tele1"] == 1 ? ' checked' : '') . '/>&nbsp;Татуировки<hr noshade size="1">
  128. <input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
  129. break;
  130. // Знакомства
  131. case 'znakom':
  132. 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>';
  133. if(isset($_POST['submit'])){
  134. $orientation = num($_POST['orientation']);
  135. $dating1 = num($_POST['dating1']);
  136. $dating2 = num($_POST['dating2']);
  137. $dating3 = num($_POST['dating3']);
  138. $dating4 = num($_POST['dating4']);
  139. $dating5 = num($_POST['dating5']);
  140. $dating6 = num($_POST['dating6']);
  141. $dating7 = num($_POST['dating7']);
  142. $dating8 = num($_POST['dating8']);
  143. $family = num($_POST['family']);
  144. $opartnere = input($_POST['opartnere']);
  145.  
  146. mysql_query("UPDATE `user` SET
  147. `orientation` = '$orientation',
  148. `dating1` = '$dating1',
  149. `dating2` = '$dating2',
  150. `dating3` = '$dating3',
  151. `dating4` = '$dating4',
  152. `dating5` = '$dating5',
  153. `dating6` = '$dating6',
  154. `dating7` = '$dating7',
  155. `dating8` = '$dating8',
  156. `family` = '$family',
  157. `opartnere` = '$opartnere'
  158. WHERE `id` = '$ank[id]'
  159. ");
  160. mysql_query("OPTIMIZE TABLE `user`");
  161. echo '<div class="messages">'.$edit['been_saved'].'</div>';
  162. header( "refresh:1;url=edit?act=znakom" );
  163. }
  164. echo '<div class="menu"><form name="form" action="?act=znakom&amp;znm" method="post">
  165. <b>Ориентация:</b><br /><select name="orientation">
  166. <option value="0">Не выбрано</option>';
  167. if ($ank['sex'] == 0) {
  168. echo '<option value="1" ' . ($ank["orientation"] == 1 ? ' selected="selected"' : '') . '>Гетеро</option>
  169. <option value="2" ' . ($ank["orientation"] == 2 ? ' selected="selected"' : '') . '>Гей</option>
  170. <option value="3" ' . ($ank["orientation"] == 3 ? ' selected="selected"' : '') . '>Би</option></select>';
  171. } else {
  172. echo '<option value="1" ' . ($ank["orientation"] == 1 ? ' selected="selected"' : '') . '>Гетеро</option>
  173. <option value="2" ' . ($ank["orientation"] == 2 ? ' selected="selected"' : '') . '>Лесби</option>
  174. <option value="3" ' . ($ank["orientation"] == 3 ? ' selected="selected"' : '') . '>Би</option></select>';
  175. }
  176. echo '<hr noshade size="1">
  177. <b>Цель '.$edit['znakom'].':</b><br />
  178. <input name="dating1" type="checkbox" value="1"' . ($ank["dating1"] == 1 ? ' checked' : '') . '/>&nbsp;Дружба и общение<br />
  179. <input name="dating2" type="checkbox" value="1"' . ($ank["dating2"] == 1 ? ' checked' : '') . '/>&nbsp;Флирт, СМС-переписка<br />
  180. <input name="dating3" type="checkbox" value="1"' . ($ank["dating3"] == 1 ? ' checked' : '') . '/>&nbsp;Любовь, отношения<br />
  181. <input name="dating4" type="checkbox" value="1"' . ($ank["dating4"] == 1 ? ' checked' : '') . '/>&nbsp;Брак, создание семьи<br />
  182. <input name="dating5" type="checkbox" value="1"' . ($ank["dating5"] == 1 ? ' checked' : '') . '/>&nbsp;Виртуальный секс<br />
  183. <input name="dating6" type="checkbox" value="1"' . ($ank["dating6"] == 1 ? ' checked' : '') . '/>&nbsp;Секс в реале<br />
  184. <input name="dating7" type="checkbox" value="1"' . ($ank["dating7"] == 1 ? ' checked' : '') . '/>&nbsp;Ищу спонсора<br />
  185. <input name="dating8" type="checkbox" value="1"' . ($ank["dating8"] == 1 ? ' checked' : '') . '/>&nbsp;Стану спонсором<hr noshade size="1">
  186. <b>Состою в браке:</b><br /><input name="family" type="radio" value="1"' . ($ank["family"] == 1 ? ' checked' : '') . '/>&nbsp;Нет<br />
  187. <input name="family" type="radio" value="2"' . ($ank["family"] == 2 ? ' checked' : '') . '/>&nbsp;Да<br />
  188. <input name="family" type="radio" value="3"' . ($ank["family"] == 3 ? ' checked' : '') . '/>&nbsp;Уже нет<br />
  189. <input name="family" type="radio" value="0"' . ($ank["family"] == 0 ? ' checked' : '') . '/>&nbsp;Не отображать<hr noshade size="1">
  190. <b>О желаемом партнере:</b><br /><textarea style="width: 329px; height: 56px;" name="opartnere">' . $ank['opartnere'] . '</textarea><hr noshade size="1">
  191. <input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
  192. break;
  193. // Интересы
  194. case 'interes':
  195. 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>';
  196. if(isset($_POST['submit'])){
  197. $about_me = input($_POST['about_me']);
  198. $interests = input($_POST['interests']);
  199. $favorite_music = input($_POST['favorite_music']);
  200. $favorite_movies = input($_POST['favorite_movies']);
  201. $favorite_books = input($_POST['favorite_books']);
  202.  
  203. mysql_query("UPDATE `user` SET
  204. `about_me` = '$about_me',
  205. `interests` = '$interests',
  206. `favorite_music` = '$favorite_music',
  207. `favorite_movies`='$favorite_movies',
  208. `favorite_books`='$favorite_books'
  209. WHERE `id` = '$ank[id]'
  210. ");
  211. mysql_query("OPTIMIZE TABLE `user`");
  212. echo '<div class="messages">'.$edit['been_saved'].'</div>';
  213. header( "refresh:1;url=edit?act=interes" );
  214. }
  215. echo '<div class="menu"><form name="form" action="?act=interes&amp;inters" method="post">
  216. <b>О себе:</b><br /><textarea style="width: 329px; height: 56px;" name="about_me">' . $ank['about_me'] . '</textarea><hr noshade size="1">
  217. <b>'.$edit['interes'].':</b><br /><textarea style="width: 329px; height: 56px;" name="interests">' . $ank['interests'] . '</textarea><hr noshade size="1">
  218. <b>Любимая музыка:</b><br /><textarea style="width: 329px; height: 56px;" name="favorite_music">' . $ank['favorite_music'] . '</textarea><hr noshade size="1">
  219. <b>Любимые фильмы:</b><br /><textarea style="width: 329px; height: 56px;" name="favorite_movies">' . $ank['favorite_movies'] . '</textarea><hr noshade size="1">
  220. <b>Любимые книги:</b><br /><textarea style="width: 329px; height: 56px;" name="favorite_books">' . $ank['favorite_books'] . '</textarea><hr noshade size="1">
  221. <input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
  222. break;
  223. // Основное
  224. default:
  225. 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>';
  226. if(isset($_POST['submit'])){
  227. $name = input($_POST['name']);
  228. $surname = input($_POST['surname']);
  229. $sex = intval($_POST['sex']);
  230. $d = num($_POST['d']);
  231. $m = num($_POST['m']);
  232. $g = num($_POST['g']);
  233. $status = input($_POST['status']);
  234. if ($d > 31) {
  235. $err = 'Неверная дата';
  236. }
  237. if ($m > 12) {
  238. $err = 'Неверный месяц';
  239. }
  240. if ($g > 1995) {
  241. $err = 'Разрешено регистрироваться лицам старше 18 лет!';
  242. }
  243. if (!$d or !$m or !$g) {
  244. $err = 'Введите пожалуйста дату рождения!';
  245. }
  246. if (!$name) {
  247. $err = 'Введите пожалуйста Ваше имя.';
  248. }
  249. if(!isset($err)){
  250. mysql_query("UPDATE `user` SET
  251. `name` = '$name',
  252. `surname` = '$surname',
  253. `sex` = '$sex',
  254. `d`='$d',
  255. `m`='$m',
  256. `g`='$g',
  257. `status` = '$status'
  258. WHERE `id` = '$ank[id]'
  259. ");
  260. mysql_query("OPTIMIZE TABLE `user`");
  261. echo '<div class="messages">'.$edit['been_saved'].'</div>';
  262. header( "refresh:1;url=edit" );
  263. }
  264. if (isset($err)) {
  265. echo '<div class="err">' . $err . '</div>';
  266. }
  267. }
  268. echo '<div class="menu"><form name="form" action="?main" method="post">
  269. <b>Ник:</b><br /><input name="nick" type="text" value="' . output($ank['nick']) . '" disabled="disabled" title="Ник изменть нельзя" /> <a href="/service/">сменить ник</a><hr noshade size="1">
  270. <b>Статус:</b><br /><input name="status" type="text" value="' . output($ank['status']) . '" /><hr noshade size="1">
  271. <b>Имя:</b><br /><input name="name" type="text" value="' . output($ank['name']) . '" /><hr noshade size="1">
  272. <b>Фамилия:</b><br /><input name="surname" type="text" value="' . output($ank['surname']) . '" /><hr noshade size="1">';
  273. /* if ($ank['sex'] == 1) {
  274. echo '<b>Девичья фамилия:</b><br /><input name="surname" type="text" value="' . output($ank['surname']) . '" /><hr noshade size="1">';
  275. } */
  276. echo '<b>Пол:</b><br /><select name="sex">
  277. <option value="0"' . ($ank["sex"] == 0 ? ' selected' : '') . '>Мужской</option>
  278. <option value="1"' . ($ank["sex"] == 1 ? ' selected' : '') . '>Женский</option>
  279. </select><hr noshade size="1">
  280. <b>День рождения:</b><br />
  281. <select name="d">
  282. <option value="0">--</option>' . PHP_EOL;
  283. for ($i = 1; $i < 32; $i++) {
  284. echo '<option value="' . $i . '"' . ($i == $ank["d"] ? ' selected="selected"' : '') . '>' . $i . '</option>' . PHP_EOL;
  285. }
  286. echo '</select>
  287. <select name="m">
  288. <option value="0">Месяц</option>
  289. <option value="1"' . ($ank["m"] == 1 ? ' selected="selected"' : '') . '>Января</option>
  290. <option value="2"' . ($ank["m"] == 2 ? ' selected="selected"' : '') . '>Февраля</option>
  291. <option value="3"' . ($ank["m"] == 3 ? ' selected="selected"' : '') . '>Марта</option>
  292. <option value="4"' . ($ank["m"] == 4 ? ' selected="selected"' : '') . '>Апреля</option>
  293. <option value="5"' . ($ank["m"] == 5 ? ' selected="selected"' : '') . '>Мая</option>
  294. <option value="6"' . ($ank["m"] == 6 ? ' selected="selected"' : '') . '>Июня</option>
  295. <option value="7"' . ($ank["m"] == 7 ? ' selected="selected"' : '') . '>Июля</option>
  296. <option value="8"' . ($ank["m"] == 8 ? ' selected="selected"' : '') . '>Августа</option>
  297. <option value="9"' . ($ank["m"] == 9 ? ' selected="selected"' : '') . '>Сентября</option>
  298. <option value="10"' . ($ank["m"] == 10 ? ' selected="selected"' : '') . '>Октября</option>
  299. <option value="11"' . ($ank["m"] == 11 ? ' selected="selected"' : '') . '>Ноября</option>
  300. <option value="12"' . ($ank["m"] == 12 ? ' selected="selected"' : '') . '>Декабря</option>
  301. </select>
  302. <select name="g">
  303. <option value="0">----</option>';
  304. $date = date("Y") - 19;
  305. for ($i = $date; $i >= 1940; $i--) {
  306. echo '<option value="' . $i . '"' . ($i == $ank["g"] ? ' selected="selected"' : '') . '>' . $i . '</option>' . PHP_EOL;
  307. }
  308. echo '</select><hr noshade size="1">';
  309. $sity = mysql_fetch_assoc(mysql_query("SELECT `name` FROM `city` WHERE `city_id` = '$ank[city]'"));
  310. $icon = mysql_fetch_assoc(mysql_query("SELECT `ico` FROM `country` WHERE `country_id` = '$ank[strana]'"));
  311. echo '<b>Город, страна:</b> ';
  312. if($ank['city'] != 0) {
  313. echo $sity['name'].' <img src="/images/flag/'.$icon['ico'].'" alt="" /> <a href="my_life.php">изменить</a><hr noshade size="1">';
  314. } else {
  315. echo '<a href="my_life.php">Выбрать</a><hr noshade size="1">';
  316. }
  317. echo '<input name="submit" type="submit" value="'.$edit['save'].'" /></form></div>';
  318. break;
  319. }
  320.  
  321. include '../system/inc/footer.php';