This article mainly introduces the addslashes function and SQL anti-injection in php. The example describes the use of the addslashes function for SQL anti-injection. It provides a good reference value for PHP Security program design, for more
In php, the addslashes function is used to solve the error. if you need a friend, refer to the following code. can you find the error?
The code is as follows:
Echo function_exists ('addcslashes'); // checks whether the function exists.Echo
PHP addcslashes () functionDefinition and usageThe addcslashes () function adds a backslash before the specified character.SyntaxAddcslashes (string, characters) parameter descriptionString is required. Specifies the string to be checked.Characters
Addslashes and mysql_real_escape_string. are filtered to make the data safe to insert into the database. So what's the difference between these two functions??Let's take a brief look at it today.First, we'll start with the PHP manual.The addslashes
Last month, I discussed Google's XSS Vulnerability and provided an example that demonstrates it. I was hoping to highlight why character encoding consistency is important, but apparently the addslashes () versus mysql_real_escape_string () debate
The Addslashes () function returns a string that adds a backslash before a predefined character.
The predefined characters are:
Single quotation mark (')
Double quotation marks (")
Back slash (\)
Null
Tip: This function can be
Htmlspecialchars and
Addslashes and
Et_magic_quotes_gpc
These three things seem to be no different, there seems to be a difference, do not know how to deal with the relationship between the three?
Reply to discussion (solution)
Today, the acquisition of a MySQL INSERT into the statement error, I write the code is collected after adding addslashes and then warehousing, supposedly there will be no problem, and picked up this line of words and no English and symbols, with
Introduction to htmlentities, htmlspecialchars, and addslashes usage, htmlspecialchars
1. html_entity_decode (): converts an html object to a character.
Eg:$str = "just atest & 'learn to use '";echo html_entity_decode($str);echo "";echo
First of all, you must first speak of PHP MAGIC_QUOTES_GPC. (GET_MAGIC_QUOTES_GPC () can detect if open)PHP MAGIC_QUOTES_GPC Scope is: Web client server; Action time: When the request starts. For example, when the script is running.
PHP's own library functions Addslashes () and Stripslashes () are string-processing class functions that are the opposite:
Addslashes (): Adds a backslash to some of the predefined characters in the input string, which is required for database
I. htmlentities () and Htmlspecialchars () 1, Htmlentities () 1.1 Features: Converts characters to HTML entities. Characters include ASCII entities and ISO 8859-1 entities (HTML entity tables: http://www.w3school.com.cn/tags/html_ref_entities.html) 1
The PHP addcslashes () function definition and usage addcslashes () function adds a backslash before the specified character. The syntax addcslashes (string,characters) parameter description string is required. Specify the string to
Addslashes and mysql_real_escape_string are all filtering to make the data safe to insert into the database, so what is the difference between these two functions?First, let's start with the PHP manual:
The addslashes escaped characters in
In this article, we mainly explain the meaning and usage of the three function methods of MAGIC_QUOTES_GPC, Mysql_real_escape_string and Addslashes, and illustrate the examples. Then the author expounds the difference between the three and the
This article mainly introduces the security principle of using the addslashes function escape in PHP, and analyzes the usage of the addslashes function and the limitations of the ecshop user-defined function addslashes_deep, which is very useful,
This document describes in detail the differences between mysql_real_escape_string and addslashes In the examples and php manuals.
This document describes in detail the differences between mysql_real_escape_string and addslashes In the examples and
Let's look at the following code. Can you find out where the error is?
Copy codeThe Code is as follows:Echo function_exists ('addcslashes'); // checks whether the function exists.Echo get_magic_quotes_gpc (). ''; // checks whether automatic escape
PHP addcslashes () functionDefinition and usageThe Addcslashes () function adds a backslash before the specified character.
GrammarAddcslashes (string,characters) parameter description
string is required. Specifies the string to check.
Characters
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.