本文整理汇总了PHP中es_session::set方法的典型用法代码示例。如果您正苦于以下问题:PHP es_session::set方法的具体用法?PHP es_session::set怎么用?PHP es_session::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类es_session
的用法示例。
在下文中一共展示了es_session::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_check
function user_check($username_email, $pwd)
{
//$username_email = addslashes($username_email);
//$pwd = addslashes($pwd);
if ($username_email && $pwd) {
//$sql = "select *,id as uid from ".DB_PREFIX."user where (user_name='".$username_email."' or email = '".$username_email."') and is_delete = 0";
$sql = "select *,id as uid from " . DB_PREFIX . "user where (user_name='" . $username_email . "' or email = '" . $username_email . "' or mobile = '" . $username_email . "') ";
$user_info = $GLOBALS['db']->getRow($sql);
$is_use_pass = false;
if (strlen($pwd) != 32) {
if ($user_info['user_pwd'] == md5($pwd . $user_info['code']) || $user_info['user_pwd'] == md5($pwd)) {
$is_use_pass = true;
}
} else {
if ($user_info['user_pwd'] == $pwd) {
$is_use_pass = true;
}
}
if ($is_use_pass) {
es_session::set("user_info", $user_info);
$GLOBALS['user_info'] = $user_info;
return $user_info;
} else {
return null;
}
} else {
return null;
}
}
示例2: do_login_biz
function do_login_biz($account_user, $account_password)
{
$biz_data = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "supplier_account WHERE account_name='" . $account_user . "' AND is_delete = 0");
$result = array();
$result['status'] = 1;
$result['data'] = '';
if (!$biz_data) {
$result['status'] = 0;
$result['data'] = ACCOUNT_NO_EXIST_ERROR;
return $result;
} else {
$result['account_info'] = $biz_data;
if ($biz_data['account_password'] != md5($account_password)) {
$result['status'] = 0;
$result['data'] = ACCOUNT_PASSWORD_ERROR;
return $result;
} elseif ($biz_data['is_effect'] != 1) {
$result['status'] = 0;
$result['data'] = ACCOUNT_NO_VERIFY_ERROR;
return $result;
} else {
$account_locations = $GLOBALS['db']->getAll("select location_id from " . DB_PREFIX . "supplier_account_location_link where account_id = " . $biz_data['id']);
$account_location_ids = array();
foreach ($account_locations as $row) {
$account_location_ids[] = $row['location_id'];
}
$biz_data['location_ids'] = $account_location_ids;
es_session::set("account_info", $biz_data);
$GLOBALS['account_info'] = $biz_data;
}
$GLOBALS['db']->query("update " . DB_PREFIX . "supplier_account set login_ip = '" . CLIENT_IP . "',login_time= " . NOW_TIME . " where id =" . $biz_data['id']);
return $result;
}
}
示例3: dologin
public function dologin()
{
if (check_ipop_limit(get_client_ip(), "supplier_dologin", intval(app_conf("SUBMIT_DELAY")))) {
$account_name = htmlspecialchars(addslashes(trim($_REQUEST['account_name'])));
$account_password = htmlspecialchars(addslashes(trim($_REQUEST['account_password'])));
$account = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_account where account_name = '" . $account_name . "' and account_password = '" . md5($account_password) . "' and is_effect = 1 and is_delete = 0");
if ($account) {
if (intval($_REQUEST['save_password']) == 1) {
es_cookie::set("sp_account_name", $account_name, 3600 * 24 * 30);
es_cookie::set("sp_account_password", md5($account_password), 3600 * 24 * 30);
}
//$account_locations = $GLOBALS['db']->getAll("select location_id from ".DB_PREFIX."supplier_account_location_link where account_id = ".$account['id']);
$account_locations = $GLOBALS['db']->getAll("select id from " . DB_PREFIX . "supplier_location where supplier_id = " . $account['supplier_id']);
$account_location_ids = array(0);
foreach ($account_locations as $row) {
$account_location_ids[] = $row['id'];
}
$account['location_ids'] = $account_location_ids;
es_session::set("account_info", $account);
$result['status'] = 1;
$GLOBALS['db']->query("update " . DB_PREFIX . "supplier_account set login_time = " . get_gmtime() . ",login_ip = '" . get_client_ip() . "' where id = " . $account['id']);
ajax_return($result);
} else {
$result['status'] = 0;
$result['msg'] = $GLOBALS['lang']['SUPPLIER_LOGIN_FAILED'];
ajax_return($result);
}
} else {
$result['status'] = 0;
$result['msg'] = $GLOBALS['lang']['SUBMIT_TOO_FAST'];
ajax_return($result);
}
}
示例4: init
public function init()
{
if (!$GLOBALS['user_info']) {
if ($_REQUEST['ajax'] == 1) {
ajax_return(array("status" => 0, "info" => "请先登录"));
} else {
es_session::set('before_login', $_SERVER['REQUEST_URI']);
app_redirect(url("index", "user#login"));
}
}
$id = intval($_REQUEST['id']);
$this->space_user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $id . " and is_effect= 1 and is_delete = 0");
$user_id = intval($GLOBALS['user_info']['id']);
if (!$this->space_user) {
showErr($GLOBALS['lang']['USER_NOT_EXISTS']);
}
$focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id = " . $this->space_user['id']);
if ($focus_data) {
$this->space_user['focused'] = 1;
}
$province_str = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "region_conf where id = " . $this->space_user['province_id']);
$city_str = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "region_conf where id = " . $this->space_user['city_id']);
if ($province_str . $city_str == '') {
$user_location = $GLOBALS['lang']['LOCATION_NULL'];
} else {
$user_location = $province_str . " " . $city_str;
}
$this->space_user['fav_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where user_id = " . $this->space_user['id'] . " and fav_id <> 0");
$this->space_user['user_location'] = $user_location;
$this->space_user['group_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "user_group where id = " . $this->space_user['group_id'] . " ");
$GLOBALS['tmpl']->assign("space_user", $this->space_user);
$GLOBALS['tmpl']->assign('user_statics', sys_user_status($id, true));
}
示例5: save
function save()
{
$url = $_GET['referer'];
es_session::set("gopreview", $url);
if (!$GLOBALS['user_info']) {
app_redirect(url_wap("user#login"));
}
$info_data = array();
$info_data['user_id'] = $GLOBALS['user_info']['id'];
$info_data['name'] = $GLOBALS['user_info']['user_name'];
$info_data['mobile'] = $GLOBALS['user_info']['mobile'];
$info_data['ip'] = get_client_ip();
$info_data['type'] = $_GET['f'];
$info_data['creat_time'] = time();
$tmp_zhuanti_user_info = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "zhuanti_user where (mobile='" . $info_data['mobile'] . "' or user_id=" . $info_data['user_id'] . ") and type=2");
if ($tmp_zhuanti_user_info) {
app_redirect("http://www.51zhishang.com/course/54.html");
}
$GLOBALS['db']->autoExecute(DB_PREFIX . "zhuanti_user", $info_data, "INSERT");
$msgInfo = array();
$msgInfo['title'] = '专题报名';
$msgInfo['content'] = '专题报名';
send_zhuanti_sms($info_data['mobile'], $msgInfo, 3812);
$data['status'] = 1;
$data['info'] = "报名成功!";
app_redirect("http://www.51zhishang.com/course/54.html");
}
示例6: check_fee
public function check_fee()
{
es_session::start();
$last_visit = intval(es_session::get("last_visit_smsbao"));
if (get_gmtime() - $last_visit > 10) {
$sms = new transport();
$params = array("u" => $this->sms['user_name'], "p" => md5($this->sms['password']));
$url = "http://www.smsbao.com/query";
$result = $sms->request($url, $params);
$match = explode(',', $result['body']);
if ($match[0] != '') {
$remain = (int) $match[1];
$str = sprintf('短信宝增值平台 剩余:%d 条', $remain);
} else {
$str = "短信宝增值平台 (<a href='http://www.smsbao.com/reg?r=5001' target='_blank'><font color='red'>还没账号?点击这免费注册</font></a>)";
}
es_session::set("smsbao_info", $str);
es_session::set("last_visit_smsbao", get_gmtime());
return $str;
} else {
$qxt_info = es_session::get("smsbao_info");
if ($smsbao_info) {
return $smsbao_info;
} else {
return "短信宝增值平台 (<a href='http://www.smsbao.com/reg?r=5001' target='_blank'><font color='red'>还没账号?点击这免费注册</font></a>)";
}
}
}
示例7: Tencent
function Tencent()
{
require_once APP_ROOT_PATH . 'system/api_login/Tencent/Tencent.php';
OAuth::init($GLOBALS['m_config']['tencent_app_key'], $GLOBALS['m_config']['tencent_app_secret']);
$openid = trim($GLOBALS['request']['openid']);
$openkey = trim($GLOBALS['request']['openkey']);
if ($GLOBALS['m_config']['tencent_bind_url'] == "") {
$app_url = get_domain() . APP_ROOT . "/api_callback.php?c=Tencent";
} else {
$app_url = $GLOBALS['m_config']['tencent_bind_url'];
}
$access_token = trim($GLOBALS['request']['access_token']);
es_session::set("t_access_token", $access_token);
es_session::set("t_openid", $openid);
es_session::set("t_openkey", $openkey);
if (es_session::get("t_access_token") || es_session::get("t_openid") && es_session::get("t_openkey")) {
$r = Tencent::api('user/info');
$r = json_decode($r, true);
$name = $r['data']['name'];
if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where tencent_id = '" . $name . "'") == 0) {
$GLOBALS['db']->query("update " . DB_PREFIX . "user set t_access_token ='" . $access_token . "',t_openkey = '" . $openkey . "',t_openid = '" . $openid . "', tencent_id = '" . $name . "' where id =" . intval($GLOBALS['user_info']['id']));
} elseif (intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where tencent_id = '" . $name . "'")) == intval($GLOBALS['user_info']['id'])) {
$GLOBALS['db']->query("update " . DB_PREFIX . "user set t_access_token ='" . $access_token . "',t_openkey = '" . $openkey . "',t_openid = '" . $openid . "', tencent_id = '" . $name . "' where id =" . intval($GLOBALS['user_info']['id']));
} else {
$root['return'] = 0;
$root['info'] = "该微博帐号已被其他会员绑定";
output($root);
}
}
$root['return'] = 1;
$root['info'] = "绑定成功";
$root['login_type'] = "Tencent";
output($root);
}
示例8: do_login
public function do_login()
{
$adm_name = trim($_REQUEST['adm_name']);
$adm_password = trim($_REQUEST['adm_password']);
$ajax = intval($_REQUEST['ajax']);
//是否ajax提交
if ($adm_name == '') {
$this->error(L('ADM_NAME_EMPTY', $ajax));
}
if ($adm_password == '') {
$this->error(L('ADM_PASSWORD_EMPTY', $ajax));
}
if (es_session::get("verify") != md5($_REQUEST['adm_verify'])) {
$this->error(L('ADM_VERIFY_ERROR'), $ajax);
}
$condition['adm_name'] = $adm_name;
$condition['is_effect'] = 1;
$condition['is_delete'] = 0;
$adm_data = M("Admin")->where($condition)->find();
if ($adm_data) {
if ($adm_data['adm_password'] != md5($adm_password)) {
save_log($adm_name . L("ADM_PASSWORD_ERROR"), 0);
//记录密码登录错误的LOG
$this->error(L("ADM_PASSWORD_ERROR"), $ajax);
} else {
if ($adm_data['role_id'] != 6) {
$this->error("您登录的角色不属于店铺系统,请检查您登录的系统是否正确!", $ajax);
} else {
//登录成功
$adm_session['adm_name'] = $adm_data['adm_name'];
$adm_session['adm_id'] = $adm_data['id'];
es_session::set(md5(conf("AUTH_KEY")), $adm_session);
es_session::set('bid', $adm_data['id']);
//商户就是admin
es_session::set('role', $adm_data['role_id']);
//role_id=6 是商户老板, role_id=7 是店铺老板
es_session::set('location_id', $GLOBALS['db']->getOne("select location_id from zsh_supplier_account_location_link where account_id=" . $adm_data['id']));
//店铺
//重新保存记录
$adm_data['login_ip'] = get_client_ip();
$adm_data['login_time'] = get_gmtime();
M("Admin")->save($adm_data);
save_log($adm_data['adm_name'] . L("LOGIN_SUCCESS"), 1);
$this->success(L("LOGIN_SUCCESS"), $ajax);
}
}
} else {
save_log($adm_name . L("ADM_NAME_ERROR"), 0);
//记录用户名登录错误的LOG
$this->error(L("ADM_NAME_ERROR"), $ajax);
}
}
示例9: save
public function save()
{
require_once APP_ROOT_PATH . 'system/libs/user.php';
foreach ($_REQUEST as $k => $v) {
$_REQUEST[$k] = htmlspecialchars(addslashes(trim($v)));
}
if ($GLOBALS['user_info']['user_name']) {
$_REQUEST['user_name'] = $GLOBALS['user_info']['user_name'];
}
$res = save_user($_REQUEST, 'UPDATE');
if ($res['status'] == 1) {
// user_name mobile province_id city_id byear bmonth bday sex my_intro id
// 向im.lingang.me发送用户名片修改请求
$phone = $_REQUEST['mobile'];
$rid = es_cookie::get("rid");
$sig = md5($phone . "_" . $rid . "_" . $rid);
$url = get_doubi_host();
$post = array('action' => 'edit_profile', 'sig' => $sig, 'phone' => $phone, 'uname' => $_REQUEST['user_name'], 'uintro' => $_REQUEST['my_intro'], 'gender' => $_REQUEST['sex'], 'birth' => $_REQUEST['byear'] . "-" . $_REQUEST['bmonth'] . "-" . $_REQUEST['bday']);
$response = json_decode(sentSigPost($url, $post), true);
$s_user_info = es_session::get("user_info");
$user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = '" . intval($s_user_info['id']) . "'");
es_session::set("user_info", $user_info);
if (intval($_REQUEST['is_ajax']) == 1) {
echo 1;
} else {
showSuccess($GLOBALS['lang']['SAVE_USER_SUCCESS']);
}
} else {
$error = $res['data'];
if (!$error['field_show_name']) {
$error['field_show_name'] = $GLOBALS['lang']['USER_TITLE_' . strtoupper($error['field_name'])];
}
if ($error['error'] == EMPTY_ERROR) {
$error_msg = sprintf($GLOBALS['lang']['EMPTY_ERROR_TIP'], $error['field_show_name']);
}
if ($error['error'] == FORMAT_ERROR) {
$error_msg = sprintf($GLOBALS['lang']['FORMAT_ERROR_TIP'], $error['field_show_name']);
}
if ($error['error'] == EXIST_ERROR) {
$error_msg = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $error['field_show_name']);
}
if (intval($_REQUEST['is_ajax']) == 1) {
echo 1;
} else {
showErr($error_msg);
}
}
}
示例10: refreshToken
/**
* 刷新授权信息
* 此处以SESSION形式存储做演示,实际使用场景请做相应的修改
*/
public static function refreshToken()
{
$params = array('client_id' => self::$client_id, 'client_secret' => self::$client_secret, 'grant_type' => 'refresh_token', 'refresh_token' => es_session::get('t_refresh_token'));
$url = self::$accessTokenURL . '?' . http_build_query($params);
$r = Http::request($url);
parse_str($r, $out);
if ($out['access_token']) {
//获取成功
es_session::set('t_access_token', $out['access_token']);
es_session::set('t_refresh_token', $out['refresh_token']);
es_session::set('t_expire_in', $out['expires_in']);
return $out;
} else {
return $r;
}
}
示例11: step1
public function step1()
{
check_issupplier();
$user_id = intval($GLOBALS['user_info']['id']);
if ($user_id == 0) {
es_session::set('before_login', $_SERVER['REQUEST_URI']);
app_redirect(url("shop", "user#login"));
}
$cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_effect = 1 and is_delete = 0 order by sort desc");
$GLOBALS['tmpl']->assign("cate_list", $cate_list);
$deal_city_list = get_deal_citys();
$GLOBALS['tmpl']->assign("city_list", $deal_city_list['ls']);
$GLOBALS['tmpl']->assign("step", 1);
$GLOBALS['tmpl']->assign("page_title", "商家入驻");
$GLOBALS['tmpl']->display("biz/biz_join_step1.html");
}
示例12: do_login
public function do_login()
{
$adm_name = strim($_POST['adm_name']);
$adm_password = trim(FW_DESPWD(trim($_POST['adm_password'])));
$adm_dog_key = strim($_POST['adm_dog_key']);
$ajax = intval($_REQUEST['ajax']);
//是否ajax提交
if ($adm_name == '') {
$this->error(L('ADM_NAME_EMPTY', $ajax));
}
if ($adm_password == '') {
$this->error(L('ADM_PASSWORD_EMPTY', $ajax));
}
if (es_session::get("verify") != md5($_REQUEST['adm_verify'])) {
$this->error(L('ADM_VERIFY_ERROR'), $ajax);
}
$condition['adm_name'] = $adm_name;
$condition['is_effect'] = 1;
$condition['is_delete'] = 0;
$adm_data = M("Admin")->where($condition)->find();
if ($adm_data) {
if ($adm_data['adm_password'] != md5($adm_password)) {
save_log($adm_name . L("ADM_PASSWORD_ERROR"), 0);
//记录密码登录错误的LOG
$this->error(L("ADM_PASSWORD_ERROR"), $ajax);
} else {
//登录成功
$adm_session['adm_name'] = $adm_data['adm_name'];
$adm_session['adm_id'] = $adm_data['id'];
$adm_session['adm_dog_key'] = $adm_dog_key;
es_session::set(md5(conf("AUTH_KEY")), $adm_session);
//重新保存记录
$adm_data['login_ip'] = CLIENT_IP;
$adm_data['login_time'] = TIME_UTC;
M("Admin")->save($adm_data);
save_log($adm_data['adm_name'] . L("LOGIN_SUCCESS"), 1);
$this->success(L("LOGIN_SUCCESS"), $ajax);
}
} else {
save_log($adm_name . L("ADM_NAME_ERROR"), 0);
//记录用户名登录错误的LOG
$this->error(L("ADM_NAME_ERROR"), $ajax);
}
}
示例13: load_cart_list
function load_cart_list($reload = false)
{
if (!$reload) {
static $result;
if ($result) {
return $result;
}
$result = es_session::get("cart_result");
if ($result && is_array($result) && count($result) > 0) {
return $result;
}
$cart_list_res = $GLOBALS['db']->getAll("select c.*,d.icon,d.id as did,d.uname as duname,d.is_delivery as is_delivery from " . DB_PREFIX . "deal_cart as c left join " . DB_PREFIX . "deal as d on c.deal_id = d.id where c.session_id = '" . es_session::id() . "' and c.user_id = " . intval($GLOBALS['user_info']['id']));
$cart_list = array();
foreach ($cart_list_res as $k => $v) {
if ($v['duname'] != "") {
$v['url'] = url("index", "deal#" . $v['duname']);
} else {
$v['url'] = url("index", "deal#" . $v['did']);
}
$cart_list[$v['id']] = $v;
}
$total_data = $GLOBALS['db']->getRow("select sum(total_price) as total_price,sum(return_total_score) as return_total_score,sum(return_total_money) as return_total_money from " . DB_PREFIX . "deal_cart where session_id = '" . es_session::id() . "' and user_id = " . intval($GLOBALS['user_info']['id']));
$result = array("cart_list" => $cart_list, "total_data" => $total_data);
es_session::set("cart_result", $result);
return $result;
} else {
$cart_list_res = $GLOBALS['db']->getAll("select c.*,d.icon,d.id as did,d.uname as duname,d.is_delivery as is_delivery from " . DB_PREFIX . "deal_cart as c left join " . DB_PREFIX . "deal as d on c.deal_id = d.id where c.session_id = '" . es_session::id() . "' and c.user_id = " . intval($GLOBALS['user_info']['id']));
$cart_list = array();
foreach ($cart_list_res as $k => $v) {
if ($v['duname'] != "") {
$v['url'] = url("index", "deal#" . $v['duname']);
} else {
$v['url'] = url("index", "deal#" . $v['did']);
}
$cart_list[$v['id']] = $v;
}
$total_data = $GLOBALS['db']->getRow("select sum(total_price) as total_price,sum(return_total_score) as return_total_score,sum(return_total_money) as return_total_money from " . DB_PREFIX . "deal_cart where session_id = '" . es_session::id() . "' and user_id = " . intval($GLOBALS['user_info']['id']));
$result = array("cart_list" => $cart_list, "total_data" => $total_data);
//有操作程序就更新购物车状态
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_cart set update_time=" . NOW_TIME . ",user_id = " . intval($GLOBALS['user_info']['id']) . " where session_id = '" . es_session::id() . "'");
es_session::set("cart_result", $result);
return $result;
}
}
示例14: password
public function password()
{
if (intval($_REQUEST['code']) != 0) {
$uid = intval($_REQUEST['id']);
$code = intval($_REQUEST['code']);
$GLOBALS['user_info'] = $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $uid . " and password_verify = '" . $code . "' and is_effect = 1");
if ($user_info) {
es_session::set("user_info", $user_info);
$GLOBALS['tmpl']->assign("user_info", $user_info);
$GLOBALS['db']->query("update " . DB_PREFIX . "user set password_verify = '' where id = " . $uid);
} else {
app_redirect(url("index"));
}
} else {
if (!$GLOBALS['user_info']) {
app_redirect(url("user#login"));
}
}
$GLOBALS['tmpl']->display("settings_password.html");
}
示例15: redirect_to_login
/**
* @brief 跳转到QQ登录页面.请求需经过URL编码,编码时请遵循 RFC 1738
*
* @param $appid
* @param $appkey
* @param $callback
*
* @return 返回字符串格式为:oauth_token=xxx&openid=xxx&oauth_signature=xxx×tamp=xxx&oauth_vericode=xxx
*/
function redirect_to_login($appid, $appkey, $callback)
{
//跳转到QQ登录页的接口地址, 不要更改!!
$redirect = "http://openapi.qzone.qq.com/oauth/qzoneoauth_authorize?oauth_consumer_key={$appid}&";
//调用get_request_token接口获取未授权的临时token
$result = array();
$request_token = get_request_token($appid, $appkey);
parse_str($request_token, $result);
//request token, request token secret 需要保存起来
//在demo演示中,直接保存在全局变量中.
//正式网站运营环境中,我们强烈建议你将这两个值保存在MySQL或者其他永久的存储中以便于后续使用
//尤其是在网站不止一台服务器的情况下,两次请求的sessoin信息可能不会保存再同一台服务器导致访问出错
es_session::set("token", $result["oauth_token"]);
es_session::set("secret", $result["oauth_token_secret"]);
if ($result["oauth_token"] == "") {
//示例代码中没有对错误情况进行处理。真实情况下网站需要自己处理错误情况
exit;
}
////构造请求URL
$redirect .= "oauth_token=" . $result["oauth_token"] . "&oauth_callback=" . rawurlencode($callback);
header("Location:{$redirect}");
}