View file sdark.mobi/set/email.php

File size: 1.25Kb
<?
require_once '../core/system.php';
echo only_reg();
echo ban();
$header = 'Смена E-mail';
require_once H.'core/head.php';
if($user['pumpit'] > 0  OR $user['fs_id'] > 0  OR $user['ok'] > 0){
header('Location: /');
$_SESSION['message'] = 'Доступ с данного кабинета закрыт!';
exit();
}

switch($act) {
case 'post':
if(isset($_POST['email'])){
$email = check($_POST['email']);
if(strlen($email) < 8 or strlen($email) > 30) $err =  'Длина e-mail должна быть от 8 до 30 символов';
if(!isset($err)) {
mysql_query("UPDATE `user` SET `email` = '".$email."' WHERE `id` = '$user[id]' LIMIT 1");
header('Location: ?');
$_SESSION['message'] = 'E-mail изменен!';
exit();
}else{
header('Location: ?');
$_SESSION['err'] = $err;
// Вывод ошибки 
exit();
} 
}else{
header('Location: /settings');
$_SESSION['err'] = 'Введите E-mail';
exit();
}
break; 
default:
echo '<div class="head"><form method="post" action="?act=post">
Ваш E-mail:<br /><input class="text large" type="text" value="'.$user['email'].'" name="email" />
<span class="btn"><span class="end"><input class="inpc-ar"  type="submit" value="Изменить">Изменить</span></span>
</form></div>';
}
require_once H.'core/foot.php';
?>