Fix an error when query was successful but user wasn't found

This commit is contained in:
grandeljay 2022-10-03 14:43:30 +02:00
parent face5a67a1
commit f41ddd7a85

View file

@ -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);
/** /**