Просмотр файла anketa.php

Размер файла: 2.93Kb
<?
include_once 'inc/db.php';
include_once 'inc/1.php';
if (!$user){
header("Location: /aut.php");
exit;
}
function me($in){
return mysql_escape_string($in);
}
function hc($in){
return htmlspecialchars($in);
}
if (!$_POST['OK']){
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='r'>Внизу</option><option value='p'>Вверху</option></select><br>Дизайн: <select name='style'><option value='1'>Цветной</option><option value='0'>Синий</option></select><br><input type='submit' value='Сохранить' name='OK'></form>*{name} - Ник пользователя<br>&nbsp;&nbsp;{names} - Имя пользователя (может отсутствовать)</div>";
}else{
$aname=me($_POST['aname']);
$gorod=me($_POST['gorod']);
$email=me($_POST['email']);
$tel=me($_POST['tel']);
$reply=me($_POST['reply']);
$hier=me($_POST['hier']);
$tsel=me($_POST['tsel']);
$icq=intval($_POST['icq']);
if ((strlen($icq)<3) || (strlen($icq)>9))$icq='';
$osebe=me($_POST['osebe']);
if ($_POST['zhel']=='z0')$zhel=1;
else
$zhel=0;
if ($_POST['pol']=='p0')$pol=1;
else
$pol=0;
if ($_POST['ksort']=='p')$ksort=0;
else
$ksort=1;
$style=intval($_POST['style']);
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', `style` = '$style' WHERE `id` = '$user[id]'");
mysql_query("INSERT INTO `log` (`user`, `text`, `time`) values ('$user[id]', 'Изменение анкеты', '".time()."')");
msg("Сохранено, ".hc($aname)."!");
}
include_once 'inc/foot.php';
?>