本文整理汇总了PHP中H::decode_hash方法的典型用法代码示例。如果您正苦于以下问题:PHP H::decode_hash方法的具体用法?PHP H::decode_hash怎么用?PHP H::decode_hash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类H
的用法示例。
在下文中一共展示了H::decode_hash方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
if (AWS_APP::session()->client_info and !$_COOKIE[G_COOKIE_PREFIX . '_user_login']) {
// Cookie 清除则 Session 也清除
unset(AWS_APP::session()->client_info);
}
if (!AWS_APP::session()->client_info and $_COOKIE[G_COOKIE_PREFIX . '_user_login']) {
$auth_hash_key = md5(G_COOKIE_HASH_KEY . $_SERVER['HTTP_USER_AGENT'] . $_SERVER['HTTP_ACCEPT_LANGUAGE']);
// 解码 Cookie
$sso_user_login = H::decode_hash($_COOKIE[G_COOKIE_PREFIX . '_user_login'], $auth_hash_key);
if ($sso_user_login['user_name'] and $sso_user_login['password'] and $sso_user_login['uid']) {
if (AWS_APP::model('account')->check_hash_login($sso_user_login['user_name'], $sso_user_login['password'])) {
AWS_APP::session()->client_info['__CLIENT_UID'] = $sso_user_login['uid'];
AWS_APP::session()->client_info['__CLIENT_USER_NAME'] = $sso_user_login['user_name'];
AWS_APP::session()->client_info['__CLIENT_PASSWORD'] = $sso_user_login['password'];
return true;
}
}
return false;
}
}
示例2: __construct
public function __construct()
{
if (AWS_APP::session()->client_info and !$_COOKIE[G_COOKIE_PREFIX . '_user_login']) {
// Cookie 清除则 Session 也清除
unset(AWS_APP::session()->client_info);
}
if (!AWS_APP::session()->client_info and $_COOKIE[G_COOKIE_PREFIX . '_user_login']) {
$auth_hash_key = md5(G_COOKIE_HASH_KEY . $_SERVER['HTTP_USER_AGENT'] . $_SERVER['HTTP_ACCEPT_LANGUAGE']);
// 解码 Cookie
$sso_user_login = H::decode_hash($_COOKIE[G_COOKIE_PREFIX . '_user_login'], $auth_hash_key);
$user_name = $sso_user_login['user_name'];
$host = 'localhost';
$username = 'root';
$password = 'toor';
$database = 'baji';
$dbc = mysqli_connect($host, $username, $password, $database);
if (!$dbc) {
die('Could not connect: ' . mysql_error());
}
$query = "SELECT * FROM users WHERE user_name = '{$user_name}'";
$data = mysqli_query($dbc, $query) or die('error!!' . mysql_error());
mysqli_close($dbc);
$row = mysqli_fetch_array($data);
$sso_user_login['password'] = $row['password'];
$sso_user_login['uid'] = $row['uid'];
$name = H::encode_hash($sso_user_login);
HTTP::set_cookie($name);
if ($sso_user_login['user_name'] and $sso_user_login['password'] and $sso_user_login['uid']) {
if (AWS_APP::model('account')->check_hash_login($sso_user_login['user_name'], $sso_user_login['password'])) {
AWS_APP::session()->client_info['__CLIENT_UID'] = $sso_user_login['uid'];
AWS_APP::session()->client_info['__CLIENT_USER_NAME'] = $sso_user_login['user_name'];
AWS_APP::session()->client_info['__CLIENT_PASSWORD'] = $sso_user_login['password'];
return true;
}
}
return false;
}
}
示例3: __construct
public function __construct()
{
parent::__construct(false);
if ($_GET['app'] != 'admin') {
return false;
}
TPL::import_clean();
if (defined('SYSTEM_LANG')) {
TPL::import_js(base_url() . '/language/' . SYSTEM_LANG . '.js');
}
if (HTTP::is_browser('ie', 8)) {
TPL::import_js('js/jquery.js');
} else {
TPL::import_js('js/jquery.2.js');
}
TPL::import_js(array('admin/js/aws_admin.js', 'admin/js/aws_admin_template.js', 'js/jquery.form.js', 'admin/js/framework.js', 'admin/js/global.js'));
TPL::import_css(array('admin/css/common.css'));
if (in_array($_GET['act'], array('login', 'login_process'))) {
return true;
}
if ($admin_info = H::decode_hash(AWS_APP::session()->admin_login)) {
if ($admin_info['uid'] != $this->user_id or $admin_info['UA'] != $_SERVER['HTTP_USER_AGENT'] or !AWS_APP::session()->permission['is_administortar'] and !AWS_APP::session()->permission['is_moderator']) {
unset(AWS_APP::session()->admin_login);
if ($_POST['_post_type'] == 'ajax') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('会话超时, 请重新登录')));
} else {
H::redirect_msg(AWS_APP::lang()->_t('会话超时, 请重新登录'), '/admin/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
}
}
} else {
if ($_POST['_post_type'] == 'ajax') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('会话超时, 请重新登录')));
} else {
HTTP::redirect('/admin/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
}
}
$this->setup();
}
示例4: remove_attach_action
public function remove_attach_action()
{
if ($attach_info = H::decode_hash(base64_decode($_GET['attach_id']))) {
$this->model('publish')->remove_attach($attach_info['attach_id'], $attach_info['access_key']);
}
H::ajax_json_output(AWS_APP::RSM(null, 1, null));
}