try {
$dbh = new PDO($dsn, $user, $pass);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
// For brevity, code to establish a database connection has been left out
$sth = $dbh->prepare('
SELECT
Password
FROM Customer_login
WHERE
Email = :username
LIMIT 1
');
$sth->bindParam(':username', $username);
$sth->execute();
$user = $sth->fetch(PDO::FETCH_OBJ);
printf($user);
// Hashing the password with its hash as the salt returns the same hash
if ( hash_equals($user->Password, crypt($password, $user->Password)) ) {
// Ok!
printf("login success for customer");
echo 'Login Accepted';
}
else
{
printf("customer login fail");
}
?>
When I run this code the error says Object of class stdClass could not be converted to string
I'm actually trying fetch hashed password from table using email ID and trying compare the credentials given by the yes.
Also can anyone explain what is best way to implement IOS applications when we store data in the external server.