lillyapps Posted May 6, 2008 Share Posted May 6, 2008 Hello everyone. This is my first post and I'm excited about using this forum. So, what I'm trying to do is be pro-active in reguards to limiting SQL Injection with my new web application and learned that I should be using the mysql_real_escape_string() function. What I belive is happening is that backslashes are being inserted for my quotes and apostrophes within my query string. This sounds fine except for the SQL INSERTs and UPDATEs. The backslashes are being included when writing to the database. Example: If I have a database field named myField and insert the string value: This is a "test" value It is getting stored in my database as: This is a \"test\" value I plan to do more testing tonight but thought I'd ask here first. Thanks. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted May 6, 2008 Share Posted May 6, 2008 In your PHP configuration, make sure magic_quotes is disabled http://us2.php.net/manual/en/security.magicquotes.disabling.php Quote Link to comment Share on other sites More sharing options...
lillyapps Posted May 6, 2008 Author Share Posted May 6, 2008 rhodesa, it was Magic Quotes but I was looking in the wrong place. When I escape a string in javascript and pass it, the _GET translates the HEX values (which I like) but it also inserts backslashes where ever there was a quote. I added stripslashes() if Magic Quotes is ON when reading _GET and that fixed it. Thanks for you help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.