This repository has been archived on 2023-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
web/public/login.php
2022-01-24 13:31:37 +01:00

22 lines
561 B
PHP

<?php
$app = require '../app/inc.php';
if ($app->user->loggedIn)
{
$app->session->flash('Du er allerede pålogget');
$app->redirect('index.php');
}
if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
if ($app->user->login($_POST['username'], $_POST['password']))
{
$app->session->flash("Velkommen {$_POST['username']}!");
$app->redirect('index.php');
}
$app->session->flash('Feil påloggingsinformasjon', 'danger');
}
$app->view('template/header', ["title" => "Logg inn"]);
$app->view('login');
$app->view('template/footer');