Detailed analysis of phpaddslashes functions. Syntax: stringaddslashes (stringstr); content description this function adds a diagonal line to the quotation marks in the strings to be processed by the database, so that the database query can operate
I understand some SQL injection methods in php. The following describes all the most common SQL injection methods. For more information, see.
What is injection?
For example, when we query the database, we use the ID number of the Article to retrieve
When your data contains some \"'This type of character is useful when it is written to the database and is not filtered out. It will automatically add \ before these characters, suchChina \ "Haha"China \ \ "Haha \"You can use
Listen to Promise said Casi out 2.0, and promise also gave a loophole address, just nothing to test a bit, recently very depressed, learn not to go on, just today promised to remind me of the good time to learn PHP, see if I can make such a
Specific usage
addslashes prevents SQL injection
Although many domestic PHP programmers are still relying on addslashes to prevent SQL injection, it is recommended that you strengthen the Chinese to prevent SQL injection inspection. The problem
One, what is magic quotes
Reminder: This feature has been discarded from PHP 5.3.0 and will be removed from PHP 5.4.0.So after version 5.4 the PHP profile is not found with the configuration information of the magic quotes
When opened, all '
SQL injection problems in the ASP but noisy, of course, there are many well-known domestic and foreign PHP program "died". As for the details of the SQL injection, there are too many articles on the web, not to be introduced here.
If the
Original works author Water Mengchun, reproduced please specify the source lib.cublog.cnRead the premise: you must read the " Part IV Security" chapter "10th Magic Quotes" in the PHP manual. If you haven't seen it, it's no problem, now take 10
This article introduces the differences between magic_quotes_gpc and magic_quotes_runtime. If you need a friend, refer to \ "'in your data \"'
This type of character is useful when it is written to the database and is not filtered out. it will
Differences between magic_quotes_gpc and magic_quotes_runtime and their usage. It is useful when you want to write some characters such as 'into the database and want not to be filtered out. it will be automatically added before these characters,
Php filters out special characters of SQL anti-injection code
// Method 1
// Filter ', ", SQL language name
Addslashes ();
// Method 2: Remove all html tags
Strip_tags ();
// Method 3: filter
This article introduces the differences between magic_quotes_gpc and magic_quotes_runtime. If you need a friend, refer to \ "'in your data \"'
Such a character is useful when it is written to the database and is not filtered out. it is automatically
Keywords: allinurl: borrow. php? Diskid =Keywords: allintitle: videodb # Vendor: http://www.videodb.net/blog/ $ -----------#| Initialverun |&------------@ Along with this I was able in some sites to determine that you can overwrite the databse
When your data has some \ "'
Such a character to write to the database inside, and want to not be filtered out, it is very useful, will be in front of these characters automatically add \, such as
China's vast territory "haha"
China \ \ 's vast
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,
How to understand this sentence if (ini_get ('Magic _ quotes_gpc '))
And the following section
If (ini_get ('Magic _ quotes_gpc ')){
Function stripslashesRecursive (array $ array ){
Foreach ($ array as $ k => $ v ){
If (is_string ($ v )){
$ Array [
Use the Addslashes function in PHP to prevent SQL injection.Although many PHP programmers in the country still rely on addslashes to prevent SQL injection, it is recommended to strengthen Chinese to prevent SQL injection check.The problem with
Phpmysql character Escape & lt; inputtypenamevaluethissaapple & gt; background processing $ nameaddslashes ($ _ POST [name]); is the escape single quotation mark insert stored in the database together with the escape symbol? Or are escape characters
if (Ini_get (' MAGIC_QUOTES_GPC '))
and the following paragraph.
if (Ini_get (' MAGIC_QUOTES_GPC ')) {
function stripslashesrecursive (array $array) {
foreach ($array as $k = = $v) {
if (is_string ($v)) {
$array [$k] = stripslashes ($v);
} else 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.