LiteTeBoss
New Member
- Jan 17, 2016
- 8
- 0
Hello there,
I have this bit of PHP code which grabs a encrypted password from a DB and compares it to what is posted. This sometimes works but mostly won't.
Here's the code for the script (ofcourse without database connection):
I did echo the Strings and they do equal each other and there is no errors.
Any ideas?
I have this bit of PHP code which grabs a encrypted password from a DB and compares it to what is posted. This sometimes works but mostly won't.
Here's the code for the script (ofcourse without database connection):
PHP:
$stmt = $db->prepare('SELECT confirmed,password FROM tbl_users WHERE email=:email');
$stmt->bindValue(':email', $email, PDO::PARAM_STR);
$stmt->execute();
if($stmt->rowCount() > 0){
foreach($stmt->fetchAll(PDO::FETCH_ASSOC) as $row){
$enc = md5($password);
if($enc == $row['password']){
if($row['confirmed'] == "true"){
return 'TRUE';
}else{
return "unconfirmed";
}
}else{
return "FALSE";
}
}
}else{
return "FALSE";
}
I did echo the Strings and they do equal each other and there is no errors.
Any ideas?