本文整理汇总了PHP中Authorization::form方法的典型用法代码示例。如果您正苦于以下问题:PHP Authorization::form方法的具体用法?PHP Authorization::form怎么用?PHP Authorization::form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authorization
的用法示例。
在下文中一共展示了Authorization::form方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Authorization
require 'login.lang.php';
require 'login.class.php';
sleep(1);
// do not use in production
//@ new acl instance
$acl = new Authorization();
//@check session status
$status = $acl->check_status();
if ($status) {
// @ session already active
echo "{'status':true,'message':'" . $ACL_LANG['SESSION_ACTIVE'] . "','url':'" . SUCCESS_URL . "'}";
} else {
//@ session not active
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
//@ first load
echo "{'status':false,'message':'" . $acl->form() . "'}";
} 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 = $acl->signin($u, $p);
if ($is_auth) {
//@ success
echo "{'status': true,'message':'" . $ACL_LANG['LOGIN_SUCCESS'] . "','url':'" . SUCCESS_URL . "'}";
} else {
//@ failed
echo "{'status': false,'message':'" . $ACL_LANG['LOGIN_FAILED'] . "'}";
}
示例2: Authorization
require 'admin.lang.php';
require 'login.class.php';
//@ new acl instance
$acl = new Authorization();
//@check session status
$status = $acl->check_status();
if ($status) {
// @ session already active
$arr = array('status' => true, 'message' => $ACL_LANG['SESSION_ACTIVE'], 'url' => SUCCESS_URL);
$json_arr = json_encode($arr);
echo $json_arr;
} else {
//@ 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 = $acl->signin($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;