<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';

only_reg();
$set['title']='Связь';
include_once '../sys/inc/thead.php';
title();
################################################################################
if (isset($_POST['save'])){
if (isset($_POST['ank_mail']) && ($_POST['ank_mail']==null || preg_match('#^[A-z0-9-\._]+@[A-z0-9]{2,}\.[A-z]{2,4}$#ui',$_POST['ank_mail'])))
{
$_POST['ank_mail'];
$qq=mysql_query("SELECT * FROM `user` WHERE `ank_mail` = '".mysql_real_escape_string($_POST['ank_mail'])."'");
if(mysql_num_rows($qq)>0){
$err[]='Такой E-MAIL уже есть!';
}
else
{
mysql_query("UPDATE `user` SET `ank_mail` = '".mysql_real_escape_string($_POST['ank_mail'])."' WHERE `id` = '$user[id]' LIMIT 1");
}
}
else $err[]='Неверный формат номера E-MAIl';

if (!isset($err))msg('Изменения успешно приняты');

}
################################################################################
err();
aut();
################################################################################
if($user['ank_mail']!=NULL){
echo "$user[ank_mail]<br />";
echo "В целях безопасности данные E-MAIL изменить нельзя<br />";
}
else
{
echo "<form method='post' action='?$passgen'>\n";
echo "* Ваш E-MAIL:<br />";
echo "<input type='text' name='ank_mail' value='$user[ank_mail]' maxlength='32' /><br />\n";
echo "<input type='submit' name='save' value='Сохранить' />\n";
echo "</form>\n";
echo "* E-MAIL заполняется один раз.\n";
}
################################################################################

if(isset($_SESSION['refer']) && $_SESSION['refer']!=NULL && otkuda($_SESSION['refer']))
echo "&laquo;<a href='$_SESSION[refer]'>".otkuda($_SESSION['refer'])."</a><br />\n";

echo "&laquo;<a href='/umenu.php'>Мое меню</a><br />\n";
echo "</div>\n";

include_once '../sys/inc/tfoot.php';
?>
