<?php
#-----------------------------------------------------#
# ********* WAP-MOTORS ********* #
# Made by : VANTUZ #
# E-mail : [email protected] #
# Site : http://pizdec.ru #
# WAP-Site : http://visavi.net #
# ICQ : 36-44-66 #
# #
#-----------------------------------------------------#
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!="") {
if($nickname!==""){
if(strlen(utf_to_win(trim($nickname)))>20 || strlen(utf_to_win(trim($nickname)))<4){ header ("Location: profil.php?isset=strlennick&".SID); exit;}
//if (preg_match('/[^А-Яа-я0-9\- ]/i', $nickname)){ header ("Location: profil.php?isset=noeditnick&".SID); exit;}
//------------- Функция проверки запрещенных символов для UTF-8 --------------//
$arr=array("А","а","Б","б","В","в","Г","г","Д","д","Е","е","Ё","ё","Ж","ж","З","з","И","и","Й","й","К","к","Л","л","М","м","Н","н","О","о","П","п","Р","р","С","с","Т","т","У","у","Ф","ф","Х","х","Ц","ц","Ч","ч","Ш","ш","Щ","щ","Ь","ь","Ъ","ъ","Ы","ы","Э","э","Ю","ю","Я","я"," ","-","0","1","2","3","4","5","6","7","8","9");
$str=utf_to_win($nickname);
$len=strlen($str);
for($i=0;$i<$len;$i++){
$lit1=win_to_utf($str[$i]);
if (!in_array($lit1,$arr)){
header ("Location: profil.php?isset=noeditnick&".SID); exit;}
}
$dir = opendir (BASEDIR."local/profil");
while ($file = readdir ($dir)) {
if (ereg (".prof$", $file)) {
$a[]=$file;
}}
closedir ($dir);
$total = count($a);
//------------------- Проверка на уникальность ника ----------------------//
$provnickname=rus_utf_tolower(trim($nickname));
$provnickname=str_replace(" ","",$provnickname);
$provnickname=str_replace("-","",$provnickname);
for ($v = 0; $v < $total; $v++){
$provn = file(BASEDIR."local/profil/$a[$v]");
$vnick = explode(":||:",$provn[0]);
$vnick65=rus_utf_tolower(trim($vnick[65]));
$vnick65=str_replace(" ","",$vnick65);
$vnick65=str_replace("-","",$vnick65);
if($provnickname==$vnick65){
$arr_nicks="ok"; break;}
}
}
if($arr_nicks!="ok"){
//------------------------------ Запись в профиль ----------------------------//
$ufile = file(BASEDIR."local/profil/$log.prof");
$udata = explode(":||:",$ufile[0]);
$udata[14]=$ip;
$udata[65]=check(trim($nickname));
for ($u=0; $u<$config_userprofkey; $u++){
$utext.=$udata[$u].':||:';}
if($udata[0]!="" && $udata[1]!="" && $udata[4]!="" && $utext!=""){
$fp=fopen(BASEDIR."local/profil/$log.prof","a+");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,$utext);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
unset($utext);
}
header ("Location: ../index.php?isset=editnick&".SID);
} else { header ("Location: profil.php?isset=noesnick&".SID); exit;}
} else { header ("Location: ../index.php?isset=inputoff&".SID); exit;}
?>