Re: Kill Magic Quotes

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

 



If you can't change php.ini, and if it's Apache, you maybe can just
turn it off in .htaccess, far faster and easier than a PHP function.

You are calling the removeSlashes, right?

And, really, there is no reason for the restoreSlashes function to
exist.  If you ever think you need it, you're wrong. :-)

On Thu, August 7, 2008 10:00 pm, Dave M G wrote:
> PHP List,
>
> I am developing a web site that is hosted on a web server where I do
> not
> have permission to change the php.ini file.
>
> This server has magic quotes turned on. I'd like them off.
>
> I wrote two functions to detect when magic quotes is on, and to try
> and
> counter act its effects. But it does not seem to be working. It seems
> to
> have no effect, and I get slashes showing up in all sorts of output
> where I don't want them. Not only in data put into the database, but
> also emails sent to from the site contact page and other places.
>
> Here are the functions I created. Where have I gone wrong?
>
>   public static function removeSlashes($string)
>   {
>    // Check if "Magic Quotes" is turned on.
>    if (get_magic_quotes_gpc())
>    {
>      // Remove escape slashes.
>      return stripslashes($string);
>    }
>    // Return a string that has no escape slashes.
>    return $string;
>   }
>
>   public static function restoreSlashes($string)
>   {
>    // Check if "Magic Quotes" is turned on.
>    if (get_magic_quotes_gpc())
>    {
>      // Add escape slashes.
>      return addslashes($string);
>    }
>    // Return a string that has escape slashes.
>    return $string;
> }
>
> Any advice much appreciated.
>
> --
> Dave M G
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch



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