I have read the magic_quotes posts and still have a problem

nabawe

New Member
Messages
1
Reaction score
0
Points
1
Hi there forum dwellers:

I have been trying to apply many of the work arounds solutions posted in this an other forums to ""fix"" the magic_quotes behaviour (the .htaccess files, php.ini, and funtion replacement between others) and failed, so since my knowledge about all this issues is small I am quite certain I might have made mistakes in some of the implementations therefore I am humbly requesting a bit more direct help.

Here is the deal:

I have a php script that when it runs it installation it checks for:
Code:
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()==1)
    {
        echo 'Your PHP configuration has <i>magic quotes</i> enabled, however this is discouraged and may cause problems sending data to the interface.';
        echo 'Please disable it in your PHP configuration or ask your host to do so.';
        echo 'Magic quotes are <a href="http://de.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc">depreciated as of PHP 5.3 and removed in PHP 6</a>. And that’s for a reason. :)';
        exit();
    }

I am quite a PHP, sql ignorant but I understand that if I take out that check out it would compromise to the security, look, performance and functionality of the script.

Yes the scrip will take some data from imput boxes.

Well I am already thanking to the carrying soul that would invest a portion of its precious time to help me.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
I'm not certain what you want, since you didn't actually ask for something. If you want to know how you can safely get pass the check without disabling magic_quotes_gpc, try replacing the code you quoted with:
PHP:
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
    $_REQUEST; # so $GLOBALS['_REQUEST'] exists
    foreach (array('_GET', '_POST', '_COOKIE', '_REQUEST') as $k) {
        $GLOBALS[$k] = array_map('stripslashes', $GLOBALS[$k]);
    }
}
You could unroll the loop in the above code, if you wish.

The issue is covered in the thread "PHP/Apache Configuration".
 
Last edited:
Top