本文整理汇总了PHP中H::encode_hash方法的典型用法代码示例。如果您正苦于以下问题:PHP H::encode_hash方法的具体用法?PHP H::encode_hash怎么用?PHP H::encode_hash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类H
的用法示例。
在下文中一共展示了H::encode_hash方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_invitation_email
public function send_invitation_email($invitation_id)
{
$invitation_row = $this->get_invitation_by_id($invitation_id);
if ($invitation_row['active_status'] == 1) {
return true;
}
$user_info = $this->model('account')->get_user_info_by_uid($invitation_row['uid']);
$email_hash = base64_encode(H::encode_hash(array('email' => $invitation_row['invitation_email'])));
return $this->model('email')->action_email('INVITE_REG', $invitation_row['invitation_email'], get_js_url('/account/register/email-' . urlencode($invitation_row['invitation_email']) . '__icode-' . $invitation_row['invitation_code']), array('user_name' => $user_info['user_name']));
}
示例2: attach_edit_list_action
public function attach_edit_list_action()
{
if (!($project_info = $this->model('project')->get_project_info_by_id($_POST['project_id']))) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('无法获取附件列表')));
}
if ($project_info['uid'] != $this->user_id and !$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator']) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你没有权限编辑这个附件列表')));
}
if ($project_attach = $this->model('publish')->get_attach('project', $_POST['project_id'])) {
foreach ($project_attach as $attach_id => $val) {
$project_attach[$attach_id]['class_name'] = $this->model('publish')->get_file_class($val['file_name']);
$project_attach[$attach_id]['delete_link'] = get_js_url('/publish/ajax/remove_attach/attach_id-' . base64_encode(H::encode_hash(array('attach_id' => $attach_id, 'access_key' => $val['access_key']))));
$project_attach[$attach_id]['attach_id'] = $attach_id;
$project_attach[$attach_id]['attach_tag'] = 'attach';
}
}
H::ajax_json_output(AWS_APP::RSM(array('attachs' => $project_attach), 1, null));
}
示例3: __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;
}
}
示例4: get_login_cookie_hash
/**
* 将用户登录信息编译成 hash 字符串,用于发送 Cookie
*
* @param string
* @param string
* @param string
* @param integer
* @param boolean
* @return string
*/
function get_login_cookie_hash($user_name, $password, $salt, $uid, $hash_password = true)
{
if ($hash_password) {
$password = compile_password($password, $salt);
}
$auth_hash_key = md5(G_COOKIE_HASH_KEY . $_SERVER['HTTP_USER_AGENT'] . $_SERVER['HTTP_ACCEPT_LANGUAGE']);
return H::encode_hash(array('uid' => $uid, 'user_name' => $user_name, 'password' => $password), $auth_hash_key);
}
示例5: set_admin_login
public function set_admin_login($uid)
{
AWS_APP::session()->admin_login = H::encode_hash(array('uid' => $uid, 'UA' => $_SERVER['HTTP_USER_AGENT'], 'ip' => fetch_ip()));
}
示例6: solution_attach_edit_list_action
public function solution_attach_edit_list_action()
{
if (!($solution_info = $this->model('solution')->get_solution_info_by_id($_POST['solution_id']))) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('无法获取附件列表')));
}
if ($solution_attach = $this->model('publish')->get_attach('solution', $solution_info['id'])) {
foreach ($solution_attach as $attach_id => $val) {
$solution_attach[$attach_id]['class_name'] = $this->model('publish')->get_file_class($val['file_name']);
$solution_attach[$attach_id]['delete_link'] = get_js_url('/publish/ajax/remove_attach/attach_id-' . base64_encode(H::encode_hash(array('attach_id' => $attach_id, 'access_key' => $val['access_key']))));
$solution_attach[$attach_id]['attach_id'] = $attach_id;
$solution_attach[$attach_id]['attach_tag'] = 'attach';
}
}
H::ajax_json_output(AWS_APP::RSM(array('attachs' => $solution_attach), 1, null));
}