md5 checking passwords
Posted: Fri May 23, 2003 4:14 am
Hi
I want to be able to check the password the user submits to their corresponding one in the data base and i am using the following code:
For some reason when i submit my password it encrypts it again but the encryption is dofferent from the one in the data base! Any ideas why this is happeneing??
I want to be able to check the password the user submits to their corresponding one in the data base and i am using the following code:
Code: Select all
<?php
$db = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname,$db) or die (mysql_error);
$Q01 = "SELECT Password
FROM $dbtable
WHERE UserName='$UserName'";
$R01 = mysql_query($Q01) or die("Bad Q01:".mysql_error());
$info = mysql_fetch_array($R01);
if(md5($Password) != $info[Password])
{
echo( "Your Password is Incorect");
ViewHeader($SmartID);
//header("Location: home.php");
ViewFooter();
exit;
}
?>