How To Prevent Sql Injection Attacks In Mysql
how to prevent sql injection attacks in mysql
how, to, prevent, sql, injection, attacks, in, mysql
How To Prevent Sql Injection Attacks In Mysql
Post Description: how to prevent sql injection attacks in mysql
POST# 1478
Posted On: Sat Sep 13, 2008 8:28 pm
sqljaks
Topic: How To Prevent Sql Injection Attacks In Mysql
hi i have a website with php and mysql, and i just learned about sql injection where your website can get hacked by simple puting this on the username and password..

' or 1=1--

how can i avoid or stop sql injections from happening to my website


Sat Sep 13, 2008 8:31 pm
1
Web Hosting Support
Reply #2138
to avoid mysql injections make sure you use this function in php:

mysql_real_escape_string()



so lets say that the username is the name of the field in your login form, im guessing you are using the POST method so this is how you would stop it

$myusername = mysql_real_escape_string($_POST['myusername']);

now you will stop from being hacked

hope that helps

What do you think?

* name:  

* email:  

* Please enter comments:


Receive Replies on my Comments
(An email will be sent to you when someone replies to your comments)

Add image to comments
yes no             upload