<?
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_wmid']) && (is_numeric($_POST['ank_wmid']) && strlen($_POST['ank_wmid'])>=10 && strlen($_POST['ank_wmid'])<=18 || $_POST['ank_wmid']==NULL))
//if (isset($_POST['ank_wmid']) && preg_match('#^([A-z]*)$#ui', $_POST['ank_wmid']))
{
$_POST['ank_wmid'];
$qq=mysql_query("SELECT * FROM `user` WHERE `ank_wmid` = '".mysql_real_escape_string($_POST['ank_wmid'])."'");
if(mysql_num_rows($qq)>0){
$err[]='Такой WMID уже есть!';
}
else
{
mysql_query("UPDATE `user` SET `ank_wmid` = '".mysql_real_escape_string($_POST['ank_wmid'])."' WHERE `id` = '$user[id]' LIMIT 1");
}
}
else $err[]='Неверный формат номера WMID';

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

}
################################################################################
/*if (isset($_POST['save'])){
###########################
if (isset($_POST['ank_wmid']) && (is_numeric($_POST['ank_wmid']) && strlen($_POST['ank_wmid'])>=10 && strlen($_POST['ank_wmid'])<=18 || $_POST['ank_wmid']==NULL))
{
$user['ank_wmid']=$_POST['ank_wmid'];
mysql_query("UPDATE `user` SET `ank_wmid` = '$user[ank_wmid]' WHERE `id` = '$user[id]' LIMIT 1");
}
else $err[]='Неверный формат номера WMID';

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

}
*/
err();
aut();
################################################################################
if($user['ank_wmid']!=NULL){
echo "$user[ank_wmid]<br />";
echo "Из соображений безопасности данные WMID изменить нельзя<br />";
}
else
{
echo "<form method='post' action='?$passgen'>\n";
echo "Ваш WMID:<br />";
echo "<input type='text' name='ank_wmid' value='$user[ank_wmid]' maxlength='18' /><br />\n";
echo "<input type='submit' name='save' value='Сохранить' />\n";
echo "</form>\n";
}
################################################################################
echo "<div class='foot'>\n";
echo "&raquo;<a href='/anketa.php'>К списку</a><br />\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';
?>