Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,341
    Thanks
    260
    Thanked 32 Times in 31 Posts

    stripslashes is there a happy medium

    hi im having a booger of a time here, i have just about tried everything i know so i thought i would ask.

    the situation is i need to escape my text before the insert but when i do it adds slashes,

    like this ( isn\\\'t)

    so i use stripslashes which solves that problem fine.

    but it also strips out the slashes from \r\n and im left with rn.

    i have played around with replace and also nl2br before i use the stripslashes so it does not mess up the returns.

    how do i do the stripslashes but keep those in the \r\n from being messed with.

    thanks.
    Last edited by durangod; 09-14-2011 at 11:42 PM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    magic_quotes_gpc does not addslashes to the runtime of \r\n. It only adds to ', ", \, and \0. \r and \n are single chars, so they will not be escaped as they do not match the above list.
    So you are using the stripslashes incorrectly. This should occur before the mysql_real_escape_string or whatever database you are using equivalent is called.

  • Users who have thanked Fou-Lu for this post:

    durangod (09-14-2011)

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,341
    Thanks
    260
    Thanked 32 Times in 31 Posts
    you are the person with the silver cigar . thanks i had it so backwards wow. it seemed logical but i was way off. thanks so much

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Yep you betcha.
    Fortunately magic_quotes_gpc / runtime will be gone very very soon :]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •