Slashes showing in PHP

Discussion in 'PHP' started by CuBz, Oct 28, 2007.

  1. #1
    THIS IS A PHP ISSUE

    Every time i type a " or a ' on my website it shows as \" and \'

    How do i sort this

    Someone said use the striptag() but how woul i use that with ".replace()."

    Thanks
     
    CuBz, Oct 28, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Please don't create multiple threads for the same problem. Why not post in the old thread?

    http://forums.digitalpoint.com/showthread.php?t=531929

    Plus, your question does not make much sense to me. There is no "replace()" function in PHP, it's called "str_replace()", but even if, your question still doesn't make sense. stripslashes() replaces the slashes with nothing, so what do you want "replace()" for?

    Post your code if necessary...
     
    nico_swd, Oct 28, 2007 IP
  3. CuBz

    CuBz Peon

    Messages:
    117
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    firstly i searched for my other post and it wasnt found

    secondly the replace tag is as follows


    echo replace()

    and it is used to add replace files such as smileys and swear words etc
     
    CuBz, Oct 28, 2007 IP
  4. Lordy

    Lordy Peon

    Messages:
    1,643
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #4
    why are you using a replace?

    do stripslashes($string)
     
    Lordy, Oct 28, 2007 IP
  5. Dirty-Rockstar

    Dirty-Rockstar Guest

    Messages:
    252
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    no need to replace what is removed with stripslashes mate. read nicos post again ;)
     
    Dirty-Rockstar, Oct 28, 2007 IP
  6. CuBz

    CuBz Peon

    Messages:
    117
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Fatal error: Call to undefined function: stripslash() in /home/content/a/m/a/amafiali/html/right.php on line 346


    See doesnt work!

    I need replace function too

    echo"".replace($topictext)."";
    PHP:
    As it connects to a page that replaces words for other words, such as if somebody types it makes text bold because they cannot use <B>

    You understand?
     
    CuBz, Oct 28, 2007 IP
  7. Lordy

    Lordy Peon

    Messages:
    1,643
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #7
    are you a professional at not reading?

    it's STRIPSLASHES
    WITH AN ES! we even gave you examples

    and if you want to use replace so bad, why not? replace is not a built in function, so obviously you must have created it yourself, so why can't you use it?
     
    Lordy, Oct 28, 2007 IP
  8. Brewster

    Brewster Active Member

    Messages:
    489
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    60
    #8
    You have spelt the function name incorrectly - it is spelt stripslashes()




    The is no function built into php called replace(). Use the function stripslashes() as we have already recommended.

    Brew
     
    Brewster, Oct 28, 2007 IP
  9. Hershey

    Hershey Peon

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


    lol you sound very arrogant bro...take it easy

    i dont understand how you are asking for help and yet you seem to think you know better...


    stripslashes() is a defined functions and it works....i've used it countless times...
     
    Hershey, Oct 28, 2007 IP
  10. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #10
    Again, replace() is not a built-in PHP function. It might be a function defined by the software you're using. (I tried reading your mind but for some odd reason it did not work)

    If you need help with YOUR replace() function, then you need to post it. (Since the mind reading failed. I'm sorry, I tried real hard, I promise!)
     
    nico_swd, Oct 28, 2007 IP
  11. CuBz

    CuBz Peon

    Messages:
    117
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    i changed the replace code to stripslashes and wat do u no, the BB code stopped working.

    I can ensure you that i use the replace() on every server i been on and it never fails to work!
     
    CuBz, Oct 30, 2007 IP
  12. Brewster

    Brewster Active Member

    Messages:
    489
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    60
    #12
    If you are calling a function called replace() and it is not working, it is because you are missing the function in one of your files - this will either be because the file is not being included or the function does not exist in any of your files.

    Without any further information from you we cannot help any more than we already have.

    Brew
     
    Brewster, Oct 30, 2007 IP
  13. Cybernaut

    Cybernaut Peon

    Messages:
    408
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Just disable "Magic Quotes" using .htaccess file if you are using Apache.

    # Turn off magic_quotes
    <IfModule mod_php5.c>
        php_flag magic_quotes_gpc         off
        php_flag magic_quotes_runtime     off
    </IfModule>
    <IfModule mod_php4.c>
        php_flag magic_quotes_gpc         off
        php_flag magic_quotes_runtime     off
    </IfModule>
    Code (markup):
    It will prevent PHP from adding slashes to input data. You can also disable them in php.ini.
     
    Cybernaut, Oct 30, 2007 IP
  14. decepti0n

    decepti0n Peon

    Messages:
    519
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #14
    echo replace( stripslashes( $whatever ));
    PHP:
    Maybe? Im lost on this post
     
    decepti0n, Nov 3, 2007 IP
  15. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #15
    http://www.php.net/manual-lookup.php?pattern=replace


    Post your code, Post your code, post your code. :)


    .
     
    exodus, Nov 4, 2007 IP
  16. Krownet

    Krownet Peon

    Messages:
    42
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Sounds like your using a prepacked software. Possibly a bulletin board or CMS. Anyways, replace is not a php function, it is a function within the script you are using. It works on every server you've been on, if you've been working with this same script on all those servers.

    To get rid of slashes, do what decepti0n said, and use this:

    
    echo"".replace(stripslashes($topictext))."";
    
    PHP:
     
    Krownet, Nov 4, 2007 IP
  17. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #17
    MMJ, Nov 4, 2007 IP