Values being automatically escaped

Discussion in 'PHP' started by Echilon, Nov 15, 2007.

  1. #1
    I have a local srver set up for testing, and I'm experiencing a strange problem. When I type inputs into a form, PHP is reading them and escaping some values. I need to take what the user enters and sanitize it using my own methods, but something happening before I can get hold of it. I also have an account on Dreamhost, and when I try the script there it works fine. I've grabbed Dreamhost's php.ini and compared it to mine, and everything looks to be the same.

    When I enter "'@\/#, then echo it using $_POST['input1'], I get \"\'@\\/#:. I thought it might have something to do with magic quotes at first, but this happens whether they're on or off. Does anyone have any idea what could cause this? I'm running Apache with PHP 5.2.5.

    Thanks
     
    Echilon, Nov 15, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Did you restart Apache after turning them off?
     
    nico_swd, Nov 15, 2007 IP
  3. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #3
    echo stripslashes($_POST['input1']);
    PHP:
    I think magic_quotes_gpc is on (it's on by default), on your machine
     
    greatlogix, Nov 15, 2007 IP
  4. Echilon

    Echilon Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ah, it was XAMPP. It uses two php.ini files for some reason. Disabled magic quotes in both and it's working now.

    Thanks. :)
     
    Echilon, Nov 15, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    Usually you only have to edit the one in apache/bin/php.ini (When using XAMPP)
     
    nico_swd, Nov 15, 2007 IP