Re: php.ini setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11-10-02 12:12 PM, Jim Giner wrote:
Spoke to quickly - still having issues.  While the .ini file in each of my
appl. folders has magic quotes set to Off, my scripts are still escaping my
input - obviously following the server's .ini file settings.  Waiting for my
hosters to get back to me.
You could refer them to:

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

Indicate that magic quotes have deprecated, and ask them to turn them off.

But they will say "no", because of all the other users on the server that you use.

In the end, you will be left with stripping the slashes on your own:


<?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);
}
?>

I know it is not the answer you are looking for, but it does work, and used by thousands of coders.

Stephen


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux