Re: problem with quotes (single and double) in forms

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

 



This is what I found and started to use: created magic_quotes_off.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);
}

and included i header.php (header of every page).

-afan


> Chris wrote:
>> Chris wrote:
>>> J R wrote:
>>>> try to use this few lines of code.
>>>>
>>>> function stripMagicQuotes(&$var)
>>>> {
>>>>    if (get_magic_quotes_gpc()) {
>>>>        $var    = stripslashes($var);
>>>>    }
>>>>    return $var;
>>>> }
>>>>
>>>> this way you don't really have to worry if magic quotes is on or off.
>>>
>>> Then he has to modify all the code to call that function ;)
>>>
>>
>> Hmm actually:
>>
>> $_POST = stripMagicQuotes($_POST);
>>
>> should do it I guess.. not exactly ideal but would work quickly.
>>
>
> Argh, self-replying (*think before hitting send*) :(
>
> Of course that function would need a bit more modification but should be
> able to get it recursive without too many problems.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
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