Jump to content

SQL Injection protection


jbis2k

Recommended Posts

It depends on the code.  mysql_real_escape_string is not designed to prevent injections although in some cases it does.  It is designed to escape quotes.  You need to consider the input type of each variable. For example, if you are accepting an integer value, then you should use:

 

$i = (int)$_GET['i'];

 

Alternatively, using PDO or mysqli with bind variables is an excellent one step solution for preventing SQL injections.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.