07-22-2002, 07:32 AM
I insert data into my forms, but everytime i put in an apostrophe or anything like that, it's preceded with a "\" I looked for a function somewhere, of course with my wonderfully slow internet connection, i get no where with my search and this miraculous book that is obsenely bad in explaining things to beginners. Just curious if someone could tell me the function or the steps to remove the '\' preceding any of the key variables.
07-22-2002, 07:40 AM
Gorilla1 had already posted this question at:
Hope that thread can help you :thumbsup:
07-22-2002, 08:07 AM
checked out the strip_slash function
but i realized that i put add_slash function right before the adding the lines to my table (smart huh? :D ) and just removed them, that did the trick.
07-22-2002, 01:33 PM
Ehm... does that mean you have magic_quotes turned on and rely on them?
Ugh... I would favor control escaping of special characters explicitly with addslashes() and stripslashes() over that automagical mechanism, but each to his own.
Though I still believe that magic_quotes cause confusion that could be avoided.
07-22-2002, 02:06 PM
I would favor control escaping of special characters explicitly with addslashes() and stripslashes() over that automagical mechanism, but each to his own.
Agree, but If you don't have the ability to determine that on your server, from what I have read, you can't turn it off effectively locally.
07-22-2002, 03:32 PM
AFAIK, you can do that directly from within PHP with ini_set (well, if that function is allowed on the server).
You can also put php_value/php_flag directive in your .htaccess file, if you are permitted using one.
And yes, an extremely paranoid admin may disallow any of the possibilities. I only thought it would be worth mentioning that relying on magic_quotes may not be the best thing to do.
07-22-2002, 03:37 PM
Hey, since you waaaaay more experienced in PHP than I am, might as well listen to you and just use the two functions to add and strip the slashes anyway, might as well learn through someone's experience and not mess up later on.
Thanks again for your comments, I was just trying to figure out the lazy way out of typing less.. :D, no point