Файл: my/profile.php
Строк: 224
<?
define('ROOT','../');
require_once (ROOT.'system/power.php');
if ($aut) {
switch ($do) {
//Аватар
case 'avatar':
$diz -> head('Аватар');
$diz -> title('Аватар');
echo '<div class="but_razdel">
<a href="?" class="button_razdel">'.language('Личное').'</a>
<a href="?do=contacts" class="button_razdel">'.language('Контакты').'</a>
<a href="?do=inters" class="button_razdel">'.language('Интересы').'</a>
<div class="button_razdel"/><b>'.language('Аватар').'</b></div>
</div>';
echo '<div class="fon">'.language('Текущий аватар').':<br/>'.$fuser->avatar($ya['id']).'</div>';
$func->upload('photo');
break;
//Интересы
case 'inters':
$diz -> head('Интересы');
$diz -> title('Интересы');
if (!isset($_POST['submit'])) {
echo '<div class="but_razdel">
<a href="?" class="button_razdel">'.language('Личное').'</a>
<a href="?do=contacts" class="button_razdel">'.language('Контакты').'</a>
<div class="button_razdel"/><b>'.language('Интересы').'</b></div>
<a href="?do=avatar" class="button_razdel">'.language('Аватар').'</a>
</div>';
echo '<div class="fon"><form action="profile.php?do=inters" method="post">
'.language('О себе').':<br/><textarea name="about">'.$ya['about'].'</textarea><br/>
<input type="submit" name="submit" value="'.language('Сохранить').'"/></form></div>';
} else {
$about = shit($_POST['about']);
$db -> query("UPDATE `users` SET
`about` = '".$about."'
WHERE `id` = '".$ya['id']."'");
header('Location: ?do=inters');
}
break;
//Контактная инфа
case 'contacts':
$diz -> head('Контакты');
$diz -> title('Контакты');
if (!isset($_POST['submit'])) {
echo '<div class="but_razdel">
<a href="?" class="button_razdel">'.language('Личное').'</a>
<div class="button_razdel"/><b>'.language('Контакты').'</b></div>
<a href="?do=inters" class="button_razdel">'.language('Интересы').'</a>
<a href="?do=avatar" class="button_razdel">'.language('Аватар').'</a>
</div>';
if(mb_strlen($func->delprobel($ya['email']))>3){
if($ya['email_act']=='no')$email_act='<a href="settings.php?mode=security">'.language('Неподтверждён').'</a>'; else $email_act=language('Подтверждён');
}
echo '<div class="fon"><form action="profile.php?do=contacts" method="post">
Email: '.$email_act.'<br/><input type="text" name="email" value="'.$ya['email'].'" maxlength="32"/><br/>
Skype:<br/><input type="text" name="skype" value="'.$ya['skype'].'" maxlength="24"/><br/>
'.language('Личный сайт').':<br/><input type="text" name="site" value="'.$ya['site'].'" maxlength="50"/><br/>
'.language('Телефон').':<br/><input type="text" name="number" value="'.$ya['number'].'" maxlength="14"/><br/>
<input type="submit" name="submit" value="'.language('Сохранить').'"/></form></div>';
} else {
$email = ((!empty($_POST['email']))&&(mb_strlen($_POST['email'])>0 and mb_strlen($_POST['email'])<80)) ? shit($_POST['email']) : null;
$skype = ((!empty($_POST['skype']))&&(mb_strlen($_POST['skype'])>0 and mb_strlen($_POST['skype'])<25)) ? shit($_POST['skype']) : null;
$site = ((!empty($_POST['site']))&&(mb_strlen($_POST['site'])>0 and mb_strlen($_POST['site'])<51)) ? shit($_POST['site']) : null;
$number = ((!empty($_POST['number']))&&(mb_strlen($_POST['number'])>0 and mb_strlen($_POST['number'])<15)) ? abs($_POST['number']) : null;
if(isset($email)and mb_strlen($func->delprobel($email))>3)$us_email = $db -> dbcount('COUNT(`id`)','users',"`email` = '".$email."' and `id`<>'".$ya['id']."'");
if(isset($email)and mb_strlen($func->delprobel($email))>3 and $db->settings('warning_email')==1 and $us_email>0){
$diz -> head('Ошибка');
echo'<div class="fon">Пользователь с данным email уже есть на сайте.</div>';
}elseif(isset($email) and !preg_match("#^[A-z0-9-._]+@[A-z0-9]{2,}.[A-z]{2,4}$#ui",$email)){
$diz -> head('Ошибка');
echo'<div class="fon">'.language('Неверный формат email').'</div>';
}else{
if($email!=$ya['email'])
$db -> query("UPDATE `users` SET `email_act` = 'no' WHERE `id` = '".$ya['id']."'");
$db -> query("UPDATE `users` SET
`email` = '".$email."',
`site` = '".$site."',
`skype` = '".$skype."',
`number` = '".$number."' WHERE `id` = '".$ya['id']."'");
header('Location: ?do=contacts');
}
echo '<div class="levo"><a href="?do=contacts" class="levo_tuch">'.$diz -> icon('back.png').' '.language('Назад').'</a></div>';
}
break;
default:
$diz -> head('Личное');
$diz -> title('Личное');
if (!isset($_POST['submit'])) {
echo '<div class="but_razdel">
<div class="button_razdel"/><b>'.language('Личное').'</b></div>
<a href="?do=contacts" class="button_razdel">'.language('Контакты').'</a>
<a href="?do=inters" class="button_razdel">'.language('Интересы').'</a>
<a href="?do=avatar" class="button_razdel">'.language('Аватар').'</a>
</div>';
$d = 1;
$day = '<option desabled>'.language('День').'</option>';
while ($d <= 31) {
if ($d == $ya['day']) $day .= '<option selected value="'.$d.'">'.$d.'</option>';
else $day .= '<option value="'.$d.'">'.$d.'</option>';
++$d;
}
$m = 1;
$month = '<option desabled>'.language('Месяц').'</option>';
while ($m <= 12) {
if ($m == $ya['month']) $month .= '<option selected value="'.$m.'">'.$func->mes($m,2).'</option>';
else $month .= '<option value="'.$m.'">'.$func->mes($m,2).'</option>';
++$m;
}
$y=date('Y')-1;
$year = '<option desabled>'.language('Год').'</option>';
while ($y >=1960) {
if ($y == $ya['year']) $year .= '<option selected value="'.$y.'">'.$y.'</option>';
else $year .= '<option value="'.$y.'">'.$y.'</option>';
$y--;
}
$p = array('m' => 'Мужской', 'w' => 'Женский');
$p1 = null;
foreach ($p as $k1 => $v1) {
if ($ya['sex'] == $k1) $p1 .= '<option selected value="'.$k1.'">'.language($v1).'</option>';
else $p1 .= '<option value="'.$k1.'">'.language($v1).'</option>';
}
echo '<div class="fon"/><form action="profile.php?do=lich" method="post">
'.language('Имя').':<br/><input type="text" name="name" value="'.$ya['name'].'" maxlength="40"/><br/>
'.language('Отчество').':<br/><input type="text" name="otch" value="'.$ya['otch'].'" maxlength="60"/><br/>
'.language('Фамилия').':<br/><input type="text" name="fami" value="'.$ya['fami'].'" maxlength="40"/><br/>
'.language('Пол').':<br/><select name="sex">'.$p1.'</select><br/>
'.language('Дата рождения').':<br/>
<div class="date">
<select name="day" class="date">'.$day.'</select>
<select name="month" class="date">'.$month.'</select>
<select name="year">'.$year.'</select></div>';
if($db->settings('geopos')==1)echo '<hr>'.language('Город').': <a href="city.php"/>'.$fuser->region($ya['city'],2,1).'</a>';
echo '<br /><input type="submit" name="submit" value="'.language('Сохранить').'"/></form></div>';
} else {
$name = shit($_POST['name']);
$otch = shit($_POST['otch']);
$fami = shit($_POST['fami']);
$gorod = shit($_POST['gorod']);
$sex = (isset($_POST['sex']) && ($_POST['sex'] == 'm' or $_POST['sex'] == 'w')) ? trim($_POST['sex']) : 'm';
$day = (!empty($_POST['day']) && $_POST['day'] > 0 && $_POST['day'] < 32) ? intval(abs((int)$_POST['day'])) : null;
$month = (!empty($_POST['month']) && $_POST['month'] > 0 && $_POST['month'] <= 12) ? intval(abs((int)$_POST['month'])) : null;
$year = (!empty($_POST['year']) && $_POST['year'] >= 1960 && $_POST['year'] <= date('Y')-1) ? intval(abs((int)$_POST['year'])) : null;
$db -> query("UPDATE `users` SET `name` = '".$name."',`otch` = '".$otch."',`fami` = '".$fami."', `sex` = '".$sex."', `day` = '".$day."', `month` = '".$month."',
`year` = '".$year."' WHERE `id` = '".$ya['id']."'");
header('Location: ?do=lich');
}
}
echo '<div class="levo"><a href="./" class="levo_tuch">'.$diz -> icon('back.png').' '.language('Мой кабинет').'</a></div>';
echo '<div class="levo"><a href="/index.php" class="levo_tuch">'.$diz -> icon('home.png').' '.language('На главную').'</a></div>';
#####Копирайт#######
$diz -> out($msg);
}else header('location: '.ROOT.'aut.php');
?>