php5.3 does not support eregi () function, how to convert with Preg_match? Ask the great God for advice!
function Inject_check ($sql _str) {
$check =eregi (' select|insert|update|delete|\ ' |\\*|\*|\.\.\/|\.\/|union|into|load_file|outfile ', $sql _str); To filter
if ($check) {
echo "Input illegal injection content!";
Exit ();
}else{
return $sql _str;
}
}
Today on the Internet to find a way to prevent SQL injection, but after the run found eregi () This function in the 5.3 version has been unable to use, prompted the use of outdated functions, so I went online to find information, online review is also said to use the Preg_match () function instead of the eregi () function, But I changed the function name to Preg_match and not, it seems that the parameters are wrong, trouble to know the teaching me, the correct preg_match should be how to change, thank you!
------Solution--------------------
PHP code
preg_match ('/select|insert|update|delete|\ ' |\\*|\ *|\.\.\/|\.\/|union|into|load_file|outfile/i ', $sql _str);
------Solution--------------------
PHP code
function in Ject_check ($sql _str) {$check =preg_match ('/select|insert|update|delete|\ ' |\\*|\*|\.\.\/|\.\/|union|into|load_ File|outfile/i ', $sql _str); To filter if ($check) {echo "Input illegal injection content!"; Exit (); }else{return $sql _str; }}