<?php require_once dirname(__FILE__) . '/main.php'; Validate::Session(); $StPage = array_key_exists('page', $_GET) ? $_GET['page'] : ''; F1DeskUtils::showPage($StPage);
/** * validate users session * * @param bool $Return * * @return bool * * @author Dimitri Lameri <*****@*****.**> */ public static function Session($Return = false) { $Valid = true; if (!(array_key_exists('StHash', $_SESSION) && array_key_exists('IDUser', $_SESSION) && array_key_exists('StName', $_SESSION))) { $Valid = false; } if ($Valid === true) { $StHash = $_SESSION['StHash']; $StComparison = md5($_SESSION['IDUser'] . $_SESSION['StName']); if ($StHash !== $StComparison) { $Valid = false; } } if ($Return == true || $Valid === true) { return $Valid; } else { if ($Valid === false) { $_SESSION = array(); if (array_key_exists('page', $_GET)) { setSessionProp('lastPage', $_GET['page']); } F1DeskUtils::showPage('login'); die; } } }