if (SessionHelper::isLoggedIn()) { // echo "IS LOGGED IN"; exit; if (SessionHelper::isAdmin()) { header("Location: report_time.php"); } else { header("Location: index.php"); } exit; } $showForm = true; $message = "Please provide us with your login information."; // specify $_GET["from"] to get a redirect on login. this is written in $_POST["from"] which overrides $from = $_POST && $_POST["from"] ? $_POST["from"] : ($_GET && $_GET["from"] ? $_GET["from"] : ""); // specify $_GET["email"] to get a prefill for email $cookieLoginUser = CookieHelper::getLoginUser(); $cookieLoginPass = CookieHelper::getLoginPass(); if ($cookieLoginUser && $cookieLoginPass) { $row = UserHelper::getUserRow($db, $cookieLoginUser, $cookieLoginPass); if ($row !== false) { session_unset(); session_destroy(); session_start(); SessionHelper::setSession($row); if ($from) { header("Location: " . $from); } else { if (SessionHelper::isAdmin()) { header("Location: report_time.php"); } else { header("Location: ."); }