本文整理汇总了PHP中es_cookie::get方法的典型用法代码示例。如果您正苦于以下问题:PHP es_cookie::get方法的具体用法?PHP es_cookie::get怎么用?PHP es_cookie::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类es_cookie
的用法示例。
在下文中一共展示了es_cookie::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_sort_idx
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');
}
}
示例2: 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);
}
}
}
示例3: login
public function login()
{
global_run();
init_app_page();
if ($GLOBALS['user_info']['is_tmp'] == 1) {
app_redirect(url("index", "uc_account"));
}
$fanwe_mobile = es_cookie::get("fanwe_mobile");
$GLOBALS['tmpl']->assign("fanwe_mobile", $fanwe_mobile);
$GLOBALS['tmpl']->assign("sms_lesstime", load_sms_lesstime());
$GLOBALS['tmpl']->assign("sms_ipcount", load_sms_ipcount());
$GLOBALS['tmpl']->assign("form_prefix", "page");
$GLOBALS['tmpl']->assign("no_nav", true);
//无分类下拉
$GLOBALS['tmpl']->assign("page_title", "用户登录");
$GLOBALS['tmpl']->display("user_login.html");
}
示例4: get_deal_list
/**
* 获取正在进行的投标列表
*/
function get_deal_list($limit = "", $cate_id = 0, $where = '', $orderby = '', $user_name = '', $user_pwd = '', $is_all = false)
{
$time = TIME_UTC;
$count_sql = "select count(*) from " . DB_PREFIX . "deal where 1=1 ";
if ($is_all == false) {
$count_sql .= " and is_effect = 1 and is_delete = 0 ";
}
if (es_cookie::get("shop_sort_field") == "ulevel") {
$extfield = ",(SELECT u.level_id FROM fanwe_user u WHERE u.id=user_id ) as ulevel";
}
$sql = "select *,start_time as last_time,(load_money/borrow_amount*100) as progress_point,(start_time + enddate*24*3600 - " . $time . ") as remain_time {$extfield} from " . DB_PREFIX . "deal where 1 = 1 ";
if ($is_all == false) {
$sql .= " and is_effect = 1 and is_delete = 0 ";
}
if ($cate_id > 0) {
$ids = load_auto_cache("deal_sub_parent_cate_ids", array("cate_id" => $cate_id));
$sql .= " and cate_id in (" . implode(",", $ids) . ")";
$count_sql .= " and cate_id in (" . implode(",", $ids) . ")";
}
if ($where != '') {
$sql .= " and " . $where;
$count_sql .= " and " . $where;
}
if ($orderby == '') {
$sql .= " order by sort desc ";
} else {
$sql .= " order by " . $orderby;
}
if ($limit != "") {
$sql .= " limit " . $limit;
}
$deals_count = $GLOBALS['db']->getOne($count_sql);
if ($deals_count > 0) {
$deals = $GLOBALS['db']->getAll($sql);
//echo $sql;
if ($deals) {
foreach ($deals as $k => $deal) {
format_deal_item($deal, $user_name, $user_pwd);
$deals[$k] = $deal;
}
}
} else {
$deals = array();
}
return array('list' => $deals, 'count' => $deals_count);
}
示例5: index
public function index()
{
if (!$GLOBALS['user_info']) {
app_redirect(url_wap("user#login"));
}
$id = $GLOBALS['user_info']['id'];
$mobile_is_bind = es_cookie::get(md5("mobile_is_bind" . $id));
$GLOBALS['tmpl']->assign("mobile_is_bind", $mobile_is_bind);
$data = $GLOBALS['db']->getRow("select is_investor,identify_name,identify_number,identify_positive_image,identify_nagative_image,investor_status,identify_business_licence,identify_business_code,identify_business_tax,identify_business_name from " . DB_PREFIX . "user where id=" . $id);
if ($data['is_investor'] == 1 && $data['investor_status'] == 0 && $data['identify_name'] != null && $data['identify_number'] != null && $data['identify_positive_image'] != null && $data['identify_nagative_image'] != null || $data['is_investor'] == 2 && $data['investor_status'] == 0 && $data['identify_business_licence'] != null && $data['identify_business_code'] != null && $data['identify_business_tax'] != null && $data['identify_business_name'] != null || $data['investor_status'] == 1 || $data['investor_status'] == 1) {
app_redirect(url_wap("user#investor_result"));
}
//服务条款
$help_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "help where type ='term'");
$GLOBALS['tmpl']->assign("help_item", $help_item);
$GLOBALS['tmpl']->assign("help_title", "服务条款");
$GLOBALS['tmpl']->display("investor_index.html");
}
示例6: load
/**
*
* @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;
}
示例7: intval
}
//echo $tmpl_dir; exit;
//print_r($request_param);exit;
$GLOBALS['tmpl']->assign('request', $request_param);
$GLOBALS['tmpl']->assign('is_ajax', intval($request_param['is_ajax']));
$GLOBALS['tmpl']->assign('data', $data);
$GLOBALS['tmpl']->assign('APP_ROOT', APP_ROOT);
$GLOBALS['tmpl']->assign("PC_URL", get_domain() . str_replace('/wap', "", APP_ROOT));
if (es_session::get('user_info')) {
$GLOBALS['tmpl']->assign('is_login', 1);
//用户已登陆
} else {
$GLOBALS['tmpl']->assign('is_login', 0);
//用户未登陆
}
if (es_cookie::get('is_app_down')) {
$GLOBALS['tmpl']->assign('is_app_down', 1);
//用户已登陆
} else {
$GLOBALS['tmpl']->assign('is_app_down', 0);
//用户未登陆
}
//==============================
//判断是否有缓存
//echo $tmpl_dir; exit;
//生成缓存的ID
//$cache_id = md5($class.$act2.trim($request_param['id']).$city_id);
//if (!$GLOBALS['tmpl']->is_cached($tmpl_dir, $cache_id)){}
$GLOBALS['tmpl']->display($tmpl_dir);
} else {
$request_param['from'] = 'wap';
示例8: index
public function index()
{
global $tmpl;
//获取当前页的团购商品列表
//分页
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
//分类
$cate_id = intval($_REQUEST['id']);
$sort_field = es_cookie::get("sort_field") ? es_cookie::get("sort_field") : "sort";
$sort_type = es_cookie::get("sort_type") ? es_cookie::get("sort_type") : "desc";
if ($sort_field != "end_time" && $sort_field != "current_price" && $sort_field != "buy_count" && $sort_field != "sort") {
$sort_field = "sort";
}
if ($sort_type != "desc" && $sort_type != "asc") {
$sort_type = "desc";
}
$act = trim($_REQUEST['act']);
//显示的类型
if ($act == 'history') {
$GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['ORDER_HISTORY_LIST']);
$GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['ORDER_HISTORY_LIST']);
$GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['ORDER_HISTORY_LIST']);
$type = array(DEAL_HISTORY);
} elseif ($act == 'notice') {
$GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['ORDER_NOTICE_LIST']);
$GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['ORDER_NOTICE_LIST']);
$GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['ORDER_NOTICE_LIST']);
$type = array(DEAL_NOTICE);
} else {
$GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['ORDER_LIST']);
$GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['ORDER_LIST']);
$GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['ORDER_LIST']);
$type = array(DEAL_ONLINE, DEAL_HISTORY);
}
if (app_conf("SHOW_DEAL_CATE") == 1) {
//输出分类
$deal_cates_db = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete = 0 and is_effect = 1 order by sort desc");
$deal_cates = array();
if ($act == 'history' || $act == 'notice') {
$url = url("tuan", "order#" . $act);
} else {
$url = url("tuan", "order");
}
$deal_cates[] = array('id' => 0, 'name' => $GLOBALS['lang']['ALL'], 'current' => $cate_id == 0 ? 1 : 0, 'url' => $url);
foreach ($deal_cates_db as $k => $v) {
if ($cate_id == $v['id']) {
$v['current'] = 1;
}
if ($act == 'history' || $act == 'notice') {
$v['url'] = url("tuan", "order#" . $act, array("id" => $v['id']));
} else {
$v['url'] = url("tuan", "order", array("id" => $v['id']));
}
$deal_cates[] = $v;
}
$GLOBALS['tmpl']->assign("deal_cate_list", $deal_cates);
}
//获取搜索字段
$no_deal_page = "no_deal.html";
$condition = ' buy_type=2 ';
if ($_REQUEST['search']) {
$search_code = unserialize(base64_decode($_REQUEST['search']));
if ($search_code['se_name'] != '') {
$condition .= " and name like '%" . $search_code['se_name'] . "%' ";
$no_deal_page = 'deals.html';
$GLOBALS['tmpl']->assign("se_name", $search_code['se_name']);
}
if ($search_code['se_begin'] != 0) {
$condition .= " and (begin_time > " . intval($search_code['se_begin']) . " or begin_time = 0) ";
$no_deal_page = 'deals.html';
$GLOBALS['tmpl']->assign("se_begin", to_date($search_code['se_begin'], 'Y-m-d'));
}
if ($search_code['se_end'] != 0) {
$condition .= " and (end_time < " . intval($search_code['se_end']) . " or end_time = 0) ";
$no_deal_page = 'deals.html';
$GLOBALS['tmpl']->assign("se_end", to_date($search_code['se_end'], 'Y-m-d'));
}
}
$deals = get_deal_list($limit, $cate_id, 0, $type, $condition, $sort_field . " " . $sort_type);
$GLOBALS['tmpl']->assign("deals", $deals['list']);
$page = new Page($deals['count'], app_conf("DEAL_PAGE_SIZE"));
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
require APP_ROOT_PATH . 'app/Lib/side.php';
//读取边栏信息,需放在deal数据的分配之后
$GLOBALS['tmpl']->assign('sort_field', $sort_field);
$GLOBALS['tmpl']->assign('sort_type', $sort_type);
if (es_cookie::get("list_type") === null) {
$list_type = app_conf("LIST_TYPE");
} else {
$list_type = intval(es_cookie::get("list_type"));
}
$GLOBALS['tmpl']->assign("list_type", $list_type);
if ($deals['list']) {
if ($list_type == 1) {
//.........这里部分代码省略.........
示例9: index
public function index()
{
$field = es_cookie::get("shop_sort_field");
$field_sort = es_cookie::get("shop_sort_type");
require APP_ROOT_PATH . 'app/Lib/page.php';
$level_list = load_auto_cache("level");
$GLOBALS['tmpl']->assign("level_list", $level_list['list']);
if (check_ipop_limit(get_client_ip(), "transfer_status", 10)) {
syn_transfer_status();
}
if (trim($_REQUEST['cid']) == "last") {
$cate_id = "-1";
$page_title = $GLOBALS['lang']['LAST_SUCCESS_DEALS'] . " - ";
} else {
$cate_id = intval($_REQUEST['cid']);
}
if ($cate_id == 0) {
$page_title = $GLOBALS['lang']['ALL_TRANSFER'] . " - ";
}
$keywords = trim(htmlspecialchars($_REQUEST['keywords']));
$GLOBALS['tmpl']->assign("keywords", $keywords);
$level = intval($_REQUEST['level']);
$GLOBALS['tmpl']->assign("level", $level);
$interest = intval($_REQUEST['interest']);
$GLOBALS['tmpl']->assign("interest", $interest);
$months = intval($_REQUEST['months']);
$GLOBALS['tmpl']->assign("months", $months);
$months_type = intval($_REQUEST['months_type']);
$GLOBALS['tmpl']->assign("months_type", $months_type);
$lefttime = intval($_REQUEST['lefttime']);
$GLOBALS['tmpl']->assign("lefttime", $lefttime);
$city = intval($_REQUEST['city']);
$GLOBALS['tmpl']->assign("city_id", $city);
$scity = intval($_REQUEST['scity']);
$GLOBALS['tmpl']->assign("scity_id", $scity);
//输出分类
$deal_cates_db = load_auto_cache("cache_deal_cate");
$deal_cates = array();
foreach ($deal_cates_db as $k => $v) {
if ($cate_id == $v['id']) {
$v['current'] = 1;
$page_title = $v['name'] . " - ";
}
$v['url'] = url("index", "transfer", array("cid" => $v['id']));
$deal_cates[] = $v;
}
unset($deal_cates_db);
//输出投标列表
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$page_args = array();
$sfield = "";
switch ($field) {
case "borrow_amount":
$sfield = "dlt.transfer_amount";
break;
case "rate":
$sfield = "d.rate";
break;
case "repay_time":
$sfield = "dlt.last_repay_time";
break;
case "remain_time":
$sfield = "dlt.near_repay_time";
break;
default:
$sfield = "";
}
$condition = " AND dlt.status=1 ";
if ($cate_id > 0) {
$condition .= "AND d.deal_status >=4 and cate_id=" . $cate_id;
if ($sfield && $field_sort) {
$orderby = "{$sfield} {$field_sort} ,d.deal_status desc , d.sort DESC,d.id DESC";
} else {
$orderby = "d.update_time DESC ,d.sort DESC,d.id DESC";
}
} elseif ($cate_id == 0) {
if ($sfield && $field_sort) {
$orderby = "{$sfield} {$field_sort}, dlt.create_time DESC , dlt.id DESC ";
} else {
$orderby = " d.create_time DESC , dlt.id DESC";
}
} elseif ($cate_id == "-1") {
$condition .= "AND d.deal_status >=4 AND dlt.t_user_id > 0 ";
$orderby = "dlt.transfer_time DESC,d.create_time DESC , dlt.id DESC";
}
if ($keywords) {
$kw_unicode = str_to_unicode_string($keywords);
$condition .= " and (match(d.name_match,d.deal_cate_match,d.tag_match,d.type_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
}
if ($level > 0) {
$point = $level_list['point'][$level];
$condition .= " AND d.user_id in(SELECT u.id FROM " . DB_PREFIX . "user u LEFT JOIN " . DB_PREFIX . "user_level ul ON ul.id=u.level_id WHERE ul.point >= {$point})";
}
if ($interest > 0) {
$condition .= " AND d.rate >= " . $interest;
}
if ($months > 0) {
//.........这里部分代码省略.........
示例10: insert_load_rec_goods
function insert_load_rec_goods($para)
{
$GLOBALS['tmpl']->assign("hide_filter", true);
$sort_field = es_cookie::get("shop_sort_field") ? es_cookie::get("shop_sort_field") : "sort";
$sort_type = es_cookie::get("shop_sort_type") ? es_cookie::get("shop_sort_type") : "desc";
if (es_cookie::get("list_type") === null) {
$list_type = app_conf("LIST_TYPE");
} else {
$list_type = intval(es_cookie::get("list_type"));
}
$GLOBALS['tmpl']->assign("list_type", $list_type);
//分页
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
if ($para['r'] == 'rhot') {
$GLOBALS['tmpl']->assign('sort_field', $sort_field);
$GLOBALS['tmpl']->assign('sort_type', $sort_type);
$result = search_goods_list($limit, 0, 'd.is_hot = 1 and buy_type <> 1', "d." . $sort_field . " " . $sort_type, false);
} elseif ($para['r'] == 'rbest') {
$GLOBALS['tmpl']->assign('sort_field', $sort_field);
$GLOBALS['tmpl']->assign('sort_type', $sort_type);
$result = search_goods_list($limit, 0, 'd.is_best = 1 and buy_type <> 1', "d." . $sort_field . " " . $sort_type, false);
} elseif ($para['r'] == 'rnew') {
$GLOBALS['tmpl']->assign('sort_field', $sort_field);
$GLOBALS['tmpl']->assign('sort_type', $sort_type);
$result = search_goods_list($limit, 0, 'd.is_new = 1 and buy_type <> 1', "d." . $sort_field . " " . $sort_type, false);
} elseif ($para['r'] == 'rsale') {
$sort_field = "buy_count";
$sort_type = es_cookie::get("shop_sort_type") ? es_cookie::get("shop_sort_type") : "desc";
$GLOBALS['tmpl']->assign('sort_field', $sort_field);
$GLOBALS['tmpl']->assign('sort_type', $sort_type);
$result = search_goods_list($limit, 0, ' buy_type <> 1 ', "d." . $sort_field . " " . $sort_type, false);
}
$GLOBALS['tmpl']->assign("list", $result['list']);
$page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE"));
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
return $GLOBALS['tmpl']->fetch("inc/insert/load_filter_goods_list.html");
}
示例11: user_login
function user_login()
{
//会员自动登录及输出
if ($GLOBALS['wx_info']) {
$userinfo = get_user_has("wx_openid", $GLOBALS['wx_info']['openid']);
// print_r($userinfo);
$cookie_uname = $userinfo['user_name'];
$cookie_upwd = $userinfo['user_pwd'];
//logUtils::log_str($cookie_uname);
//logUtils::log_str($cookie_upwd);
// echo $cookie_uname." ".$cookie_upwd;exit;
if ($cookie_uname != '' && $cookie_upwd != '') {
//logUtils::log_str("=======1=======");
$cookie_uname = addslashes(trim(htmlspecialchars($cookie_uname)));
$cookie_upwd = addslashes(trim(htmlspecialchars($cookie_upwd)));
require_once APP_ROOT_PATH . "system/model/user.php";
//require_once APP_ROOT_PATH."app/Lib/common.php";
auto_do_login_user($cookie_uname, $cookie_upwd, false);
//logUtils::log_str("========2=========");
}
} else {
$cookie_uname = es_cookie::get("user_name") ? es_cookie::get("user_name") : '';
$cookie_upwd = es_cookie::get("user_pwd") ? es_cookie::get("user_pwd") : '';
//logUtils::log_str($cookie_uname);
//logUtils::log_str($cookie_upwd);
if ($cookie_uname != '' && $cookie_upwd != '' && !es_session::get("user_info")) {
//logUtils::log_str("=======1=======");
$cookie_uname = addslashes(trim(htmlspecialchars($cookie_uname)));
$cookie_upwd = addslashes(trim(htmlspecialchars($cookie_upwd)));
require_once APP_ROOT_PATH . "system/model/user.php";
//require_once APP_ROOT_PATH."app/Lib/common.php";
auto_do_login_user($cookie_uname, $cookie_upwd);
//logUtils::log_str("========2=========");
}
}
}
示例12: app_conf
//商家系统使用商城系统的模板
$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("TMPL_REAL", APP_ROOT_PATH . "app/Tpl/" . app_conf("TEMPLATE"));
//定义当前语言包
$GLOBALS['tmpl']->assign("LANG", $lang);
//定义模板路径
$tmpl_path = get_domain() . APP_ROOT . "/app/Tpl/";
$GLOBALS['tmpl']->assign("TMPL", $tmpl_path . app_conf("TEMPLATE"));
//优惠券系统使用商城系统的模板
$GLOBALS['tmpl']->assign("APP_INDEX", APP_INDEX);
$account_name = htmlspecialchars(trim(addslashes(es_cookie::get("sp_account_name"))));
$account_password = htmlspecialchars(trim(addslashes(es_cookie::get("sp_account_password"))));
$account = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_account where account_name = '" . $account_name . "' and account_password = '" . $account_password . "' and is_effect = 1 and is_delete = 0");
if ($account) {
//$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);
}
$top10 = $GLOBALS['cache']->get("STORE_TOP10_IN_BIZ");
if ($top10 === false) {
$top10 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "supplier_location use index(search_idx6) where is_verify = 1 and is_effect = 1 order by good_rate desc limit 10");
$GLOBALS['cache']->set("STORE_TOP10_IN_BIZ", $top10, 3600);
示例13: index
public function index()
{
global $tmpl;
//多团风格
$deal_cate_id = intval($_REQUEST['id']);
$deal_quan_id = intval($_REQUEST['qid']);
$deal_type_id = intval($_REQUEST['tid']);
$uname = addslashes(trim($_REQUEST['id']));
$url_param = array('id' => addslashes(htmlspecialchars(trim($_REQUEST['id']))), 'tid' => intval($_REQUEST['tid']), 'qid' => intval($_REQUEST['qid']));
if ($deal_cate_id == 0 && $uname != '') {
$deal_cate_id = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal_cate where uname = '" . $uname . "'"));
}
$GLOBALS['tmpl']->assign("is_index", 1);
$seo_title = app_conf("TUAN_SHOP_TITLE");
$seo_keyword = app_conf("TUAN_SHOP_TITLE");
$seo_description = app_conf("TUAN_SHOP_TITLE");
$append_seo = "";
//当前城市的商圈
//判断当前商圈是否是大类
$area_result = load_auto_cache("cache_area", array("city_id" => $GLOBALS['deal_city']['id']));
$qpid = intval($area_result[$deal_quan_id]['pid']);
$bdeal_quan_id = $qpid == 0 ? $deal_quan_id : $qpid;
//大分类ID
$cache_param = array("id" => $deal_cate_id, "tid" => $deal_type_id, "qid" => $deal_quan_id, "city_id" => intval($GLOBALS['deal_city']['id']));
$filter_nav_data = load_auto_cache("tuan_filter_nav_cache", $cache_param);
$GLOBALS['tmpl']->assign('bquan_list', $filter_nav_data['bquan_list']);
if ($bdeal_quan_id > 0) {
//$append_seo.=$GLOBALS['db']->getOne("select name from ".DB_PREFIX."area where id = ".$bdeal_quan_id);
$append_seo .= $area_result[$deal_quan_id]['name'];
}
$GLOBALS['tmpl']->assign('squan_list', $filter_nav_data['squan_list']);
if ($bdeal_quan_id > 0 && $bdeal_quan_id != $deal_quan_id) {
//$append_seo.=$GLOBALS['db']->getOne("select name from ".DB_PREFIX."area where id = ".$deal_quan_id);
$append_seo .= $area_result[$deal_quan_id]['name'];
}
//开始输出分类
$GLOBALS['tmpl']->assign("bcate_list", $filter_nav_data['bcate_list']);
$cate_list = load_auto_cache("cache_deal_cate");
//输出小分类
$GLOBALS['tmpl']->assign("scate_list", $filter_nav_data['scate_list']);
if ($append_seo != "") {
$append_seo .= " - ";
}
//$append_seo .= $GLOBALS['db']->getOne("select name from ".DB_PREFIX."deal_cate where id = ".$deal_cate_id);
$append_seo .= $cate_list[$deal_cate_id]['name'];
$where = " buy_type<>1 ";
if ($deal_type_id > 0) {
$type_list = load_auto_cache("cache_deal_cate_type", array("cate_id" => $deal_cate_id));
//$deal_type_name = $GLOBALS['db']->getOne("select name from ".DB_PREFIX."deal_cate_type where id = ".$deal_type_id);
$deal_type_name = $type_list[$deal_type_id]['name'];
$deal_type_name_unicode = str_to_unicode_string($deal_type_name);
$where .= " and (match(deal_cate_match) against('" . $deal_type_name_unicode . "' IN BOOLEAN MODE)) ";
$append_seo .= $deal_type_name;
}
$sort_field = es_cookie::get("sort_field_idx") ? es_cookie::get("sort_field_idx") : "sort";
if ($sort_field != "begin_time" && $sort_field != "current_price" && $sort_field != "buy_count" && $sort_field != "sort") {
$sort_field = "sort";
}
$sort_type = es_cookie::get("sort_type_idx") ? es_cookie::get("sort_type_idx") : "desc";
if ($sort_type != "desc" && $sort_type != "asc") {
$sort_type = "desc";
}
$GLOBALS['tmpl']->assign('sort_field', $sort_field);
$GLOBALS['tmpl']->assign('sort_type', $sort_type);
if ($GLOBALS['city_name']) {
$GLOBALS['tmpl']->assign("page_title", app_conf("SHOP_TITLE") . " - " . $GLOBALS['deal_city']['name'] . $GLOBALS['lang']['SITE']);
} else {
$GLOBALS['tmpl']->assign("page_title", app_conf("SHOP_TITLE"));
}
$GLOBALS['tmpl']->assign("hide_end_title", true);
// require_once './app/Lib/side.php';
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
$result = get_deal_list($limit, $deal_cate_id, $city_id = 0, $type = array(DEAL_ONLINE, DEAL_NOTICE), $where, $sort_field . " " . $sort_type, $deal_quan_id);
$deal_list = $result['list'];
$page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE"));
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$seo_title = $append_seo . $seo_title;
$seo_keyword = $append_seo . $seo_keyword;
$seo_description = $append_seo . $seo_description;
$GLOBALS['tmpl']->assign("page_title", $seo_title);
$GLOBALS['tmpl']->assign("page_keyword", $seo_keyword);
$GLOBALS['tmpl']->assign("page_description", $seo_description);
if ($deal_list) {
$GLOBALS['tmpl']->assign("deal_list", $deal_list);
$tmpl->display("deal_multi.html");
} else {
$tmpl->display("no_deal.html");
}
}
示例14: index
public function index()
{
convert_req($_REQUEST);
$_REQUEST['cid'] = intval($_REQUEST['cid']);
$keyword = addslashes(htmlspecialchars(trim($_REQUEST['keyword'])));
$GLOBALS['tmpl']->assign("keyword", $keyword);
$url_param = array("cid" => addslashes(trim($_REQUEST['cid'])), "aid" => intval($_REQUEST['aid']), "qid" => intval($_REQUEST['qid']), "keyword" => $keyword);
if (intval($_REQUEST['is_redirect']) == 1) {
app_redirect(url("youhui", "event", $url_param));
}
$site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index"));
$site_nav[] = array('name' => $GLOBALS['lang']['YOUHUI_EVENT'], 'url' => url("youhui", "event#index"));
$GLOBALS['tmpl']->assign("site_nav", $site_nav);
//输出当前的site_nav
//输出热卖
$seo_title = $GLOBALS['lang']['YOUHUI_EVENT'];
$seo_keyword = $GLOBALS['lang']['YOUHUI_EVENT'];
$seo_description = $GLOBALS['lang']['YOUHUI_EVENT'];
//
$city_id = intval($GLOBALS['deal_city']['id']);
$quan_id = intval($_REQUEST['qid']);
//分页
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE");
if ($_REQUEST['plat'] == APP_PLAT) {
$num = empty($_POST['num']) ? 12 : $_POST['num'];
// page size
$prepage = empty($_POST['prepage']) ? 0 : $_POST['prepage'];
$start = $prepage * $num + 0;
$limit = $start . "," . $num;
}
$id = intval($_REQUEST['cid']);
$cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_cate where id = " . $id);
$condition = " 1=1 ";
//条件
$tp_url_param = $url_param;
unset($tp_url_param['keyword']);
$sub_nav[] = array("name" => $GLOBALS['lang']['YOUHUI_EVENT'], "url" => url("youhui", "event", $tp_url_param), "current" => 1);
$GLOBALS['tmpl']->assign("sub_nav", $sub_nav);
$GLOBALS['tmpl']->assign("url_param", $tp_url_param);
//将变量输出到模板
$append_seo = "";
//输出大区
$area_id = intval($_REQUEST['aid']);
if ($area_id > 0) {
$area_name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "area where id = " . $area_id);
$append_seo .= $area_name;
if ($quan_id > 0) {
$kw_unicode = str_to_unicode_string($area_name);
//有筛选
$condition .= " and (match(locate_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
} else {
$ids = load_auto_cache("deal_quan_ids", array("quan_id" => $area_id));
$quan_list = $GLOBALS['db']->getAll("select `name` from " . DB_PREFIX . "area where id in (" . implode(",", $ids) . ")");
$unicode_quans = array();
foreach ($quan_list as $k => $v) {
$unicode_quans[] = str_to_unicode_string($v['name']);
}
$kw_unicode = implode(" ", $unicode_quans);
$condition .= " and (match(locate_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))";
}
}
$area_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "area where city_id = " . $city_id . " and pid = 0 order by sort desc");
$area_list[] = array("name" => $GLOBALS['lang']['ALL'], "id" => 0);
foreach ($area_list as $k => $v) {
if ($area_id == $v['id']) {
$area_list[$k]['act'] = 1;
}
$tmp_url_param = $url_param;
unset($tmp_url_param['qid']);
$tmp_url_param['aid'] = $v['id'];
$area_list[$k]['url'] = url("youhui", "event", $tmp_url_param);
}
$GLOBALS['tmpl']->assign("area_list", $area_list);
if ($area_id > 0) {
//输出商圈
if ($quan_id > 0) {
$area_name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "area where id = " . $quan_id);
$kw_unicode = str_to_unicode_string($area_name);
//有筛选
$condition .= " and (match(locate_match) against('" . $kw_unicode . "' IN BOOLEAN MODE)) ";
$append_seo = $append_seo . $area_name;
}
$quan_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "area where city_id = " . $city_id . " and pid = " . $area_id . " order by sort desc");
$quan_list[] = array("name" => $GLOBALS['lang']['ALL'], "id" => 0);
foreach ($quan_list as $k => $v) {
if ($quan_id == $v['id']) {
$quan_list[$k]['act'] = 1;
}
$tmp_url_param = $url_param;
$tmp_url_param['qid'] = $v['id'];
$quan_list[$k]['url'] = url("youhui", "event", $tmp_url_param);
}
$GLOBALS['tmpl']->assign("quan_list", $quan_list);
}
//输出分类
$cate_id = $cate_item['id'];
//.........这里部分代码省略.........
示例15: global_run
/**
* 前端全运行函数,生成系统前台使用的全局变量
* 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);
}