Nimbin2git.christianimmanuel.de / Tools / dienstplancreator / redirect.php

dienstplancreator git · main

git clone https://git.christianimmanuel.de/tools/dienstplancreator.gitwget https://git.christianimmanuel.de/tools/dienstplancreator/archive/dienstplancreator.tar.gz
redirect.php 687 B · 34 lines raw
<!DOCTYPE html>
<?php

session_start();

require './api/config/db_inc.php';
require './api/objects/account_class.php';

$account = new Account();
$login = FALSE;

try {
	$login = $account->sessionLogin();
} catch (Exception $e) {
	echo $e->getMessage();
	die();
}

if ($login) {
    if ($_SESSION["user_role"] === "superadmin") {
        header('Location: /admin.php');
    } else {
        header('Location: /');
    }
} else if ($account->isAuthenticated()) {
    if ($_SESSION["user_role"] === "superadmin") {
        header('Location: /admin.php');
    } else {
        header('Location: /');
    }
} else {
    header('Location: /login.php');
}
?>