Fix an error when query was successful but user wasn't found
This commit is contained in:
parent
face5a67a1
commit
f41ddd7a85
1 changed files with 4 additions and 5 deletions
|
@ -25,19 +25,18 @@ if (isset($_POST['login'], $_POST['email'], $_POST['password'])) {
|
||||||
AND `password` = "' . $password . '";'
|
AND `password` = "' . $password . '";'
|
||||||
);
|
);
|
||||||
|
|
||||||
$userQuery = $database
|
$fields = $database
|
||||||
->query(
|
->query(
|
||||||
'SELECT *
|
'SELECT *
|
||||||
FROM `users`
|
FROM `users`
|
||||||
WHERE `email` = "' . $email . '"
|
WHERE `email` = "' . $email . '"
|
||||||
AND `password` = "' . $password . '";'
|
AND `password` = "' . $password . '";'
|
||||||
);
|
)
|
||||||
|
->fetch();
|
||||||
|
|
||||||
$success = false !== $userQuery;
|
$success = false !== $userQuery && is_array($fields);
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$fields = $userQuery->fetch();
|
|
||||||
|
|
||||||
$_SESSION['user'] = new User($fields);
|
$_SESSION['user'] = new User($fields);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue