PHP 5.3 Ereg () is not working properly, prompting "Function ereg () is deprecated Error".
The source of the problem is that there are two regular representations in PHP, one is POSIX, the other is PERL,PHP6 's intention to abolish POSIX regular representations, so we added a preg_match later. This problem solution is very simple, before ereg add a filter hint information symbol can be: the Ereg () into @ereg (). This shielding the hint information, but the fundamental problem is not resolved, PHP in the 5.2 version before ereg are used normally, after 5.3, it is necessary to use Preg_match to replace the ereg. So it needs to be like this,
Originally: Ereg ("^[0-9]*$", $page) into: Preg_match ("/^[0-9]*$/", $page)
Special reminder: POSIX and Perl is the obvious difference is whether to add a slash, so compared with Ereg, the latter in the regular before and after the increase of two "/" symbol, can not be missing.
Cases
Change before: function Inject_check ($sql _str) {
$sql _str = strtolower ($sql _str);
Return eregi (' fopen|post|eval|select|insert|and|or|update|delete| ' | /*|*|.. /|. /|union|into|load_file|outfile ', $sql _str); To filter
}
Workaround:
Locate the file location where the code resides
function Inject_check ($sql _str) {
$sql _str = strtolower ($sql _str);
Return Preg_match ('/fopen|post|eval|select|insert|and|or|update|delete| ' | /*|*|.. /|. /|union|into|load_file|outfile/', $sql _str); To filter
}
Note: Be sure to add '/' Start and End oh.
Tips: This issue does not appear before the php5.2 version.