2022-06-06 21:30:34 +00:00
|
|
|
|
<?php
|
|
|
|
|
define('GAME',true);
|
|
|
|
|
include_once('_incl_data/__config.php');
|
|
|
|
|
include_once('_incl_data/class/__db_connect.php');
|
|
|
|
|
|
|
|
|
|
if(isset($_GET['login'])) {
|
|
|
|
|
//
|
2023-01-10 17:26:14 +00:00
|
|
|
|
$_GET['login'] = htmlspecialchars($_GET['login'],NULL);
|
2022-06-06 21:30:34 +00:00
|
|
|
|
//
|
|
|
|
|
$bad = array(
|
2023-01-10 16:29:32 +00:00
|
|
|
|
'Мусорщик' => 1,
|
|
|
|
|
'Мироздатель' => 1
|
2022-06-06 21:30:34 +00:00
|
|
|
|
);
|
|
|
|
|
//
|
|
|
|
|
function en_ru($txt) {
|
|
|
|
|
$g = false;
|
|
|
|
|
$en = preg_match("/^(([0-9a-zA-Z _-])+)$/i", $txt);
|
2023-01-10 16:29:32 +00:00
|
|
|
|
$ru = preg_match("/^(([0-9а-яА-Я _-])+)$/i", $txt);
|
2022-06-06 21:30:34 +00:00
|
|
|
|
if(($ru && $en) || (!$ru && !$en)) {
|
|
|
|
|
$g = true;
|
|
|
|
|
}
|
|
|
|
|
return $g;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
function testBad($txt) {
|
2023-01-10 16:29:32 +00:00
|
|
|
|
$white = '-_ 0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMЁЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮёйцукенгшщзхъфывапролджэячсмитьбю';
|
2022-06-06 21:30:34 +00:00
|
|
|
|
$r = false;
|
|
|
|
|
$i = 0;
|
|
|
|
|
while( $i != -1 ) {
|
|
|
|
|
if( isset($txt[$i]) ) {
|
|
|
|
|
$g = false;
|
|
|
|
|
$j = 0;
|
|
|
|
|
while( $j != -1 ) {
|
|
|
|
|
if(isset($white[$j])) {
|
|
|
|
|
if( $white[$j] == $txt[$i] ) {
|
|
|
|
|
$g = true;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$j = -2;
|
|
|
|
|
}
|
|
|
|
|
$j++;
|
|
|
|
|
}
|
|
|
|
|
if( $g == false ) {
|
|
|
|
|
$r = true;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$i = -2;
|
|
|
|
|
}
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
return $r;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
$login = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `login` = "'.mysql_real_escape_string($_GET['login']).'" LIMIT 1'));
|
|
|
|
|
if( isset($login['id']) || isset($bad[$_GET['login']]) ) {
|
2023-01-10 16:29:32 +00:00
|
|
|
|
echo '<b style="color:red">Логин занят.</b>';
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}else{
|
|
|
|
|
$true = true;
|
|
|
|
|
//
|
|
|
|
|
/*
|
2023-01-10 16:29:32 +00:00
|
|
|
|
Логин может содержать от 4 до 16 символов, и состоять только из букв русского ИЛИ английского алфавита, цифр, символов '_', '-' и пробела.
|
|
|
|
|
Логин не может начинаться или заканчиваться символами '_', '-' или пробелом.
|
2022-06-06 21:30:34 +00:00
|
|
|
|
*/
|
|
|
|
|
//
|
|
|
|
|
$_GET['login'] = str_replace(' ',' ',$_GET['login']);
|
|
|
|
|
$_GET['login'] = str_replace('%',' ',$_GET['login']);
|
|
|
|
|
$_GET['login'] = str_replace(' ',' ',$_GET['login']);
|
|
|
|
|
//
|
|
|
|
|
if( strlen($_GET['login']) > 16 ) {
|
|
|
|
|
$true = false;
|
|
|
|
|
}elseif( strlen($_GET['login']) < 4 ) {
|
|
|
|
|
$true = false;
|
|
|
|
|
}elseif( strripos($_GET['login'],' ') == true ) {
|
|
|
|
|
$true = false;
|
|
|
|
|
}elseif( substr($_GET['login'],1) == ' ' || substr($_GET['login'],-1) == ' ' ) {
|
|
|
|
|
$true = false;
|
|
|
|
|
}elseif( substr($_GET['login'],1) == '-' || substr($_GET['login'],-1) == '-' ) {
|
|
|
|
|
$true = false;
|
|
|
|
|
}elseif( substr($_GET['login'],1) == '_' || substr($_GET['login'],-1) == '_' ) {
|
|
|
|
|
$true = false;
|
|
|
|
|
}elseif( testBad($_GET['login']) == true ) {
|
|
|
|
|
$true = false;
|
2023-01-10 16:29:32 +00:00
|
|
|
|
}elseif( en_ru(str_replace('ё','е',str_replace('Ё','Е',$_GET['login']))) == true ) {
|
2022-06-06 21:30:34 +00:00
|
|
|
|
$true = false;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if( $true == false ) {
|
2023-01-10 16:29:32 +00:00
|
|
|
|
echo '<b style="color:red">Неверный логин.</b>';
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}else{
|
2023-01-10 16:29:32 +00:00
|
|
|
|
echo '<b style="color:green">Логин свободен!</b>';
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|