From ce8da4a0362ccb00ab8bff201d6f52e6341989e8 Mon Sep 17 00:00:00 2001 From: Aidan Lister Date: Tue, 6 Jul 2004 07:10:06 +0000 Subject: [PATCH] Added a second example git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@162733 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../info/functions/get-magic-quotes-gpc.xml | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/reference/info/functions/get-magic-quotes-gpc.xml b/reference/info/functions/get-magic-quotes-gpc.xml index 00156f6d30..d5e47fde0b 100644 --- a/reference/info/functions/get-magic-quotes-gpc.xml +++ b/reference/info/functions/get-magic-quotes-gpc.xml @@ -1,11 +1,11 @@ - + get_magic_quotes_gpc - Gets the current active configuration setting of magic quotes gpc + Gets the current configuration setting of magic quotes gpc @@ -15,7 +15,7 @@ - Returns the current active configuration setting of magic_quotes_gpc (0 for off, 1 for on). @@ -31,8 +31,8 @@ - Keep in mind that - magic_quotes_gpc can not be set at runtime. + Keep in mind that the setting + magic_quotes_gpc will not work at runtime. See example 2. @@ -57,6 +57,30 @@ $sql = "INSERT INTO lastnames (lastname) VALUES ('$lastname')"; + + In the interests of writing portable code (code that works + in any enviroment), or, if you do not have access to change + php.ini, you may wish to disable the effects of magic quotes + on a per-script basis. This can be done in two ways, with a + directive in a .htaccess file (php_value magic_quotes_gpc 0), + or by adding the below code to the top of your scripts. + + Disabling magic quotes at runtime + + + + + Magic-quotes was added to reduce code written by beginners from being dangerous. + If you disable magic quotes, you must be very careful to protect yourself from + SQL injection attacks. + See also addslashes, stripslashes,