Jump to content

[SOLVED] Is there a need for mysql_real_escape_string() in this case?


Northern Flame

Recommended Posts

I am using the function htmlentities() to protect my website from people

trying to post html on my website, and also I added the ENT_QUOTES

option to the function so that it converts double quotes to " and

converts single quotes ' so is there a need for my to also use

mysql_real_escape_string? I guess what Im asking is if mysql_real_escape_string()

protects against more than single and double quotes.

Okay, sorry, you don't need to use it if you're hashing something (like MD5ing a password) and inserting it or if you're inserting values that you know are clean.  Any input that involves ANY user interaction must be escaped.

Sorry but that dont sound correct md5 no

escapeing,what about if the user is posting a

password and it converted to md5 before getting to the database...............

 

example

<?php
//if a password comming from the form then i think your need to esape the md5...
$password=mysql_real_escape_string(MD5($_POST['password']));

?>

Sorry but that dont sound correct md5 no

escapeing,what about if the user is posting a

password and it converted to md5 before getting to the database...............

 

example

<?php
//if a password comming from the form then i think your need to esape the md5...
$password=mysql_real_escape_string(MD5($_POST['password']));

?>

Why? MD5 only returns alphanumeric in my testing. If you MD5 a sql injection attempt, you're only going to get hashed alphanumeric string back. 

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.