开发者

how to set get_magic_quotes_gpc to Off

How can I set get_magic_quotes_gpc to Off in php.ini ? I have tried to overwrite value to Off in php.ini. it is showing Off in file but when i echo, it returns 1 means On.

any suggesion th开发者_StackOverflow社区at can help me..

I am using XAMPP server ...


ini_set("magic_quotes_gpc", "Off");

it will only work for old versions of PHP. Newer versions of PHP will not allow you to change the setting


Did you restart the apache server? You have to restart the server to force php.ini to be reprocessed


You can use this portable code

    <?php
if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
    foreach ($val as $k => $v) {
        unset($process[$key][$k]);
        if (is_array($v)) {
            $process[$key][stripslashes($k)] = $v;
            $process[] = &$process[$key][stripslashes($k)];
        } else {
            $process[$key][stripslashes($k)] = stripslashes($v);
        }
    }
}
unset($process);
  }
 ?>

If access to the server configuration is unavailable, use of .htaccess is also an option

php_flag magic_quotes_gpc Off

http://php.net/manual/en/security.magicquotes.disabling.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜