php5.3 does not support the eregi () function, how to convert with Preg_match? Ask the Great God for advice

Source: Internet
Author: User
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; }} 
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.