I am not sure which version of PHP you are using but the error gives you the hint -
Quote:
Call to undefined function eregi()
The erigi function has been removed since version 7.0.0 of PHP, if you are on a higher version, it will not recognise 'eregi' function -
eregi PHP[
^]
Quote:
Warning
This function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.
Alternatives to this function include:
preg_match() (with the i (PCRE_CASELESS) modifier)
You can read up more on regular expressions in PHP at -
PHP Regular Expressions[
^]
You need to change the line to -
if ( !@eregi("^[a-zA-Z0-9_]+$", $_POST["login"]))
if (!preg_match("/^[a-zA-Z0-9_]+$/", $_POST["login"]))
Your code will thus read -
if (isset($_POST["regsub"])) {
$err = NULL;
db_connect();
if (db_rows(db_query("SELECT `id` FROM `".DBpref."users` WHERE `login` = '".db_string($_POST["login"])."' OR `email` = '".db_string($_POST["email"])."'")) != 0)
$err .= "<li>Логин или E-mail уже используются</li>";
if (strlen($_POST["login"]) < 4)
$err .= "<li>Минимальная длина логина 4 символа</li>";
if (!preg_match("/^[a-zA-Z0-9_]+$/", $_POST["login"]))
$err .= "<li>В логине допускается только кирилица и символ _</li>";
if (!checkEmail($_POST["email"]))
$err .= "<li>E-mail введен не корректно</li>";
if (strlen($_POST["pass"]) < 6)
$err .= "<li>Минимальная длина пароля 6 символов</li>";
if ($_POST["pass"] != $_POST["pass2"])
$err .= "<li>Подтверждение пароля не совпадает</li>";
if ($err == NULL) {
$ref = NULL;
if (isset($_SESSION["ref"])) {
if (db_rows(db_query("SELECT `id` FROM `".DBpref."users` WHERE `login` = '".db_string($_SESSION["ref"])."'")) == 1)
$ref = $_SESSION["ref"];
}
db_query("INSERT INTO `".DBpref."users` (`balance`, `login`, `email`, `pass`, `ref`, `wmid`, `wmr`, `genus`, `regdat`, `ip`, `logdat`) VALUES (1, '".db_string($_POST["login"])."', '".db_string($_POST["email"])."', '".heshPass($_POST["pass"])."', '".db_string($ref)."', '', '', '".intval($_POST["genus"])."', '".date("Y-m-d H:i:s")."', '".getIP()."', '".date("Y-m-d H:i:s")."')");
$_SESSION["login"] = $_POST["login"];
echo "<ul class='good'><li>Регистрация успешно завершена</li></ul>
<script type='text/javascript'>
location.replace('/?p=profile');
</script>";
$regok = true;
} else {
echo "<ul class='error'>".$err."</ul>";
}
db_close();
}