I used a PHP script over 9 years ago.
After updating PHP version to latest stable one (PHP 5.4.1.1), my script no longer works.
I found the problem area, Can anyone help me to convert this old PHP code to latest PHP 5.4.11.
if ((strlen($user_name)<$nick_min_length) or (strlen($user_name)>$nick_max_length)) {
$error_text ="$w_incorrect_nick<br><a href=\"index.php\">$w_try_again</a>";
include($file_path."designes/".$design."/error_page.php");
exit;
}
if (ereg("[^".$nick_available_chars."]", $user_name)) {
$error_text ="$w_incorrect_nick<br><a href=\"index.php\">$w_try_again</a>";
include($file_path."designes/".$design."/error_page.php");
exit;
}
if (strtolower($user_name) == strtolower(strip_tags($w_rob_name))) {
$error_text ="$w_incorrect_nick<br><a href=\"index.php\">$w_try_again</a>";
include($file_path."designes/".$design."/error_page.php");
exit;
}
should be:
ereg()is deprecated and should not be used. Also with preg_match() you want to make sure special characters within your variable are properly escaped so you would use preg_quote() and the regex would need delimiters, I put/in this case.