We know that the role of the addslashes () function is to add backslashes before some of the predefined characters in the input string. So how does it relate to our anti-SQL injection?
What is SQL injection?
SQL injection attacks are the most
Recently learned to learn PHP, see this piece of codefunction Daddslashes ($STR) {Return (!GET_MAGIC_QUOTES_GPC ())? Addslashes ($STR): $str;}Found GET_MAGIC_QUOTES_GPC ()) and addslashes () function is not familiar with, looked up the following
: This article mainly introduces examples of character string conversion and restoration usage of addslashes and stripslashes in PHP. For more information about PHP tutorials, see. The example in this article describes how to convert and restore
The addslashes function in php adds a diagonal line to the quotation marks in the strings to be processed by the database for the smooth operation of the database query. The modified characters include single quotation marks ('), double quotation
Very good explains the difference between addslashes and mysql_real_escape_string, although many PHP coder in the country still rely on addslashes to prevent SQL injection (including me), I still recommend that you strengthen the Chinese to prevent
This article will briefly introduce some usage and differences of addslashes (), mysql_real_escape_string () and mysql_escape_string () in php. if you have any questions, please refer to them... this article briefly introduces some usage and
Differences between htmlspecialchars and addslashes and et_magic_quotes_gpc htmlspecialchars and
Addslashes and
Et_magic_quotes_gpc
There seems to be no difference between these three things. I don't know how to deal with the relationship between
This article describes the differences between using mysql_real_escape_string to sort user submitted data and using addslashes and mysql_escape_string functions. The escaped data can be directly inserted into the database.
The difference between
When we write data to mysql, for example:
Copy codeThe Code is as follows:Mysql_query ("update table set 'title' = 'kuhanzhu's blog '");Then an error occurs. Like asp, databases are allergic to single quotes. Addslashes has the longest face at this
Transfer from http://czf2008700.blog.163.com/blog/static/2397283200937103250194/Addslashes--use a backslash to reference a stringString addslashes (String str)Returns a string that is preceded by a backslash in order for the database query statement
Http://yangjunwei.com/a/589.htmlPHP'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
We pass onDefinition and usage
The Addslashes () function adds a backslash before the specified predefined character.
These predefined characters are:
Single quotation mark (')Double quotation marks (")Back slash ()Null
GrammarC
Parameter
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
The Addslashes () function in PHP is to add a backslash before some of the predefined characters in the input string, but if you find yourself
using PHP addslashes function error,Then you need to take a good look at your code. If you don't believe
Examples in this article describe the use of addslashes () and stripslashes () in PHP for string escaping and restoration. Share to everyone for your reference, as follows:
The addslashes () function in PHP returns a string that adds a backslash
Very good description of the difference between addslashes and mysql_real_escape_string, although many of the domestic PHP coder still rely on addslashes to prevent SQL injection (including me), I suggest that we strengthen the Chinese to prevent
Syntax: string addslashes (String str);
Content Description
This function slashes the quotation marks in strings that need to be processed by the database so that database queries (query) can function smoothly. The characters that will be changed
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
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, there are two functions related to the escape of strings: addslashes and stripslashes.
Addslashes ($ string), which is used to add a backslash (\) before a specified predefined character to prepare a suitable string for the string stored in
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.