set_magic_quotes_runtime and magic_quotes_gpc

set_magic_quotes_runtime () allows programmers to dynamically in the code on or off magic_quotes_runtime, set_magic_quotes_runtime (1) that open, set_magic_quotes_runtime (0) is that close. When set_magic_quotes_runtime (1) when, from the database or the like through the fread function to read the text, will be automatically '"and \ automatically with a backslash \ to escape, to prevent overflow. This is the data transfer database time is very useful. But in general, it should be closed, otherwise, the data from the database to read out single quotes, double quotes and backslashes will be added \, resulting in display abnormal. like Discuz, PHPWind are the head of public documents with a set_magic_quotes_runtime (0); forcibly closed magic_quotes_runtime.

The difference between magic_quotes_gpc and magic_quotes_runtime, magic_quotes_gpc is through GET, POST, COOKIE data transfer escape, generally carried out in the data storage before the first escape, magic_quotes_gpc can not be dynamically turned on or off the code needed to php.ini will magic_quotes_gpc set to on or off, the code can get magic_quotes_gpc get_magic_quotes_gpc state. When magic_quotes_gpc is off, you need to hand the data addslashes, the code is as follows:
PHP Code

   1. If (! Get_magic_quotes_gpc ()) (
   2. Add_slashes ($ _GET);
   3. Add_slashes ($ _POST);
   4. Add_slashes ($ _COOKIE);
   7. Function add_slashes ($ string) (
   8. If (is_array ($ string)) (
   9. Foreach ($ string as $ key => $ value) (
  10. $ String [$ key] = add_slashes ($ value);
  12.) Else (
  13. $ String = addslashes ($ string);
  15. Return $ string;

Declined comment

<蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <文本链> <文本链> <文本链> <文本链> <文本链> <文本链>