Slashes in PHP5..."stripslashes()" needed?

Discussion in 'PHP' started by Hershey, Oct 27, 2007.

  1. #1
    Ok so I installed a script on my server right..and it requires php 5...I used cpanel to build that with apache update. so I have php 5.2.4 running..with mysql 5.

    Now here comes the problem (wich I personally thought was only supposed to occur in php4). I actually had been running the script on a different server which also had php5, without a problem. But now once I installed it in my new dedicated server...i have this issue with data intered in textarea are injected into the database with slashes on them wherever there is a single quote or double quote (ie..'=> \') ....I thought this was only a problem with php4 that required a "stripslahses()" function to fix...

    I am convinced the problem is with the php5 engine...which I presume can be fixed in the settings.....But I have no idea how to go about doing that...so can anyone here help? Any ideas?
     
    Hershey, Oct 27, 2007 IP
  2. Fash

    Fash Peon

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sounds like you have magic_quotes on. You can turn it off in php.ini if you have access.
     
    Fash, Oct 27, 2007 IP
  3. Lordy

    Lordy Peon

    Messages:
    1,643
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #3
    are you 100% sure your doing it right? can you show us your code for it?

    or like Fash said you may have magic quotes on.

     
    Lordy, Oct 27, 2007 IP
  4. Hershey

    Hershey Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4

    Yes its a dedicated server..i have root access

    I went in the php configuration editor in WHm and found an option that said magic_quotes_gpc and it was on...i turned it off....but it didnt make any difference


    is it that or is it a different option...i can modify it through shell if needs be
     
    Hershey, Oct 27, 2007 IP
  5. Hershey

    Hershey Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    magic_quotes_sybase is actually off... but sybase.allow_persistent is on..if that means anything


    ..and what do you mean about being 100%...i'm not following you. This script has no problem..it runs fine on one server..and it has the slash problems on the other

    do you want to see a snippet of the code?
     
    Hershey, Oct 27, 2007 IP
  6. Hershey

    Hershey Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I spoke too soon...sorry

    That fixed it:D

    Thank you both!
     
    Hershey, Oct 27, 2007 IP
  7. bLuefrogx

    bLuefrogx Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Its always good to check for magic_quotes_gpc directive when writing public scripts to prevent double escaping.

    Could it be in a php_value someone in .htaccess or httpd.conf ?
     
    bLuefrogx, Oct 28, 2007 IP
  8. Hershey

    Hershey Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8

    no no...problem was solved per the first response.....it was magic_quotes_gpc ...it just took more than a few seconds to propagate for some reason..

    thnx
     
    Hershey, Oct 28, 2007 IP