本文整理汇总了PHP中AdminHelper::authenticate方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminHelper::authenticate方法的具体用法?PHP AdminHelper::authenticate怎么用?PHP AdminHelper::authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminHelper
的用法示例。
在下文中一共展示了AdminHelper::authenticate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stripslashes
<?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";
}
示例2: substr_count
// 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;
}
}