I'm working with ini_set. There's an option, magic_quotes_gpc, that, when on, ruins the software project I'm working on. But, I'm having trouble turning it off. I tried this:
ini_set("magic_quotes_gpc", "0");
But, that fails. Anyone?
If you don't need slashes in $POST and $GET there is another solution without changing ini settings:
<?php function StripMagicQuotes($arr) { reset($arr); while( list($key,$value) = each($arr) ) { if( is_array($value) ) { $arr[$key] = StripMagicQuotes($value); } else { if( is_string($value) ) $arr[$key] = stripslashes($value); } } return $arr; } if( get_magic_quotes_gpc() > 0 ) { $_POST = StripMagicQuotes($_POST); $_GET = StripMagicQuotes($_GET); } ?>
try off istead of 0
According to PHP manual "magic_quotes_gpc" directive cannot be set at runtime. The only directive can be set at runtime is "magic_quotes_runtime", but there is no effect on POST and GET variables.
jsim wrote:According to PHP manual "magic_quotes_gpc" directive cannot be set at runtime. The only directive can be set at runtime is "magic_quotes_runtime", but there is no effect on POST and GET variables.
Is there another option? I read somewhere that .htaccess is an alternative.
Bumping is refrained against... so is cross-posting!
I've locked this thread in favor of your other one here