How to use the md5 hash?

Posted by Ken on Stack Overflow See other posts from Stack Overflow or by Ken
Published on 2011-01-10T01:46:40Z Indexed on 2011/01/10 1:53 UTC
Read the original article Hit count: 562

Filed under:
|
|
|
|

Okay, so I'm learning php, html, and mysql to learn website development (for fun). One thing I still don't get is how to use md5 of sha1 hashes. I know how to hash the plain text, but say I want to make a login page. Since the password is hashed and can't be reversed, how would mysql know that the user-inserted password matches the hashed password in the database? Here is what I mean:

$password = md5($_POST['password']);

$query = ("INSERT INTO `users`.`data` (`password`) VALUES ('$password')");

I know that this snippet of script hashes the password, but how would I use this piece of code and make a login page? Any working examples would be great.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql