예제 #1
0
 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 = '******' 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);
     }
 }
예제 #2
0
 public function do_login()
 {
     if (!$_POST) {
         app_redirect(APP_ROOT . "/");
     }
     foreach ($_POST as $k => $v) {
         $_POST[$k] = strim($v);
     }
     $ajax = intval($_REQUEST['ajax']);
     require_once APP_ROOT_PATH . "system/libs/user.php";
     if (check_ipop_limit(get_client_ip(), "user_dologin", 5)) {
         $result = do_login_user($_POST['email'], $_POST['user_pwd']);
     } else {
         showErr("提交太快", $ajax, url("user#login"));
     }
     if ($result['status']) {
         $s_user_info = es_session::get("user_info");
         if (intval($_POST['auto_login']) == 1) {
             //自动登录,保存cookie
             $user_data = $s_user_info;
             es_cookie::set("email", $user_data['email'], 3600 * 24 * 30);
             es_cookie::set("user_pwd", md5($user_data['user_pwd'] . "_EASE_COOKIE"), 3600 * 24 * 30);
         }
         if ($ajax == 0 && trim(app_conf("INTEGRATE_CODE")) == '') {
             $redirect = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : url("index");
             app_redirect($redirect);
         } else {
             $jump_url = get_gopreview();
             if ($ajax == 1) {
                 $return['status'] = 1;
                 $return['info'] = "登录成功";
                 $return['data'] = $result['msg'];
                 $return['jump'] = $jump_url;
                 ajax_return($return);
             } else {
                 $GLOBALS['tmpl']->assign('integrate_result', $result['msg']);
                 showSuccess("登录成功", $ajax, $jump_url);
             }
         }
     } else {
         if ($result['data'] == ACCOUNT_NO_EXIST_ERROR) {
             $err = "会员不存在";
         }
         if ($result['data'] == ACCOUNT_PASSWORD_ERROR) {
             $err = "密码错误";
         }
         if ($result['data'] == ACCOUNT_NO_VERIFY_ERROR) {
             $err = "用户未通过验证";
             if (app_conf("MAIL_ON") == 1 && $ajax == 0) {
                 $GLOBALS['tmpl']->assign("page_title", $err);
                 $GLOBALS['tmpl']->assign("user_info", $result['user']);
                 $GLOBALS['tmpl']->display("verify_user.html");
                 exit;
             }
         }
         showErr($err, $ajax);
     }
 }
예제 #3
0
 public function all()
 {
     $city_name = trim(addslashes($_REQUEST['city']));
     if ($city_name) {
         $deal_city = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_city where uname='' and is_effect = 1 and is_delete = 0");
     }
     if (!$deal_city) {
         $deal_city = get_current_deal_city();
     }
     es_cookie::set("deal_city", $deal_city['id']);
     app_redirect(url("index"));
 }
예제 #4
0
 public function set_sort_idx()
 {
     $type = trim(addslashes($_REQUEST['type']));
     es_cookie::set("sort_field_idx", $type);
     if ($type != 'sort') {
         $sort_type = trim(es_cookie::get("sort_type_idx"));
         if ($sort_type && $sort_type == 'desc') {
             es_cookie::set("sort_type_idx", 'asc');
         } else {
             es_cookie::set("sort_type_idx", 'desc');
         }
     } else {
         es_cookie::set("sort_type_idx", 'desc');
     }
 }
예제 #5
0
 /**
  * 
  * @param unknown_type $param
  * 参数说明:
  * type: deal/shop/youhui/event/store
  * rel_id: 相关类型浏览历史的ID
  * session_id: 当前的session_id
  * uid: 当前的会员ID
  * 
  * 如将历史存于cookie,无需使用session_id与uid
  * 如将历史存于服务端,则需要session_id
  * 如将历史存于服务端,并需要按会员保存,则需要uid
  * 默认功能存储于cookie
  * 
  * @return unknown
  */
 public function load($param)
 {
     $rel_id = intval($param['rel_id']);
     unset($param['rel_id']);
     //为默认cookie准备的参数
     unset($param['session_id']);
     unset($param['uid']);
     if ($param['type'] == "shop") {
         //商城不用城市划分
         unset($param['city_id']);
     }
     $key = $this->build_key(__CLASS__, $param);
     $history_ids = strim(es_cookie::get($key));
     if ($history_ids) {
         $history_ids = explode(",", $history_ids);
     }
     if (!is_array($history_ids)) {
         $history_ids = array();
     }
     if ($rel_id) {
         foreach ($history_ids as $k => $id_item) {
             if ($id_item == $rel_id) {
                 unset($history_ids[$k]);
             }
         }
         $history_ids[] = $rel_id;
         while (count($history_ids) > app_conf("SIDE_DEAL_COUNT")) {
             array_shift($history_ids);
         }
         $history_ids_rs = implode(",", $history_ids);
         es_cookie::set($key, $history_ids_rs, 24 * 3600);
     }
     $tmp_history_ids = $history_ids;
     //用于倒序排序的临时数组
     $return_history = array();
     while (count($tmp_history_ids) > 0) {
         $return_history[] = array_pop($tmp_history_ids);
     }
     return $return_history;
 }
예제 #6
0
 public function close_notify()
 {
     es_cookie::set("hide_user_notify", 1);
 }
예제 #7
0
 public function save_mobile()
 {
     $mobile = strim($_POST['mobile']);
     $cid = strim($_POST['cid']);
     $verify_coder = strim($_POST['verify_coder']);
     if ($mobile == null) {
         $data['status'] = 0;
         $data['info'] = "手机号码不能为空!";
         ajax_return($data);
         return false;
     }
     if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "mobile_verify_code WHERE mobile=" . $mobile . " AND verify_code='" . $verify_coder . "'") == 0) {
         $data['status'] = 0;
         $data['info'] = "手机验证码出错";
         ajax_return($data);
         return false;
     }
     $id = $GLOBALS['user_info']['id'];
     if ($GLOBALS['db']->query("UPDATE " . DB_PREFIX . "user SET mobile=" . $mobile . " WHERE id = " . $id)) {
         //绑定过回退不用再次发送短信
         es_cookie::set(md5("mobile_is_bind" . $GLOBALS['user_info']['id']), 1);
         $data['status'] = 1;
         ajax_return($data);
     }
     return false;
 }
예제 #8
0
 static function delete($name)
 {
     es_cookie::set($name, '', 0);
 }
예제 #9
0
 public function set_event_sort()
 {
     $type = htmlspecialchars(addslashes(trim($_REQUEST['type'])));
     es_cookie::set("event_sort_field", $type);
     if ($type != 'sort') {
         $sort_type = trim(es_cookie::get("event_sort_type"));
         if ($sort_type && $sort_type == 'desc') {
             es_cookie::set("event_sort_type", 'asc');
         } else {
             es_cookie::set("event_sort_type", 'desc');
         }
     } else {
         es_cookie::set("event_sort_type", 'desc');
     }
 }
예제 #10
0
 public function dologin()
 {
     if (!$_POST) {
         app_redirect("404.html");
         exit;
     }
     foreach ($_POST as $k => $v) {
         $_POST[$k] = htmlspecialchars(addslashes($v));
     }
     $ajax = intval($_REQUEST['ajax']);
     if (!check_hash_key()) {
         showErr("非法请求!", $ajax);
     }
     //验证码
     if (app_conf("VERIFY_IMAGE") == 1) {
         $verify = md5(trim($_REQUEST['verify']));
         $session_verify = es_session::get('verify');
         if ($verify != $session_verify) {
             showErr($GLOBALS['lang']['VERIFY_CODE_ERROR'], $ajax, url("shop", "user#login"));
         }
     }
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $_POST['user_pwd'] = trim(FW_DESPWD($_POST['user_pwd']));
     if (check_ipop_limit(CLIENT_IP, "user_dologin", intval(app_conf("SUBMIT_DELAY")))) {
         $result = do_login_user($_POST['email'], $_POST['user_pwd']);
     } else {
         showErr($GLOBALS['lang']['SUBMIT_TOO_FAST'], $ajax, url("shop", "user#login"));
     }
     if ($result['status']) {
         $s_user_info = es_session::get("user_info");
         if (intval($_POST['auto_login']) == 1) {
             //自动登录,保存cookie
             $user_data = $s_user_info;
             es_cookie::set("user_name", $user_data['email'], 3600 * 24 * 30);
             es_cookie::set("user_pwd", md5($user_data['user_pwd'] . "_EASE_COOKIE"), 3600 * 24 * 30);
         }
         if ($ajax == 0 && trim(app_conf("INTEGRATE_CODE")) == '') {
             $redirect = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : url("index");
             app_redirect($redirect);
         } else {
             $jump_url = get_gopreview();
             $s_user_info = es_session::get("user_info");
             if ($s_user_info['ips_acct_no'] == "" && app_conf("OPEN_IPS")) {
                 if ($ajax == 1) {
                     $return['status'] = 2;
                     $return['info'] = "本站需绑定第三方托管账户,是否马上去绑定";
                     $return['data'] = $result['msg'];
                     $return['jump'] = $jump_url;
                     $return['jump1'] = APP_ROOT . "/index.php?ctl=collocation&act=CreateNewAcct&user_type=0&user_id=" . $s_user_info['id'];
                     ajax_return($return);
                 } else {
                     $GLOBALS['tmpl']->assign('integrate_result', $result['msg']);
                     showSuccess($GLOBALS['lang']['LOGIN_SUCCESS'], $ajax, $jump_url);
                 }
             } else {
                 if ($ajax == 1) {
                     $return['status'] = 1;
                     $return['info'] = $GLOBALS['lang']['LOGIN_SUCCESS'];
                     $return['data'] = $result['msg'];
                     $return['jump'] = $jump_url;
                     ajax_return($return);
                 } else {
                     $GLOBALS['tmpl']->assign('integrate_result', $result['msg']);
                     showSuccess($GLOBALS['lang']['LOGIN_SUCCESS'], $ajax, $jump_url);
                 }
             }
         }
     } else {
         if ($result['data'] == ACCOUNT_NO_EXIST_ERROR) {
             $err = $GLOBALS['lang']['USER_NOT_EXIST'];
         }
         if ($result['data'] == ACCOUNT_PASSWORD_ERROR) {
             $err = $GLOBALS['lang']['PASSWORD_ERROR'];
         }
         if ($result['data'] == ACCOUNT_NO_VERIFY_ERROR) {
             $err = $GLOBALS['lang']['USER_NOT_VERIFY'];
             if (app_conf("MAIL_ON") == 1 && $ajax == 0) {
                 $GLOBALS['tmpl']->assign("page_title", $err);
                 $GLOBALS['tmpl']->assign("user_info", $result['user']);
                 $GLOBALS['tmpl']->display("verify_user.html");
                 exit;
             }
         }
         showErr($err, $ajax);
     }
 }
예제 #11
0
파일: main_lib.php 프로젝트: macall/jsd
/**
 * 前端全运行函数,生成系统前台使用的全局变量
 * 1. 定位城市 GLOBALS['city'];
 * 2. 加载会员 GLOBALS['user_info'];
 * 3. 生成语言包
 * 4. 加载推荐人与来路
 * 5. 更新购物车
 */
function global_run()
{
    if (app_conf("SHOP_OPEN") == 0) {
        app_redirect(url("index", "close"));
    }
    //处理城市
    global $city;
    require_once APP_ROOT_PATH . "system/model/city.php";
    $city = City::locate_city();
    global $geo;
    $geo = City::locate_geo(floatval($_REQUEST['xpoint']), floatval($_REQUEST['ypoint']));
    //输出语言包的js
    if (!file_exists(get_real_path() . "public/runtime/app/lang.js")) {
        $str = "var LANG = {";
        foreach ($GLOBALS['lang'] as $k => $lang_row) {
            $str .= "\"" . $k . "\":\"" . str_replace("nbr", "\\n", addslashes($lang_row)) . "\",";
        }
        $str = substr($str, 0, -1);
        $str .= "};";
        @file_put_contents(get_real_path() . "public/runtime/app/lang.js", $str);
    }
    //会员自动登录及输出
    global $user_info;
    global $user_logined;
    require_once APP_ROOT_PATH . "system/model/user.php";
    $user_info = es_session::get('user_info');
    if (empty($user_info)) {
        $cookie_uname = es_cookie::get("user_name") ? es_cookie::get("user_name") : '';
        $cookie_upwd = es_cookie::get("user_pwd") ? es_cookie::get("user_pwd") : '';
        if ($cookie_uname != '' && $cookie_upwd != '' && !es_session::get("user_info")) {
            $cookie_uname = strim($cookie_uname);
            $cookie_upwd = strim($cookie_upwd);
            auto_do_login_user($cookie_uname, $cookie_upwd);
            $user_info = es_session::get('user_info');
        }
    }
    refresh_user_info();
    //刷新购物车
    require_once APP_ROOT_PATH . "system/model/cart.php";
    refresh_cart_list();
    global $ref_uid;
    //保存返利的cookie
    if ($_REQUEST['r']) {
        $rid = intval(base64_decode($_REQUEST['r']));
        $ref_uid = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id = " . intval($rid)));
        es_cookie::set("REFERRAL_USER", intval($ref_uid));
    } else {
        //获取存在的推荐人ID
        if (intval(es_cookie::get("REFERRAL_USER")) > 0) {
            $ref_uid = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id = " . intval(es_cookie::get("REFERRAL_USER"))));
        }
    }
    global $referer;
    //保存来路
    // 	es_cookie::delete("referer_url");
    if (!es_cookie::get("referer_url")) {
        if (!preg_match("/" . urlencode(SITE_DOMAIN . APP_ROOT) . "/", urlencode($_SERVER["HTTP_REFERER"]))) {
            $ref_url = $_SERVER["HTTP_REFERER"];
            if (substr($ref_url, 0, 7) == "http://" || substr($ref_url, 0, 8) == "https://") {
                preg_match("/http[s]*:\\/\\/[^\\/]+/", $ref_url, $ref_url);
                $referer = $ref_url[0];
                if ($referer) {
                    es_cookie::set("referer_url", $referer);
                }
            }
        }
    } else {
        $referer = es_cookie::get("referer_url");
    }
    $referer = strim($referer);
}
예제 #12
0
{
	$rid = strim(base64_decode($_REQUEST['r']));
	$ref_uid = intval($GLOBALS['db']->getOne("select id from ".DB_PREFIX."user where user_name = '".$rid."' OR mobile='".$rid."'"));
	es_cookie::set("REFERRAL_USER",intval($ref_uid));
}
else
{
	//获取存在的推荐人ID
	if(intval(es_cookie::get("REFERRAL_USER"))>0)
	$ref_uid = intval($GLOBALS['db']->getOne("select id from ".DB_PREFIX."user where id = ".intval(es_cookie::get("REFERRAL_USER"))));
}
*/
//保存来路
if (!es_cookie::get("referer_url")) {
    if (!preg_match("/" . urlencode(SITE_DOMAIN . APP_ROOT) . "/", urlencode($_SERVER["HTTP_REFERER"]))) {
        es_cookie::set("referer_url", $_SERVER["HTTP_REFERER"]);
    }
}
$referer = es_cookie::get("referer_url");
$IMG_APP_ROOT = APP_ROOT;
if (!file_exists(APP_ROOT_PATH . 'public/runtime/app/tpl_caches/')) {
    mkdir(APP_ROOT_PATH . 'public/runtime/app/tpl_caches/', 0777);
}
if (!file_exists(APP_ROOT_PATH . 'public/runtime/app/tpl_compiled/')) {
    mkdir(APP_ROOT_PATH . 'public/runtime/app/tpl_compiled/', 0777);
}
$GLOBALS['tmpl']->cache_dir = APP_ROOT_PATH . 'public/runtime/app/tpl_caches';
$GLOBALS['tmpl']->compile_dir = APP_ROOT_PATH . 'public/runtime/app/tpl_compiled';
$GLOBALS['tmpl']->template_dir = APP_ROOT_PATH . 'app/Tpl/' . app_conf("TEMPLATE");
//定义当前语言包
$GLOBALS['tmpl']->assign("LANG", $lang);
예제 #13
0
 public function dophlogin()
 {
     $user_mobile = strim($_POST['user_mobile']);
     $sms_verify = strim($_POST['sms_verify']);
     if (app_conf("SMS_ON") == 0) {
         $data['status'] = false;
         $data['info'] = "短信功能未开启";
         ajax_return($data);
     }
     if ($user_mobile == "") {
         $data['status'] = false;
         $data['info'] = "请输入手机号";
         $data['field'] = "user_mobile";
         ajax_return($data);
     }
     if ($sms_verify == "") {
         $data['status'] = false;
         $data['info'] = "请输入收到的验证码";
         $data['field'] = "sms_verify";
         ajax_return($data);
     }
     $sql = "DELETE FROM " . DB_PREFIX . "sms_mobile_verify WHERE add_time <=" . (NOW_TIME - SMS_EXPIRESPAN);
     $GLOBALS['db']->query($sql);
     $mobile_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "sms_mobile_verify where mobile_phone = '" . $user_mobile . "'");
     if ($mobile_data['code'] == $sms_verify) {
         //开始登录
         //1. 有用户使用已有用户登录
         //2. 无用户产生一个用户登录
         require_once APP_ROOT_PATH . "system/model/user.php";
         if (check_ipop_limit(CLIENT_IP, "user_dophlogin", intval(app_conf("SUBMIT_DELAY")))) {
             $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where mobile = '" . $user_mobile . "'");
             $GLOBALS['db']->query("delete from " . DB_PREFIX . "sms_mobile_verify where mobile_phone = '" . $user_mobile . "'");
             if ($user_info) {
                 //使用已有用户
                 $result = do_login_user($user_info['user_name'], $user_info['user_pwd']);
                 if ($result['status']) {
                     $s_user_info = es_session::get("user_info");
                     if (strim($_REQUEST['form_prefix']) == "ajax") {
                         $GLOBALS['user_info'] = $s_user_info;
                         refresh_user_info();
                         if ($GLOBALS['user_info']) {
                             $msg_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "msg_box where user_id = " . intval($GLOBALS['user_info']['id']) . " and is_read = 0 and is_delete = 0");
                             $GLOBALS['tmpl']->assign("msg_count", intval($msg_count));
                             $GLOBALS['tmpl']->assign("user_info", $GLOBALS['user_info']);
                             //输出签到结果
                             $signin_result = es_session::get("signin_result");
                             if ($signin_result['status']) {
                                 $GLOBALS['tmpl']->assign("signin_result", json_encode($signin_result));
                                 es_session::delete("signin_result");
                             }
                         }
                         $tip = $GLOBALS['tmpl']->fetch("inc/insert/load_user_tip.html");
                     }
                     if (intval($_REQUEST['save_mobile']) == 1) {
                         es_cookie::set("fanwe_mobile", $user_mobile, 3600 * 24 * 7);
                     }
                     $GLOBALS['db']->query("delete from " . DB_PREFIX . "sms_mobile_verify where mobile_phone = '" . $user_mobile . "'");
                     $return['status'] = true;
                     $return['info'] = "登录成功";
                     $return['data'] = $result['msg'];
                     $return['jump'] = get_gopreview();
                     $return['tip'] = $tip;
                     ajax_return($return);
                 } else {
                     if ($result['data'] == ACCOUNT_NO_EXIST_ERROR) {
                         $field = "";
                         $err = $GLOBALS['lang']['USER_NOT_EXIST'];
                     }
                     if ($result['data'] == ACCOUNT_PASSWORD_ERROR) {
                         $field = "";
                         $err = $GLOBALS['lang']['PASSWORD_ERROR'];
                     }
                     if ($result['data'] == ACCOUNT_NO_VERIFY_ERROR) {
                         $field = "";
                         $err = $GLOBALS['lang']['USER_NOT_VERIFY'];
                     }
                     $data['status'] = false;
                     $data['info'] = $err;
                     $data['field'] = $field;
                     ajax_return($data);
                 }
             } else {
                 //ip限制
                 $ip = CLIENT_IP;
                 $ip_nums = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where login_ip = '" . $ip . "'");
                 if ($ip_nums > intval(app_conf("IP_LIMIT_NUM")) && intval(app_conf("IP_LIMIT_NUM")) > 0) {
                     $data['status'] = false;
                     $data['info'] = $GLOBALS['lang']['IP_LIMIT_ERROR'];
                     ajax_return($data);
                 }
                 global_run();
                 if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where user_name = '" . $user_mobile . "' or mobile = '" . $user_mobile . "' or email = '" . $user_mobile . "'") > 0) {
                     $data['status'] = false;
                     $data['info'] = "手机号已被抢占";
                     ajax_return($data);
                 }
                 //生成新用户
                 $user_data = array();
                 $user_data['mobile'] = $user_mobile;
                 /*
                 $user_data['user_pwd'] = md5(rand(100000,999999));
                 $user_data['is_effect'] = 1;
                 $user_data['pid'] = $GLOBALS['ref_uid'];
                 $user_data['create_time'] = NOW_TIME;
                 $user_data['update_time'] = NOW_TIME;
                 $user_data['login_time'] = NOW_TIME;
                 $user_data['login_ip'] = CLIENT_IP;
                 $user_data['is_tmp'] = 1;
                 $GLOBALS['db']->autoExecute(DB_PREFIX."user",$user_data,"INSERT","","SILENT");
                 $user_id = intval($GLOBALS['db']->insert_id());
                 if($user_id==0)
                 {
                 	$data['status'] = false;
                 	$data['info']	=	"手机号已被抢占";
                 	ajax_return($data);
                 }
                 $user_name = "游客_".$user_id;
                 $GLOBALS['db']->query("update ".DB_PREFIX."user set user_name = '".$user_name."' where id = ".$user_id,"SILENT");	
                 $result = do_login_user($user_name,$user_data['user_pwd']);
                 */
                 $rs_data = auto_create($user_data, 1);
                 if (!$rs_data['status']) {
                     $data['status'] = false;
                     $data['info'] = $rs_data['info'];
                     ajax_return($data);
                 }
                 $result = do_login_user($rs_data['user_data']['user_name'], $rs_data['user_data']['user_pwd']);
                 if ($result['status']) {
                     $s_user_info = es_session::get("user_info");
                     if (strim($_REQUEST['form_prefix']) == "ajax") {
                         $GLOBALS['user_info'] = $s_user_info;
                         refresh_user_info();
                         if ($GLOBALS['user_info']) {
                             $msg_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "msg_box where user_id = " . intval($GLOBALS['user_info']['id']) . " and is_read = 0 and is_delete = 0");
                             $GLOBALS['tmpl']->assign("msg_count", intval($msg_count));
                             $GLOBALS['tmpl']->assign("user_info", $GLOBALS['user_info']);
                             //输出签到结果
                             $signin_result = es_session::get("signin_result");
                             if ($signin_result['status']) {
                                 $GLOBALS['tmpl']->assign("signin_result", json_encode($signin_result));
                                 es_session::delete("signin_result");
                             }
                         }
                         $tip = $GLOBALS['tmpl']->fetch("inc/insert/load_user_tip.html");
                     }
                     if (intval($_REQUEST['save_mobile']) == 1) {
                         es_cookie::set("fanwe_mobile", $user_mobile, 3600 * 24 * 7);
                     }
                     $GLOBALS['db']->query("delete from " . DB_PREFIX . "sms_mobile_verify where mobile_phone = '" . $user_mobile . "'");
                     $return['status'] = true;
                     $return['info'] = "登录成功";
                     $return['data'] = $result['msg'];
                     $return['jump'] = get_gopreview();
                     $return['tip'] = $tip;
                     ajax_return($return);
                 }
             }
         } else {
             showErr("提交太快了", 1);
         }
     } else {
         $data['status'] = false;
         $data['info'] = "验证码错误";
         $data['field'] = "sms_verify";
         ajax_return($data);
     }
 }
예제 #14
0
 /**
 * @param:
 * array(3) {
     ["mobile"]=>
         string(11) "15001204748"
         ["user_pwd"]=>
         string(256) "555fba1215f3bb227589530780613e92bb4ebc095bb67bce929cc74c52850c877d6e8e1dfe37a1c48182a68ce4776f4cbdb2edb7b33288ae26d7bc7046b08f3c011f46343c6f6b1a6dff997c6bcf9c58576fb8bb398c4f3c6279256c14e21e1d71c30f6e33da43f5cef429cc220ebe2fbec64ec668f91092fcff442c66d83b05"
         ["ajax"]=>
         string(1) "1"
         ["auto_login"]=>
           string(1) "1"
 }
 * echo : {"status":0,"info":"\u7528\u6237\u4e0d\u5b58\u5728","jump":""}
 */
 public function dologin()
 {
     if (!$_POST) {
         app_redirect(APP_ROOT . "/");
     }
     foreach ($_POST as $k => $v) {
         $_POST[$k] = htmlspecialchars(addslashes($v));
     }
     $ajax = intval($_REQUEST['ajax']);
     //验证码
     if (app_conf("VERIFY_IMAGE") == 1) {
         $verify = md5(trim($_REQUEST['verify']));
         $session_verify = es_session::get('verify');
         if ($verify != $session_verify) {
             showErr($GLOBALS['lang']['VERIFY_CODE_ERROR'], $ajax, url("shop", "user#login"));
         }
     }
     $phone = $_POST['mobile'];
     // 查看用户是否有效
     $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where mobile=" . $phone . " and is_delete=0");
     if ($count <= 0 || $count == false) {
         showErr('用户不存在', $ajax, url("shop", "user#login"));
     }
     $pwd = $_POST['user_pwd'];
     $encrypted = convert($pwd);
     //hex data to bin data
     $pwd = rsa_decrypt($encrypted, RSA_PRIVATE_KEY, RSA_MODULUS, RSA_KEY_LENGTH);
     $php_rsa_pub_key = get_php_rsa_public_key();
     $url = get_doubi_host();
     openssl_public_encrypt($phone . "_" . md5($pwd), $sig, $php_rsa_pub_key);
     $sig = base64_encode($sig);
     $post = array("action" => "login", "phone" => $phone, 'sig' => $sig);
     $response = json_decode(sentSigPost($url, $post), true);
     // response {"ret":"0","rid":"70010b9ac7efab7087a49ba8f007a246","uid":"","cityid":"1"}
     //do_login_user($phone,$pwd);
     switch ($response['ret']) {
         case '0':
             //            if(intval($_POST['auto_login'])==1){
             // 如果选择了自动登录,向cookie中set自动登录签名值
             //es_cookie::set("user_name",$user_data['email'],3600*24*30);
             es_cookie::set("rid", $response['rid'], 3600 * 24 * 30);
             //           }
             /**
             		    $user_data = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."user where mobile = $phone");	
                         $result['user']=$user_data;//存所有用户信息
                         **/
             require_once APP_ROOT_PATH . "system/libs/user.php";
             $result = do_login_user($phone, $pwd);
             /**
                         $result['status'] = 1;
                         $result['step']=1;
                         **/
             break;
         default:
             $err_msg = get_msg_with_ret($response['ret']);
             showErr($err_msg, $ajax, url("shop", "user#login"));
     }
     if ($result['status']) {
         $s_user_info = es_session::get("user_info");
         //更新购物车
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal_cart set user_id = " . intval($s_user_info['id']) . " where session_id = '" . es_session::id() . "'");
         if (intval($_POST['auto_login']) == 1) {
             //自动登录,保存cookie
             $user_data = $s_user_info;
             es_cookie::set("user_name", $user_data['email'], 3600 * 24 * 30);
             es_cookie::set("user_pwd", md5($user_data['user_pwd'] . "_EASE_COOKIE"), 3600 * 24 * 30);
         }
         if ($ajax == 0 && trim(app_conf("INTEGRATE_CODE")) == '') {
             $redirect = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : url("index");
             app_redirect($redirect);
         } else {
             $jump_url = get_gopreview();
             if ($ajax == 1) {
                 $return['status'] = 1;
                 $return['info'] = $GLOBALS['lang']['LOGIN_SUCCESS'];
                 $return['data'] = $result['msg'];
                 $return['jump'] = $jump_url;
                 ajax_return($return);
             } else {
                 $GLOBALS['tmpl']->assign('integrate_result', $result['msg']);
                 showSuccess($GLOBALS['lang']['LOGIN_SUCCESS'], $ajax, $jump_url);
             }
         }
     } else {
         if ($result['data'] == ACCOUNT_NO_EXIST_ERROR) {
             $err = $GLOBALS['lang']['USER_NOT_EXIST'];
         }
         if ($result['data'] == ACCOUNT_PASSWORD_ERROR) {
             $err = $GLOBALS['lang']['PASSWORD_ERROR'];
         }
         if ($result['data'] == ACCOUNT_NO_VERIFY_ERROR) {
             $err = $GLOBALS['lang']['USER_NOT_VERIFY'];
             if (app_conf("MAIL_ON") == 1 && $ajax == 0) {
                 $GLOBALS['tmpl']->assign("page_title", $err);
                 $GLOBALS['tmpl']->assign("user_info", $result['user']);
                 $GLOBALS['tmpl']->display("verify_user.html");
                 exit;
             }
         }
         showErr($err, $ajax);
     }
 }
예제 #15
0
파일: index.php 프로젝트: macall/baikec_jsd
 if ($class == 'login') {
     $i = json_decode($data);
     if ($i->return == 1) {
         /*
         //将会员信息存在session中			
          			es_session::set('uid',$i->uid);
         es_session::set('user_name',$i->user_name);
         es_session::set('user_pwd',$request_param['pwd']);
         //cookie
         es_cookie::set('uid',$i->uid,3600*24*365);
         es_cookie::set('user_name',$i->user_name,3600*24*365);
         es_cookie::set('user_pwd',$request_param['pwd'],3600*24*365);
         */
         es_session::delete("user_info");
         es_cookie::set("user_name", $i->user_name, 3600 * 24 * 30);
         es_cookie::set("user_pwd", md5($i->user_pwd . "_EASE_COOKIE"), 3600 * 24 * 30);
     }
 }
 if ($class == 'biz_login') {
     $i = json_decode($data);
     if ($i->status == 1) {
         //将会员信息存在session中
         es_session::set('supplier_id', $i->supplier_id);
         es_session::set('biz_email', $i->biz_email);
         es_session::set('biz_pwd', $i->biz_pwd);
     }
 }
 if ($class == 'changecity') {
     $i = json_decode($data);
     //print_r($i);
     if ($i->status == 1) {
예제 #16
0
파일: app_init.php 프로젝트: BruceJi/fanwe
     es_session::set('user_info', $user_info);
     //查询登入用户所对应的user_level
     //$user_level=$GLOBALS['db']->getAll("select * from ".DB_PREFIX."user_level where id=".intval($GLOBALS['user_info']['user_level']));
     //给前台会员的level值
     $user_info['user_icon'] = $user_level[$user_info['user_level']]['icon'];
     $user_info['cate_name'] = unserialize($user_info['cate_name']);
     //var_dump($user_info['cate_name']);
     //$GLOBALS['tmpl']->assign("user_level",$user_level);
     $GLOBALS['tmpl']->assign("user_info", $user_info);
 }
 global $ref_uid;
 //保存返利的cookie
 if ($_REQUEST['ref']) {
     $rid = intval(base64_decode($_REQUEST['ref']));
     $ref_uid = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id = " . intval($rid)));
     es_cookie::set("REFERRAL_USER", intval($ref_uid));
 } else {
     //获取存在的推荐人ID
     if (intval(es_cookie::get("REFERRAL_USER")) > 0) {
         $ref_uid = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where id = " . intval(es_cookie::get("REFERRAL_USER"))));
     }
 }
 //输出导航菜单
 $nav_list = get_nav_list();
 $nav_list = init_nav_list($nav_list);
 $GLOBALS['tmpl']->assign("nav_list", $nav_list);
 //输出SEO元素
 $GLOBALS['tmpl']->assign("site_name", app_conf("SITE_NAME"));
 $GLOBALS['tmpl']->assign("seo_title", app_conf("SEO_TITLE"));
 $GLOBALS['tmpl']->assign("seo_keyword", app_conf("SEO_KEYWORD"));
 $GLOBALS['tmpl']->assign("seo_description", app_conf("SEO_DESCRIPTION"));
예제 #17
0
파일: index.php 프로젝트: macall/baikec_jsd
<?php

// +----------------------------------------------------------------------
// | Fanwe 方维o2o商业系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 云淡风轻(97139915@qq.com)
// +----------------------------------------------------------------------
define("FILE_PATH", "");
//文件目录,空为根目录
require_once './system/system_init.php';
if (isMobile() && !isset($_REQUEST['is_pc']) && es_cookie::get("is_pc") != 1 && file_exists("./wap/index.php") && strim($_REQUEST['ctl']) != "app_download") {
    app_redirect("./wap/index.php");
} else {
    require_once APP_ROOT_PATH . 'app/Lib/' . APP_TYPE . '/core/MainApp.class.php';
    //实例化一个网站应用实例
    $AppWeb = new MainApp();
    if ($_REQUEST['is_pc'] == 1) {
        es_cookie::set("is_pc", "1", 24 * 3600 * 30);
    }
}