note 104413 deleted from security.database.sql-injection by danbrown
| From: | danbrown@php.net | Date: | Tue, 14 Jun 2011 15:10:18 +0000 |
| Subject: | note 104413 deleted from security.database.sql-injection by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180519@lists.php.net to get a copy of this message | ||
Note Submitter: no spam at innvo dot com
----
RE: kirby4 at live dot ca 19-Feb-2011 10:35
By performing MD5(columnname) you are losing any potential index use and are performing a full table
scan, because the DB has to create a checksum of each and every row.
Since you are creating an MD5 to match the column you would circumvent any potential SQL injection
anyway, as the output is invariably 32 hexadecimal characters.
For your example I prefer to use mysql_real_escape_string and for passwords/binary data, just use
MD5 with PHP and something like MySQL's UNHEX();