View Single Post
Old 07-03-2022, 12:51 PM  
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,227
Quote:
Originally Posted by Publisher Bucks View Post
Would it be best to change the encryption method at this point to something else or do you think I'll still run into the issue because of an existing coding issue?
Yeah just do salted MD5.

columns username, password, and salt
salt you insert a random string when inserting the user so each one has a unique salt.

$salt = md5(uniqid());
$password = md5($_POST['password'].$salt);

and then you just go

$result = mysqli_query($dblink, "SELECT * FROM users WHERE username = '".$_POST['username']."' AND password = MD5(CONCAT('".$_POST['password']."',salt))");

(naturally, youd' protect against sql injection but just writing like that to illustrate what goes where).

If there's a result, the user is valid. If it's empty, it's wrong login details.
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote