Jump to content

md5 password


nathanmaxsonadil

Recommended Posts

is this enough?

$_POST['username'] = mysql_real_escape_string($_POST['username']);
$_POST['email'] = mysql_real_escape_string($_POST['email']);
$_POST['password'] = mysql_real_escape_string($_POST['password']);
$_POST['password2'] = mysql_real_escape_string($_POST['password2']);
$_POST['hidden'] = mysql_real_escape_string($_POST['hidden']);
$_POST['username'] = htmlentities($_POST['username']);
$_POST['email'] = htmlentities($_POST['email']);
$_POST['password'] = htmlentities($_POST['password']);
$_POST['password2'] = htmlentities($_POST['password2']);
$_POST['hidden'] = htmlentities($_POST['hidden']);

Link to comment
https://forums.phpfreaks.com/topic/65492-md5-password/#findComment-327031
Share on other sites

Just in case, you should also strip_tags it ( http://ca.php.net/manual/en/function.strip-tags.php )

 

$name = strip_tags($name);

 

Also, for a maximum protection, use sha1() instead of md5()

 

$pass = sha1($pass);

 

Then, to authenticate, verify if it matches the one in the database :

 

if (sha1($_POST[pass]) === $database_pass)

    {...}

else

    {...}

Link to comment
https://forums.phpfreaks.com/topic/65492-md5-password/#findComment-327058
Share on other sites

And you might want to use the trim to stop people from having users like "h      e      l    l    o  "

trim()

http://www.php.net/trim

trim only clears whitespace at the begining and end of the string. it does not clear whitespace between characters

Link to comment
https://forums.phpfreaks.com/topic/65492-md5-password/#findComment-327103
Share on other sites

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.