1. Use mysql_real_escape_string instead of addslashes to escape the input. 2. Add single quotation marks on both sides of the field value. 1. Use mysql_real_escape_string to escape the input. 2. Add single quotes on both sides of the Field
This article provides four filter HTML tags of the function code, one of the simplest use of PHP's own function strip_tags to filter all HTML tags, method two use regular expressions to filter HTML tags, method Three is to clear the HTML tag
form submission or URL get value in the Web site we may encounter some security issues, below I summarize some commonly used to filter some dangerous special characters of the solution, in general, for the characters passed in, PHP can be processed
Php filters ascii control characters. Share the following method to filter ascii control characters in PHP. Import the data of other websites crawled to xml. The problem is that the webpage has ascII control characters. At first, we thought it was a
Function code:
Copy CodeThe code is as follows:
PHP Batch filter Post,get sensitive data
if (GET_MAGIC_QUOTES_GPC ()) {
$_get = Stripslashes_array ($_get);
$_post = Stripslashes_array ($_post);
}
Function Stripslashes_array (& $array) {
while (list
This article to give you a summary of some commonly used in PHP anti-PHP injection, SQL injection of some methods introduced, in PHP provides HTMLSPECIALCHARS/ADDSLASHES/STRIPSLASHES/STRIP_TAGS/MYSQL_ Real_escape_string, such as several functions,
/** * Created by JetBrains Phpstorm.* USER:LSL* date:13-8-28* Time: PM 2:58* Sensitive Word Filter Tool class* How to use* echo filtertools::filtercontent ("You Fuck me fuck the wolf hybrid two mountain food", "*", DIR. " Config/word.txt ", $GLOBALS
PHP Filters HTML strings, prevents SQL injection, and uses functions to filter out illegal information, as well as malicious HTML code, by using a string that will be written to the database.
Code:
PHP Batch filter Post,get sensitive dataif
The original station a lot of articles are excerpts of the external article, the article many links are either time has expired, or is some of the test URL, such as: http://localhost/, such as, link more words, the formation of a lot of dead links,
& Lt ;? Php /************************************** ******************************* process description: * When the required parameters are passed to the filter function, the filter () function first obtains all the tags to be filtered in the string
Use PHP to filter the code in HTML that might be exploited to introduce external dangerous content. Sometimes, you need to let users submit HTML content in order to enrich the information that users post, of course, some may cause the Display page
1, delete HTML annotation;2, delete script, link, object, embed, IFRAME, frame, frameset and have on the beginning, including Web page effects: [^;] or expression the label of the attribute;3, delete the annotations in the CSS tutorial (prevent this
Example 1
The code is as follows
Copy Code
badword.src.phpThe contents are as follows$badword =array (' John ', ' Toyota ');PHP FilterRequire (' badword.src.php ');$badword 1 = array_combine ($badword, Array_fill
Addslashes ();Stripslashes (); Escape special characters when working with database tutorialsDefinition: the Addslashes () function adds a backslash before the specified predefined character.Syntax: Addslashes (String)Chop (); Remove the right space
The following is the program code:
Copy Code code as follows:
function uhtml ($STR)
{
$farr = Array (
"/\s+/",//filter Excess blank
Filtering etc. may introduce malicious content or maliciously change the display layout of the code, if
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.