This commit is contained in:
Flatlogic Bot 2025-10-20 23:32:41 +00:00
parent 3ba44cb90a
commit 98aa2e3c0c

View File

@ -17,15 +17,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$stmt->execute([$username]);
$user = $stmt->fetch();
<?php
if (password_verify($password, $user['password'])) {
$_SESSION['user_id'] = $user['id'];
$_SESSION['username'] = $user['username'];
header('Location: index.php');
exit;
} else {
$error = 'Nome de usuário ou senha inválidos.';
}
if ($user && password_verify($password, $user['password'])) {
$_SESSION['user_id'] = $user['id'];
$_SESSION['username'] = $user['username'];
header('Location: index.php');
exit;
} else {
$error = 'Nome de usuário ou senha inválidos.';
}
} catch (PDOException $e) {
$error = 'Database error: ' . $e->getMessage();
}