Methods and code examples for safe filtering of special characters in PHP

WBOY
Release: 2016-07-25 09:13:35
Original
1289 people have browsed it



字Php The method and code example of the special character's security filtering
    & function checkhacks ($ Checkinfo, $ action) {// action 0 directly exit and prompts, replace the dangerous Chinese

  1.                                                                                                       ;$i
    (IF (STRPOS ($ Checkinfo, $ Badwords [$ i])! = False) {


  2. IF ($ Action == "0") {

  3. Echo "system detects prohibited Special characters: ". $ Badwords [$ i];

  4. exit;

  5. Break;}} elseif ($ action ==" 1 ") {

  6. $ Checkinfo = Str_replace ($ badwords [$ i]," "" "" "" "" "" "" "" "" "" "" "" ,$checkinfo);

  7.                                                                                                                                                                                                                                                                                                                                                                                                                /*********************Call functions************************** **** *********************************************

  8.                                                                        >

  9. Copy code


  10. function, action, false, count, detection



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!