22 lines
567 B
PHP
22 lines
567 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('pages/login');
|
|
$app->view('template/footer'); |