Php anti-SQL injection filter code _ PHP Tutorial

Source: Internet
Author: User
Php anti-SQL injection filtering code. We provide three letters to filter out some special characters, mainly using php to filter out SQL sensitive strings. let's take a look at this code. If you have any need, we have provided three letters to filter out some special characters. we mainly used php to filter out SQL sensitive strings. let's take a look at this code. If you need it, take a look.

We provide three letters to filter out some special characters, mainly by using the php Tutorial to filter out SQL sensitive strings. let's take a look at this code. If you need it, take a look.

Function phps tutorial ql_show ($ str ){
$ Str = stripslashes ($ str );
$ Str = str_replace ("\", "", $ str );
$ Str = str_replace ("/", "/", $ str );
$ Str = str_replace ("", "", $ str );
$ Str = str_replace (",", $ str );
Return $ str;
}
Function phpsql_post ($ str ){
$ Str = stripslashes ($ str );
$ Str = str_replace ("|", "|", $ str );
$ Str = str_replace ("<", "<", $ str );
$ Str = str_replace (">", ">", $ str );
$ Str = str_replace ("", "", $ str );
$ Str = str_replace ("", "", $ str );
$ Str = str_replace ("(", "(", $ str );
$ Str = str_replace (")", ")", $ str );
$ Str = str_replace ("" ', "'", $ str );
// $ Str = str_replace ("'", "'", $ str );
$ Str = str_replace ('"'," ", $ str );
$ Str = str_replace (",", $ str );
$ Str = str_replace ("$", "$", $ str );
$ Str = str_replace ("", "\", $ str );
$ Str = str_replace ("/", "/", $ str );
Return $ str;
}
Function phpsql_replace ($ str ){
$ Str = stripslashes ($ str );
$ Str = str_replace ("'", "'", $ str );
Return $ str;
}

Bytes. A friend in need can take it...

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.