Home >Backend Development >PHP Tutorial >Introduction to malicious characters
The principle of using PHP to filter malicious characters is very simple. We only need to define the characters and then use foreach to traverse the malicious character library, and use strpost to detect whether there are any characters in the malicious character library in the data submitted by the user. Example 1, determine whether a character exists code show as below Copy code function is_bad_chars($str){ $bad_chars = array("\",' ',"'",'"','/','*',',','',"r","t","n",'$' ,'(',')','%','+','?',';','^','#',':',' ','`','=','| ','-'); foreach($bad_chars as $value){ if (strpos($str,$value) !== false){ return tr
1. php determines whether there is a malicious character instance_PHP tutorial
Introduction: php determines whether there is a malicious character instance . The principle of using PHP to filter malicious characters is very simple. We only need to define the characters and then use foreach to traverse the malicious character library, and use strpost to detect whether there are malicious characters in the data submitted by the user.
##2. php filters all malicious characters (batch filters posts, gets sensitive data)_PHP tutorial
Introduction: php filters all malicious characters (batch filters posts, gets sensitive data) . Function code: Copy the code as follows: //php batch filter post, get sensitive data if (get_magic_quotes_gpc()) { $_GET = stripslashes_array($_GET); $_POST = stripslashes_array($_POS
3. php filters all malicious characters (batch filter post, get sensitive data)
Introduction: php filters all malicious characters (batch filter post, get Sensitive data). Function code: Copy the code as follows: //php batch filter post, get sensitive data if (get_magic_quotes_gpc()) { $_GET = stripslashes_array($_GET); $_POST = stripslashes_array($_POS
4. php filters malicious characters
##Introduction: php filtering Malicious characters
5.
php Determine whether there are malicious characters Example
Introduction: The principle of using PHP to filter malicious characters is very simple Simply, we only need to define the characters and then use foreach to traverse the malicious character library, and use strpost to detect whether there are characters in the malicious character library in the data submitted by the user. Example 1, to determine whether the characters exist, the code is as follows...6.
php filter all malicious characters (batch filter post, get sensitive data)_php skills
Introduction: recent dedecms Vulnerabilities are constantly being reported. Let me share the filtering function of PHP here. Let the experts pass by and use it to learn and communicate with others.[Related Q&A recommendations]:
How to filter RLO characters in php to prevent text flipping
The above is the detailed content of Introduction to malicious characters. For more information, please follow other related articles on the PHP Chinese website!