The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP replaces ' with /

Discussion in 'General Discussion' started by ThunderHostingDotCom, Apr 20, 2005.

  1. ThunderHostingDotCom

    ThunderHostingDotCom Well-Known Member

    Joined:
    Nov 18, 2002
    Messages:
    450
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    All over!
    Is there a way to stop PHP forms from replacing the (') apostrophe in words like don't & won't with (/) forward slashes? We have a few sites that this happens on while other sites the words are emailed or saved to the mySQL DB just fine. Any help is appreciated, thanks.
     
  2. trparky

    trparky Well-Known Member

    Joined:
    Apr 23, 2003
    Messages:
    184
    Likes Received:
    1
    Trophy Points:
    0
    This is due to MagicQuotes. MagicQuotes auto escapes certain characters to help reduce SQL Injection Issues, but, don't trust it completely, it doesn't escape all of them.

    You could compile Apache/PHP without MagicQuotes, or you could just use the PHP stripslashes() function to remove the slashes from user input.
     
  3. KingMotley

    KingMotley Member

    Joined:
    Apr 21, 2005
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    You can also turn the "feature" off in your PHP.INI file, or you can search php.net for a few small routines to place at the top of your .php scripts so that it will work the same whether the option is off or on.

    Search for unfck_gpc and unfck.
     
Loading...

Share This Page