Fixed login form to use redir() instead of hardcoded header() call.
[kolarny.git] / controllers / login.php
1 <?php
2
3 require_once "msgbox.php";
4
5 $showform = true;
6
7 if (isset($_POST['login']) && isset($_POST['password'])) {
8         if ((strlen($_POST['login']) == 0) || (strlen($_POST['password']) == 0)) {
9                 box_fail(tr("Vyplňte prosím přihlašovací jméno i heslo."));
10         } else {
11                 $auth->login($_POST['login'], $_POST['password']);
12                 if ($auth->verify()) {
13                         redir("index");
14                         box_succ(tr("Úspěch!"));
15                         $showform = false;
16                 } else {
17                         box_fail(tr("Chybný login nebo heslo!"));
18                 }
19         }
20 }
21
22 if ($showform) {
23         include "template/login.php";
24 }
25 ?>