本文整理匯總了PHP中Current_User::authenticate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Current_User::authenticate方法的具體用法?PHP Current_User::authenticate怎麽用?PHP Current_User::authenticate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Current_User
的用法示例。
在下文中一共展示了Current_User::authenticate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
public function index()
{
if (Current_User::user()) {
if (!empty($_GET['logoff'])) {
$this->logout();
header("location:login.html");
} else {
include 'admin_registration.view.php';
// @ session already active
// $arr = array('status' => true, 'message' => $ACL_LANG['SESSION_ACTIVE'], 'url' => SUCCESS_URL);
// $json_arr = json_encode($arr);
// echo $json_arr;
}
} else {
// load data to the view if there are some data needed
//include('login.view.php');
//@ session not active
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
//@ first load
$arr = array('status' => false, 'message' => $acl->form());
$json_arr = json_encode($arr);
echo $json_arr;
} else {
//@ form submission
$u = !empty($_POST['u']) ? trim($_POST['u']) : false;
// retrive user var
$p = !empty($_POST['p']) ? trim($_POST['p']) : false;
// retrive password var
// @ try to signin
$is_auth = Current_User::authenticate($u, $p);
if ($is_auth) {
//@ success
$arr = array('status' => true, 'message' => $ACL_LANG['LOGIN_SUCCESS'], 'url' => SUCCESS_URL);
$json_arr = json_encode($arr);
echo $json_arr;
} else {
//@ failed
$arr = array('status' => false, 'message' => $ACL_LANG['LOGIN_FAILED']);
$json_arr = json_encode($arr);
echo $json_arr;
}
}
}
}