UB-Mannheim /
PalMA
| 1 | <?php |
||
| 2 | |||
| 3 | function showLogin() |
||
| 4 | { |
||
| 5 | //if (isset($_SERVER['HTTP_REFERER'])) { |
||
| 6 | // error_log("auth.php referred by " . $_SERVER['HTTP_REFERER']); |
||
| 7 | //} |
||
| 8 | $header = 'Location: login.php'; |
||
| 9 | $separator = '?'; |
||
| 10 | if (isset($_REQUEST['lang'])) { |
||
| 11 | $header = $header . $separator . 'lang=' . $_REQUEST['lang']; |
||
| 12 | $separator = '&'; |
||
| 13 | } |
||
| 14 | if (isset($_REQUEST['pin'])) { |
||
| 15 | $header = $header . $separator . 'pin=' . $_REQUEST['pin']; |
||
| 16 | $separator = '&'; |
||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
| 17 | } |
||
| 18 | header($header); |
||
| 19 | |||
| 20 | exit; |
||
| 21 | } |
||
| 22 | |||
| 23 | if (!isset($_SESSION)) { |
||
| 24 | session_start(); |
||
| 25 | } |
||
| 26 | |||
| 27 | if (!isset($_SESSION['username'])) { |
||
| 28 | // empty session |
||
| 29 | showLogin(); |
||
| 30 | } else { |
||
| 31 | require_once('DBConnector.class.php'); |
||
| 32 | $dbcon = new palma\DBConnector(); |
||
| 33 | if (!$dbcon->checkUser($_SESSION['username'])) { |
||
| 34 | // empty db (e.g. after PalMA restart) or old session |
||
| 35 | showLogin(); |
||
| 36 | } |
||
| 37 | } |
||
| 38 |