+ Reply to Thread
Results 1 to 2 of 2

Thread: I have read the magic_quotes posts and still have a problem

  1. #1
    nabawe is offline x10Hosting Member nabawe is an unknown quantity at this point
    Join Date
    Dec 2009
    Posts
    1

    I have read the magic_quotes posts and still have a problem

    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.

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: I have read the magic_quotes posts and still have a problem

    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 Code:
    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 by misson; 12-02-2009 at 07:40 AM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers