Why addslashes works automatically

Discussion in 'PHP' started by s_ruben, Oct 25, 2010.

  1. #1
    Hello

    I want to know why addslashes works automatically on the $_GET and $_POST values. For example if the url is url.com?value=Ruben's+website, it shows "Ruben\'s website" when I echo($_GET["value"]). Why it doesn't show "Ruben's website"?

    Thank you
     
    s_ruben, Oct 25, 2010 IP
  2. geofox

    geofox Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #2
    I've tried both echo $_GET['value'] and echo($_GET['value']) on my host. Non of them returns escaped values, I'm getting normal value "Ruben's Website". Maybe you have web-server configured to automatically filter and escape query string data to prevent injections & etc...
     
    geofox, Oct 25, 2010 IP
  3. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #3
    lukeg32, Oct 25, 2010 IP
  4. xpertdev

    xpertdev Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This is due to your magic quotes are enabled from php.ini.
    You can disable it from php.ini file.
    or chk this link.
    http://php.net/manual/en/security.magicquotes.disabling.php :)
     
    xpertdev, Oct 25, 2010 IP
  5. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #5
    Thank you all.
     
    s_ruben, Oct 25, 2010 IP
  6. Sparaker

    Sparaker Peon

    Messages:
    204
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Its good to have that turned on in my opinion, cause you are prone to less or none of the sql injections.
     
    Sparaker, Oct 26, 2010 IP
  7. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #7
    What if your not using SQL...the added slashes can then potentially effect functionality?, which is why its suggested to be disabled so you can choose which to escape and which to not (via mysql_real_escape_string())
     
    danx10, Oct 26, 2010 IP