<?php $blnAuthenticated = AdminHelper::authenticate($_REQUEST["username"], $_REQUEST["password"]); if ($blnAuthenticated == true) { $_SESSION["username"] = stripslashes($_REQUEST["username"]); $_SESSION["password"] = stripslashes($_REQUEST["password"]); $mode = "loggedin"; } else { $mode = "form"; }
// CALCULATE PATH $numDirs = substr_count(preg_replace("/^.*\\/admin/", "", $_SERVER["SCRIPT_NAME"]), "/"); $strIncludePath = str_repeat("../", $numDirs - 1); $adminPath = preg_replace("/(^.*\\/admin\\/).*\$/", "\$1", $_SERVER["SCRIPT_NAME"]); // INCLUDE SHARED DEPENDENCIES require_once $strIncludePath . "../classes/includes/paths.php"; require_once $strIncludePath . "../classes/helpers/AdminHelper.php"; require_once $strIncludePath . "modules/controller.php"; // AUTHENTICATE USER session_start(); if (array_key_exists("s", $_GET)) { $strSession = base64_decode($_GET["s"]); session_decode($strSession); } if (!isset($blnAuthenticate)) { $blnAuthenticate = true; } if ($blnAuthenticate == true) { $strUsername = ""; $strPassword = ""; if (array_key_exists("username", $_SESSION)) { $strUsername = $_SESSION["username"]; } if (array_key_exists("password", $_SESSION)) { $strPassword = $_SESSION["password"]; } if (!AdminHelper::authenticate($strUsername, $strPassword)) { header("Location: " . $adminPath . "login.php"); exit; } }