This commit is contained in:
William 2022-03-30 06:52:18 +00:00
parent bb468aa003
commit 2f19e5eb4e

View File

@ -1,5 +1,4 @@
<?php <?php $app = require '../app/inc.php';
$app = require '../app/inc.php';
if ($app->user->loggedIn) if ($app->user->loggedIn)
{ {
@ -7,11 +6,14 @@ if ($app->user->loggedIn)
$app->redirect('index.php'); $app->redirect('index.php');
} }
$username = (string)filter_input(INPUT_POST, 'username');
$password = (string)filter_input(INPUT_POST, 'password');
if ($_SERVER['REQUEST_METHOD'] === 'POST') 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'); $app->redirect('index.php');
} }
http_response_code(401); http_response_code(401);