This article provides a detailed analysis of magicquotes in php. For more information, see
This article provides a detailed analysis of magic quotes in php. For more information, see
I checked the following manual. For php magic quotes, several common settings are as follows: magic_quotes_gpc, magic_quotes_sybase, and magic_quote_runtime. These functions are in php. configured in ini. We can see from the manual that these features have been abolished since php5.3, So we strongly recommend that you do not use them. Hong Kong servers are rented in php. ini.
These functions are used to escape data. When SQL injection is prevented, many people write as follows:
The Code is as follows:
If (! Get_magic_quotes_gpc ()){
$ Post = addslashes ($ post );
}
If they are enabled, the website space will automatically escape single quotes ('), double quotes ("), backslash (\), and NUL (null characters ), in fact, it is equivalent to calling the addslashes function. You may say that this is not very good. It is more secure. But, do you consider code portability in website space? In addition, do you need to escape all gpc ($ _ GET, $ _ POST, $ _ COOKIE) data? What is the overhead? The following is a detailed description of Magic Quotes in the manual:
1. magic_quotes_gpc
Magic_quotes_gpc is used to set the magic reference status of GPC ($ _ GET, $ _ POST, $ _ COOKIE) ($ _ ENV is also included in PHP4 ). When it is enabled, all single-quote, double quotation marks, backslash, and NUL's will be automatically escaped by the backslash. When magic_quote_sybase is on enabled, only singgle-quote will be escaped as ''by single quotation marks, double quotation marks, backslash, and NUL's will not be affected.
2. magic_quote_runtime
Magic_quote_runtime if this option is enabled, many functions that return external data (Database, text) will be escaped by backslash. If magic_quote_sybase is enabled, only single-quotes are escaped.
3. magic_quotes_sybase
Magic_quotes_sybase if this option is enabled, when magic_quotes_gpc and magic_quotes_runtime are enabled, single quotation marks are transferred by single quotation marks instead of backslash \ escape. At the same time, this setting will completely overwrite the magic_quotes_gpc settings, even if magic_quotes_gpc is set to on, double quotation marks ", backslash \ and NUL's will not be escaped.