this is my first problem that I have come across which I am really stuck on and can not find any solutions. I am currently trying to create a secure way of storing user passwords in the database using AES_ENCRYPT. I have succesfully inserted the encrypted password into the mysql database, however I can not retrieve the decrypted value from the database using the following code...
Code: Select all
$SQLstring="SELECT AES_DECRYPT(password,'$key') FROM accounts WHERE username='$ac_username'";
$QueryResult = $DBConnect -> query($SQLstring);
$row = mysqli_fetch_array($QueryResult);
echo $row[0];
if ($row[0] == $ac_password){
session_register($ac_username);
session_register($ac_password);
header("location:account.php");
}
else {
}
Please someone help!