How To Prevent Sql Injection Attacks In Mysql

RegisterLogin
How To Prevent Sql Injection Attacks In Mysql
Post Description: How To Prevent Sql Injection Attacks In Mysql
Tags: How, To, Prevent, Sql, , Injection, Attacks, In, Mysql
This Post Was Posted On Sep 13, 2008 By sqljaks #1502
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
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
Web Hosting Support
#1935 1
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
Sep 13, 2008 Reply Report abuse
©2011 Webune Forums - Mon Dec 19, 2011 1:41 pm
Powered by: Webune Forums V3