View file anketa.php

File size: 2.63Kb
  1. <?
  2. include_once 'inc/db.php';
  3. include_once 'inc/1.php';
  4. if (!$user){
  5. header("Location: /aut.php");
  6. exit;
  7. }
  8. function me($in){
  9. return mysql_escape_string($in);
  10. }
  11. function hc($in){
  12. return htmlspecialchars($in);
  13. }
  14. if (!$_POST['OK']){
  15. echo "<div class='t2'>Изменить анкету</div><div class='p0'><form action='?' method='POST'>Имя: <br><input type='text' name='aname' maxlength='100' value='".hc($user['aname'])."'><br>Город: <br> <input type='text' name='gorod' maxlength='100' value='".hc($user['gorod'])."'><br>E-Mail: <br> <input type='text' name='email' maxlength='100' value='".hc($user['email'])."'><br>ICQ: <br> <input type='text' name='icq' maxlength='9' value='".intval($user['ICQ'])."'><br>Телефон: <br> <input type='text' name='tel' maxlength='17' value='".hc($user['tel'])."'><br>Цель знакомства:<br><input type='text' name='tsel' maxlength='17' value='".hc($user['tsel'])."'><br><select name='zhel'><option value='z0'>Хочу знакомств</option><option value='z1'>Не хочу знакомств</option></select><br>Пол: <select name='pol'><option value='p0'>Муж.</option><option value='p1'>Жен.</option></select><br>О себе:<br><textarea name='osebe' maxlength='100'>".hc($user['osebe'])."</textarea><br>Автоответчик*:<br><textarea name='reply' maxlength='256'>".hc($user['reply'])."</textarea><br>Приветствие*:<br><textarea name='hier' maxlength='256'>".hc($user['hier'])."</textarea><br>Новые комментарии: <select name='ksort'><option value='p'>Вверху</option><option value='r'>Внизу</option></select><br><input type='submit' value='Сохранить' name='OK'></form>*{name} - Ник пользователя<br>&nbsp;&nbsp;{names} - Имя пользователя (может отсутствовать)</div>";
  16. }else{
  17. $aname=me($_POST['aname']);
  18. $gorod=me($_POST['gorod']);
  19. $email=me($_POST['email']);
  20. $tel=me($_POST['tel']);
  21. $reply=me($_POST['reply']);
  22. $hier=me($_POST['hier']);
  23. $tsel=me($_POST['tsel']);
  24. $icq=intval($_POST['icq']);
  25. if ((strlen($icq)<3) || (strlen($icq)>9))$icq='';
  26. $osebe=me($_POST['osebe']);
  27. if ($_POST['zhel']=='z0')$zhel=1;
  28. else
  29. $zhel=0;
  30. if ($_POST['pol']=='p0')$pol=1;
  31. else
  32. $pol=0;
  33. if ($_POST['ksort']=='p')$ksort=0;
  34. else
  35. $ksort=1;
  36. mysql_query("UPDATE `user` SET `gorod` = '$gorod', `email` = '$email', `tel` = '$tel', `tsel` = '$tsel', `zhel` = '$zhel', `aname` = '$aname', `pol` = '$pol', `osebe` = '$osebe', `ICQ` = '$icq', `ksort` = '$ksort', `reply` = '$reply', `hier` = '$hier' WHERE `id` = '$user[id]'");
  37. msg("Сохранено, ".hc($aname)."!");
  38. }
  39. include_once 'inc/foot.php';
  40. ?>
  41.