Just last week, I was doing some PHP stuff. I worked a little solution to prevent SQL injections. PHP has been always my man, it has readily 3 solutions for use (maybe more). One is to enable "magic queries" using stripslashes()
function. Another one (the recommended) is to use mysql_real_escape_string()
function.
That simple and my problem is solved. However, things don't seem to be that simple when it comes to JSP. I searched and didn't find any built-in function to strip slashes or do those sort of things (I believe such functionality can be implemented using basic JAVA functions but...).
Please help me protect my database. I heard about PreparedStatement
, but really can't get my head around it? (I feel the real meaning of newbieness).