Chris wrote:
> Hmm... Jeg kan se at magic_quotes_gpc er "on" hos min udbyder (kan nok
> ikke ændres) så med mysql-escape-string (kører php vers. 4.2.3) får jeg
> dobbelt escaped. Eksempelvis bliver "O'Reilly" til "O\\\'Reilly".
Sakset fra:
http://dk.php.net/manual/en/function.get-magic-quotes-gpc.php
------------------------------------------------------------------------
In the interests of writing portable code (code that works in any
environment), 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.
Example 2. Disabling magic quotes at runtime
<?php
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
?>
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.
------------------------------------------------------------------------
Dvs. indstillingen kan godt ændres inden scriptet udføres og ellers kan
der laves høkerløsning for at omgå indstillingen.
Mvh Tommy