21 lines
		
	
	
		
			561 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			21 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'); |