diff --git a/public/login.php b/public/login.php index e9a4fc0..11b1e08 100644 --- a/public/login.php +++ b/public/login.php @@ -1,5 +1,4 @@ -user->loggedIn) { @@ -7,11 +6,14 @@ if ($app->user->loggedIn) $app->redirect('index.php'); } +$username = (string)filter_input(INPUT_POST, 'username'); +$password = (string)filter_input(INPUT_POST, 'password'); + if ($_SERVER['REQUEST_METHOD'] === 'POST') { - if ($app->user->login($_POST['username'], $_POST['password'])) + if ($app->user->login($username, $password)) { - $app->session->flash("Velkommen {$_POST['username']}!"); + $app->session->flash("Velkommen {$username}!"); $app->redirect('index.php'); } http_response_code(401);