Thanks for your time, Forum:
Stored in my MySQL db are: memberID, username, password, fName, lName, email, date
On the login page, this is what I have:
[code=php]
try{
$stmt = $db->prepare(“SELECT * FROM members WHERE username = :uname”);
$stmt->bindParam(‘:uname’, $uname);
//$user_id = $stmt->fetchColumn();
//echo $user_id;
$row = $stmt->fetch(PDO::FETCH_OBJ);
if($row[“username”] == true) { echo “Username is good”;
if(PassHash::check_password($row[“password”], $_POST[‘pwd1’])) {
echo ‘Access granted!’;
}
}
else {
echo ‘Invalid username or password!’;
}
}
I got the password hash code from [url]http://code.tutsplus.com/tutorials/understanding-hash-functions-and-keeping-passwords-safe–net-17577
My code throws no errors. But even with the correct data in the form fields, I always get “Invalid username or password”. I don’t understand. Does anyone see the mistake I’m making in my code?
~Landslyde