Link to home
Start Free TrialLog in
Avatar of Jazzy 1012
Jazzy 1012

asked on

How to use md5 hashing

I have a table for my users and i created a column called "hash"
They get an email when they request "forgot password" it sends them to a link that has a form to change the password.
I want that link to have a hash by using md5, therefore it would be more secure, but im unsure where to start and what code to write, I just have this email code so far:

<?php 
require "connection.php";
$email = $_POST['email'];

if(isset($_POST['submit']))
{

$check = mysqli_query($conn, "select * from users where email = '$email' ");
$row = mysqli_fetch_array($check);

$message ="Please click here to create a new password www.jasmine.com/i";
$subject = 'Change password';
$body = "E-Mail: $email\n Message:\n $message";

if($row)
{
	
    $res = mail ($email, $subject, $body);
    echo "Please check your email";
}
}
else
{
echo  "Email Not Found";
}
?>

Open in new window

Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Do not use md5() for hashing passwords.  It's w-a-a-a-y too insecure.  Instead, follow the guidelines in this article for password hashing.
https://www.experts-exchange.com/articles/28768/Password-Hashing-in-PHP.html

See also: http://php.net/manual/en/faq.passwords.php#faq.passwords.fasthash
Avatar of Jazzy 1012
Jazzy 1012

ASKER

Yes but I will need to use MD5, can you help me with using it?
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial