29 lines
765 B
PHP
29 lines
765 B
PHP
<?php
|
|
|
|
class UserRegister
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
|
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
|
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
|
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
|
} else {
|
|
$ip = $_SERVER['REMOTE_ADDR'];
|
|
}
|
|
define('IP', $ip);
|
|
if ($_SERVER['HTTP_REFERER'] == 'https://new-combats.com/' && $_COOKIE['acomb1'] != '2') {
|
|
setcookie('acomb1', '1', time() + 60 * 60 * 24 * 3);
|
|
}
|
|
}
|
|
|
|
public function en_ru($txt)
|
|
{
|
|
$en = preg_match("/^(([0-9A-z _-])+)$/i", $txt);
|
|
$ru = preg_match("/^(([0-9À-ÿ _-])+)$/i", $txt);
|
|
return ($ru && $en) || (!$ru && !$en);
|
|
}
|
|
|
|
}
|