public function loginout() { $ajax = intval($_REQUEST['ajax']); require_once APP_ROOT_PATH . "system/libs/user.php"; $result = loginout_user(); if ($result['status']) { es_cookie::delete("email"); es_cookie::delete("user_pwd"); es_cookie::delete("hide_user_notify"); if ($ajax == 1) { $return['status'] = 1; $return['info'] = "登出成功"; $return['data'] = $result['msg']; $return['jump'] = get_gopreview(); ajax_return($return); } else { $GLOBALS['tmpl']->assign('integrate_result', $result['msg']); if (trim(app_conf("INTEGRATE_CODE")) == '') { app_redirect_preview(); } else { showSuccess("登出成功", 0, get_gopreview()); } } } else { if ($ajax == 1) { $return['status'] = 1; $return['info'] = "登出成功"; $return['jump'] = get_gopreview(); ajax_return($return); } else { app_redirect(get_gopreview()); } } }
public function loginout() { es_cookie::delete("sp_account_name"); es_cookie::delete("sp_account_password"); es_session::delete("account_info"); app_redirect(url("biz", "index")); }
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")); }
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'); } }
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); } } }
/** * 获取正在进行的投标列表 */ 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); }
public function rm($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); es_cookie::delete($key); // $key = $this->build_key(__CLASS__,$param); // $GLOBALS['cache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/"); // $GLOBALS['cache']->rm($key); }
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"); }
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; }
static function delete($name) { es_cookie::set($name, '', 0); }
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) { if ($months == 12) { $condition .= " AND d.repay_time <= " . $months; } elseif ($months == 18) { $condition .= " AND d.repay_time >= " . $months; } } if ($months_type > 0) { if ($months_type == 1) { $condition .= " AND ((d.repay_time < 3 and d.repay_time_type = 1) or d.repay_time_type = 0) "; } else { if ($months_type == 2) { $condition .= " AND d.repay_time in (3,4,5) and d.repay_time_type = 1 "; } else { if ($months_type == 3) { $condition .= " AND d.repay_time in (6,7,8) and d.repay_time_type = 1 "; } else { if ($months_type == 4) { $condition .= " AND d.repay_time in (9,10,11) and d.repay_time_type = 1 "; } else { $condition .= " AND d.repay_time >= 12 and d.repay_time_type = 1 "; } } } } } if ($city > 0) { if ($scity > 0) { $dealid_list = $GLOBALS['db']->getAll("SELECT deal_id FROM " . DB_PREFIX . "deal_city_link where city_id = " . $scity); } else { $dealid_list = $GLOBALS['db']->getAll("SELECT deal_id FROM " . DB_PREFIX . "deal_city_link where city_id = " . $city); } $flatmap = array_map("array_pop", $dealid_list); $s2 = implode(',', $flatmap); $condition .= " AND id in (" . $s2 . ") "; } if ($lefttime > 0) { $condition .= " AND (d.next_repay_time + 24*3600 - 1 - " . TIME_UTC . ") <= " . $lefttime * 24 * 3600 . " AND dlt.t_user_id = 0 "; } if (es_cookie::get("shop_sort_field") == "ulevel") { $union_sql = ' LEFT join ' . DB_PREFIX . 'user u ON d.user_id = u.id '; $extfield = ",u.level_id "; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $result = get_transfer_list($limit, $condition, $extfield, $union_sql, $orderby); if ($result['rs_count'] > 0) { $page_args['cid'] = $cate_id; $page_args['keywords'] = $keywords; $page_args['level'] = $level; $page_args['interest'] = $interest; $page_args['months'] = $months; $page_args['lefttime'] = $lefttime; $page_args['months_type'] = $months_type; $page_args['city'] = $city; $page_pram = ""; foreach ($page_args as $k => $v) { $page_pram .= "&" . $k . "=" . $v; } $page = new Page($result['rs_count'], app_conf("DEAL_PAGE_SIZE"), $page_pram); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('transfer_list', $result['list']); } //分类 $cate_list_url = array(); $tmp_args = $page_args; $tmp_args['cid'] = 0; $cate_list_url[0]['url'] = url("index", "deals#index", $tmp_args); $cate_list_url[0]['name'] = "不限"; $cate_list_url[0]['id'] = 0; foreach ($deal_cates as $k => $v) { $cate_list_url[$k + 1] = $v; $tmp_args = $page_args; $tmp_args['cid'] = $v['id']; $cate_list_url[$k + 1]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('cate_list_url', $cate_list_url); //利率 $interest_url = array(array("interest" => 0, "name" => "不限"), array("interest" => 10, "name" => "10%"), array("interest" => 12, "name" => "12%"), array("interest" => 15, "name" => "15%"), array("interest" => 18, "name" => "18")); foreach ($interest_url as $k => $v) { $tmp_args = $page_args; $tmp_args['interest'] = $v['interest']; $interest_url[$k]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('interest_url', $interest_url); //几天内 $lefttime_url = array(array("lefttime" => 0, "name" => "不限"), array("lefttime" => 1, "name" => "1天"), array("lefttime" => 3, "name" => "3天"), array("lefttime" => 6, "name" => "6天"), array("lefttime" => 9, "name" => "9天"), array("lefttime" => 12, "name" => "12天")); foreach ($lefttime_url as $k => $v) { $tmp_args = $page_args; $tmp_args['lefttime'] = $v['lefttime']; $lefttime_url[$k]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('lefttime_url', $lefttime_url); //借款期限 $months_type_url = array(array("name" => "不限"), array("name" => "3 个月以下"), array("name" => "3-6 个月"), array("name" => "6-9 个月"), array("name" => "9-12 个月"), array("name" => "12 个月以上")); foreach ($months_type_url as $k => $v) { $tmp_args = $page_args; $tmp_args['months_type'] = $k; $months_type_url[$k]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('months_type_url', $months_type_url); //城市 $temp_city_urls = load_auto_cache("deal_city"); $city_urls[0]['id'] = 0; $city_urls[0]['name'] = "全部"; if (count($temp_city_urls) == 1) { $temp_city_urls = $temp_city_urls[key($temp_city_urls)]['child']; } $temp_city_urls = array_merge($city_urls, $temp_city_urls); $city_urls = array(); foreach ($temp_city_urls as $k => $v) { $city_urls[$v['id']] = $v; $tmp_args = $page_args; $tmp_args['city'] = $v['id']; $city_urls[$v['id']]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('city_urls', $city_urls); $sub_citys = $city_urls[$city]['child']; foreach ($sub_citys as $k => $v) { $tmp_args = $page_args; $tmp_args['city'] = $v['pid']; $tmp_args['scity'] = $v['id']; $sub_citys[$k]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('sub_citys', $sub_citys); //使用技巧 $use_tech_list = get_article_list(4, 6); $GLOBALS['tmpl']->assign("use_tech_list", $use_tech_list); //输出公告 $notice_list = get_notice(3); $GLOBALS['tmpl']->assign("notice_list", $notice_list); //会员等级 $level_list_url = array(); $tmp_args = $page_args; $tmp_args['level'] = 0; $level_list_url[0]['url'] = url("index", "deals#index", $tmp_args); $level_list_url[0]['name'] = "不限"; foreach ($level_list['list'] as $k => $v) { $tmp_args = $page_args; $tmp_args['level'] = $v['id']; $level_list_url[$k + 1] = $v; $level_list_url[$k + 1]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('level_list_url', $level_list_url); $GLOBALS['tmpl']->assign("page_title", $page_title . $GLOBALS['lang']['FINANCIAL_MANAGEMENT']); $GLOBALS['tmpl']->assign("cate_id", $cate_id); $GLOBALS['tmpl']->assign("cid", strim($_REQUEST['cid'])); $GLOBALS['tmpl']->assign("keywords", $keywords); $GLOBALS['tmpl']->assign("deal_cate_list", $deal_cates); $GLOBALS['tmpl']->assign("field", $field); $GLOBALS['tmpl']->assign("field_sort", $field_sort); $GLOBALS['tmpl']->display("page/transfers.html"); }
public function pick() { $url_param = array("id" => addslashes(trim($_REQUEST['id'])), "b" => intval($_REQUEST['b']), "min_price" => doubleval($_REQUEST['min_price']), "max_price" => doubleval($_REQUEST['max_price']), "keyword" => addslashes(trim($_REQUEST['keyword']))); $filter_req = $_REQUEST['f']; //筛选数组 if (count($filter_req) > 0) { foreach ($filter_req as $k => $v) { $url_param['f[' . $k . ']'] = $v; } } if (intval($_REQUEST['is_redirect']) == 1) { app_redirect(url("shop", "ss#pick", $url_param)); } //输出商城分类 $cate_tree = get_cate_tree(); $all_cate_tree = get_cate_tree(0, 1); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); $GLOBALS['tmpl']->assign("all_cate_tree", $all_cate_tree); convert_req($_REQUEST); //获取当前页的团购商品列表 //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $id = intval($_REQUEST['id']); if ($id == 0) { $uname = addslashes(trim($_REQUEST['id'])); } $cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "shop_cate where id = " . $id . " or (uname = '" . $uname . "' and uname <> '')"); $condition = " d.buy_type<>1 "; //条件 $ids = load_auto_cache("shop_sub_cate_ids", array("cate_id" => intval($cate_item['id']))); $add_title = ""; //输出品牌 $brand_id = intval($_REQUEST['b']); if ($brand_id > 0) { $condition .= " and d.brand_id = " . $brand_id; $add_title .= $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "brand where id = " . $brand_id); $GLOBALS['tmpl']->assign("brand_id", $brand_id); } $brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "brand order by sort desc"); $GLOBALS['tmpl']->assign("brand_list", $brand_list); //输出属性筛选 $filter_req = $_REQUEST['f']; $join_str = ""; $unicode_tags = array(); foreach ($filter_req as $k => $v) { $filter_req[$k] = trim(addslashes(urldecode($v))); if ($filter_req[$k] != '' && $filter_req[$k] != 'all') { if ($add_title != '') { $add_title .= " - "; } $add_title .= $filter_req[$k]; // //联表及条件 // $join_str.=" left join ".DB_PREFIX."deal_filter as df_".$k." on d.id=df_".$k.".deal_id and df_".$k.".filter_group_id = ".$k; // $condition.=" and df_".$k.".filter like '%".$filter_req[$k]."%' "; $unicode_tags[] = "+" . str_to_unicode_string($filter_req[$k]); } } if (count($unicode_tags) > 0) { $kw_unicode = implode(" ", $unicode_tags); //有筛选 $condition .= " and (match(d.tag_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))"; } if (intval($_REQUEST['id']) != 0) { $filter_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "filter_group where is_effect = 1 and cate_id in (" . implode(",", $ids) . ") order by sort desc"); foreach ($filter_group as $k => $v) { $filter_group[$k]['value'] = $filter_req[$v['id']]; } $GLOBALS['tmpl']->assign("filter_group", $filter_group); } //输出价格区间 $min_price = doubleval($_REQUEST['min_price']); $max_price = doubleval($_REQUEST['max_price']); $GLOBALS['tmpl']->assign("min_price", $min_price); $GLOBALS['tmpl']->assign("max_price", $max_price); if ($min_price > 0) { $condition .= " and d.current_price >= " . $min_price; } if ($max_price > 0) { $condition .= " and d.current_price <= " . $max_price; } $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"; $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); $kw = addslashes(htmlspecialchars(trim($_REQUEST['keyword']))); if ($kw != '') { $GLOBALS['tmpl']->assign('keyword', $kw); if ($add_title != '') { $add_title .= "-"; } $add_title .= $kw; $kws_div = div_str($kw); foreach ($kws_div as $k => $item) { $kws[$k] = str_to_unicode_string($item); } $ukeyword = implode(" ", $kws); $condition .= " and (match(d.tag_match,d.name_match,d.locate_match,d.shop_cate_match) against('" . $ukeyword . "' IN BOOLEAN MODE))"; //$condition.=" and (d.name like '%".$kw."%' or d.sub_name like '%".$kw."%' or d.brief like '%".$kw."%' or d.description like '%".$kw."%')"; } if ($add_title != '') { $add_title .= "-"; } $add_title .= $GLOBALS['lang']['GOODS_SEARCH']; $result = search_goods_list($limit, intval($cate_item['id']), $condition, "d." . $sort_field . " " . $sort_type, false, $join_str); $GLOBALS['tmpl']->assign("list", $result['list']); $page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("cate_id", $cate_item['id']); $GLOBALS['tmpl']->assign("page_title", $add_title . $cate_item['name']); $GLOBALS['tmpl']->assign("page_keyword", $add_title . $cate_item['name'] . ","); $GLOBALS['tmpl']->assign("page_description", $add_title . $cate_item['name'] . ","); $GLOBALS['tmpl']->assign("filter", true); //显示筛选框 $GLOBALS['tmpl']->assign("show_list", true); $GLOBALS['tmpl']->display("ss_index.html"); }
function synlogout($get, $post) { if (!API_SYNLOGOUT) { return API_RETURN_FORBIDDEN; } es_cookie::delete("user_name"); es_cookie::delete("user_pwd"); es_session::delete("user_info"); }
public function index() { $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 60; //首页缓存10分钟 $field = es_cookie::get("shop_sort_field"); $field_sort = es_cookie::get("shop_sort_type"); $cache_id = md5(MODULE_NAME . ACTION_NAME . implode(",", $_REQUEST) . $field . $field_sort); if (!$GLOBALS['tmpl']->is_cached("page/deals.html", $cache_id)) { require APP_ROOT_PATH . 'app/Lib/page.php'; $level_list = load_auto_cache("level"); $GLOBALS['tmpl']->assign("level_list", $level_list['list']); 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_DEALS'] . " - "; } $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); $lefttime = intval($_REQUEST['lefttime']); $GLOBALS['tmpl']->assign("lefttime", $lefttime); $months_type = intval($_REQUEST['months_type']); $GLOBALS['tmpl']->assign("months_type", $months_type); $deal_status = intval($_REQUEST['deal_status']); $GLOBALS['tmpl']->assign("deal_status", $deal_status); $cates = intval($_REQUEST['cates']); $GLOBALS['tmpl']->assign("cates", $cates); $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", "deals", array("cid" => $v['id'])); $deal_cates[] = $v; } unset($deal_cates_db); //输出投标列表 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $n_cate_id = 0; $condition = " publish_wait = 0 and is_hidden = 0 "; $orderby = ""; if ($cate_id > 0) { $n_cate_id = $cate_id; if ($field && $field_sort) { $orderby = "{$field} {$field_sort} ,deal_status desc , sort DESC,id DESC"; } else { $orderby = "sort DESC,id DESC"; } $total_money = $GLOBALS['db']->getOne("SELECT sum(borrow_amount) FROM " . DB_PREFIX . "deal WHERE cate_id={$cate_id} AND deal_status in(4,5) AND is_effect = 1 and is_delete = 0 "); } elseif ($cate_id == 0) { $n_cate_id = 0; if ($field && $field_sort) { $orderby = "{$field} {$field_sort} ,sort DESC,id DESC"; } else { $orderby = "sort DESC , id DESC"; } $total_money = $GLOBALS['db']->getOne("SELECT sum(borrow_amount) FROM " . DB_PREFIX . "deal WHERE deal_status in(4,5) AND is_effect = 1 and is_delete = 0"); } elseif ($cate_id == "-1") { $n_cate_id = 0; $condition .= "AND deal_status in(2,4,5) "; $orderby = "deal_status ASC,success_time DESC,sort DESC,id DESC"; } if ($keywords) { $kw_unicode = str_to_unicode_string($keywords); $condition .= " and (match(name_match,deal_cate_match,tag_match,type_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))"; } if ($level > 0) { $point = $level_list['point'][$level]; $condition .= " AND 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 rate >= " . $interest; } if ($months > 0) { if ($months == 12) { $condition .= " AND repay_time <= " . $months; } elseif ($months == 18) { $condition .= " AND repay_time >= " . $months; } } if ($lefttime > 0) { $condition .= " AND (start_time + enddate*24*3600 - " . TIME_UTC . ") <= " . $lefttime * 24 * 3600; } if ($deal_status == 19) { $condition .= " AND deal_status = 1 AND start_time > " . TIME_UTC . " "; } elseif ($deal_status > 0) { $condition .= " AND deal_status = " . $deal_status . " AND start_time <= " . TIME_UTC . " "; } if ($months_type > 0) { if ($months_type == 1) { $condition .= " AND ((repay_time < 3 and repay_time_type = 1) or repay_time_type = 0) "; } else { if ($months_type == 2) { $condition .= " AND repay_time in (3,4,5) and repay_time_type = 1 "; } else { if ($months_type == 3) { $condition .= " AND repay_time in (6,7,8) and repay_time_type = 1 "; } else { if ($months_type == 4) { $condition .= " AND repay_time in (9,10,11) and repay_time_type = 1 "; } else { $condition .= " AND repay_time >= 12 and repay_time_type = 1 "; } } } } } if ($city > 0) { if ($scity > 0) { $dealid_list = $GLOBALS['db']->getAll("SELECT deal_id FROM " . DB_PREFIX . "deal_city_link where city_id = " . $scity); } else { $dealid_list = $GLOBALS['db']->getAll("SELECT deal_id FROM " . DB_PREFIX . "deal_city_link where city_id = " . $city); } $flatmap = array_map("array_pop", $dealid_list); $s2 = implode(',', $flatmap); $condition .= " AND id in (" . $s2 . ") "; } //使用技巧 $use_tech_list = get_article_list(4, 6); $GLOBALS['tmpl']->assign("use_tech_list", $use_tech_list); $result = get_deal_list($limit, $n_cate_id, $condition, $orderby); $GLOBALS['tmpl']->assign("deal_list", $result['list']); $GLOBALS['tmpl']->assign("total_money", $total_money); //输出公告 $notice_list = get_notice(3); $GLOBALS['tmpl']->assign("notice_list", $notice_list); $page_args['cid'] = $cate_id; $page_args['keywords'] = $keywords; $page_args['level'] = $level; $page_args['interest'] = $interest; $page_args['months'] = $months; $page_args['lefttime'] = $lefttime; $page_args['months_type'] = $months_type; $page_args['deal_status'] = $deal_status; $page_args['city'] = $city; //分类 $cate_list_url = array(); $tmp_args = $page_args; $tmp_args['cid'] = 0; $cate_list_url[0]['url'] = url("index", "deals#index", $tmp_args); $cate_list_url[0]['name'] = "不限"; $cate_list_url[0]['id'] = 0; foreach ($deal_cates as $k => $v) { $cate_list_url[$k + 1] = $v; $tmp_args = $page_args; $tmp_args['cid'] = $v['id']; $cate_list_url[$k + 1]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('cate_list_url', $cate_list_url); //利率 $interest_url = array(array("interest" => 0, "name" => "不限"), array("interest" => 10, "name" => "10%"), array("interest" => 12, "name" => "12%"), array("interest" => 15, "name" => "15%"), array("interest" => 18, "name" => "18")); foreach ($interest_url as $k => $v) { $tmp_args = $page_args; $tmp_args['interest'] = $v['interest']; $interest_url[$k]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('interest_url', $interest_url); //几天内 $lefttime_url = array(array("lefttime" => 0, "name" => "不限"), array("lefttime" => 1, "name" => "1天"), array("lefttime" => 3, "name" => "3天"), array("lefttime" => 6, "name" => "6天"), array("lefttime" => 9, "name" => "9天"), array("lefttime" => 12, "name" => "12天")); foreach ($lefttime_url as $k => $v) { $tmp_args = $page_args; $tmp_args['lefttime'] = $v['lefttime']; $lefttime_url[$k]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('lefttime_url', $lefttime_url); //借款期限 $months_type_url = array(array("name" => "不限"), array("name" => "3 个月以下"), array("name" => "3-6 个月"), array("name" => "6-9 个月"), array("name" => "9-12 个月"), array("name" => "12 个月以上")); foreach ($months_type_url as $k => $v) { $tmp_args = $page_args; $tmp_args['months_type'] = $k; $months_type_url[$k]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('months_type_url', $months_type_url); //标状态 $deal_status_url = array(array("key" => 0, "name" => "不限"), array("key" => 19, "name" => "未开始"), array("key" => 1, "name" => "进行中"), array("key" => 2, "name" => "满标"), array("key" => 3, "name" => "流标"), array("key" => 4, "name" => "还款中"), array("key" => 5, "name" => "已还清")); foreach ($deal_status_url as $k => $v) { $tmp_args = $page_args; $tmp_args['deal_status'] = $v['key']; $deal_status_url[$k]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('deal_status_url', $deal_status_url); //会员等级 $level_list_url = array(); $tmp_args = $page_args; $tmp_args['level'] = 0; $level_list_url[0]['url'] = url("index", "deals#index", $tmp_args); $level_list_url[0]['name'] = "不限"; foreach ($level_list['list'] as $k => $v) { $tmp_args = $page_args; $tmp_args['level'] = $v['id']; $level_list_url[$k + 1] = $v; $level_list_url[$k + 1]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('level_list_url', $level_list_url); //城市 $temp_city_urls = load_auto_cache("deal_city"); $city_urls[0]['id'] = 0; $city_urls[0]['name'] = "全部"; if (count($temp_city_urls) == 1) { $temp_city_urls = $temp_city_urls[key($temp_city_urls)]['child']; } $temp_city_urls = array_merge($city_urls, $temp_city_urls); $city_urls = array(); foreach ($temp_city_urls as $k => $v) { $city_urls[$v['id']] = $v; $tmp_args = $page_args; $tmp_args['city'] = $v['id']; $city_urls[$v['id']]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('city_urls', $city_urls); $sub_citys = $city_urls[$city]['child']; foreach ($sub_citys as $k => $v) { $tmp_args = $page_args; $tmp_args['city'] = $v['pid']; $tmp_args['scity'] = $v['id']; $sub_citys[$k]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('sub_citys', $sub_citys); $page_pram = ""; foreach ($page_args as $k => $v) { $page_pram .= "&" . $k . "=" . $v; } $page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE"), $page_pram); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("page_title", $page_title . $GLOBALS['lang']['FINANCIAL_MANAGEMENT']); $GLOBALS['tmpl']->assign("cate_id", $cate_id); $GLOBALS['tmpl']->assign("cid", strim($_REQUEST['cid'])); $GLOBALS['tmpl']->assign("keywords", $keywords); $GLOBALS['tmpl']->assign("deal_cate_list", $deal_cates); $GLOBALS['tmpl']->assign("page_args", $page_args); $GLOBALS['tmpl']->assign("field", $field); $GLOBALS['tmpl']->assign("field_sort", $field_sort); } $GLOBALS['tmpl']->display("page/deals.html", $cache_id); }
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) {
<?php // +---------------------------------------------------------------------- // | Fanwe 方维p2p借贷系统 // +---------------------------------------------------------------------- // | Copyright (c) 2011 http://www.fanwe.com All rights reserved. // +---------------------------------------------------------------------- // | Author: 云淡风轻(88522820@qq.com) // +---------------------------------------------------------------------- if (!defined('ROOT_PATH')) { define('ROOT_PATH', str_replace('debit.php', '', str_replace('\\', '/', __FILE__))); } require ROOT_PATH . 'system/common.php'; if ($_REQUEST['is_pc'] == 1) { es_cookie::set("is_pc", "1", 24 * 3600 * 30); } if (intval($GLOBALS['pay_req']['is_sj']) == 1) { $_REQUEST['is_sj'] = 1; } //echo es_cookie::get("is_pc"); if (isMobile() && !isset($_REQUEST['is_pc']) && es_cookie::get("is_pc") != 1 && intval($_REQUEST['is_sj']) == 0 && trim($_REQUEST['ctl']) != 'collocation' && trim($_REQUEST['ctl']) != 'mobile' && file_exists(APP_ROOT_PATH . "wap/index.php")) { app_redirect("./wap/index.php"); } else { require ROOT_PATH . 'app/Lib/SiteApp.class.php'; $_REQUEST[CTL] = strtolower($_REQUEST[CTL] ? $_REQUEST[CTL] : "debit"); $_REQUEST[ACT] = strtolower($_REQUEST[ACT] ? $_REQUEST[ACT] : "index"); //$action = "index"; //实例化一个网站应用实例 $AppWeb = new SiteApp(); }
<?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); } }
public function logout() { require_once APP_ROOT_PATH . "system/libs/biz_user.php"; loginout_biz(); es_cookie::delete("account_name"); es_cookie::delete("account_pwd"); es_session::delete("biz_nav_list"); es_session::delete("biz_account_auth"); $jump = url("biz", "user#login"); app_redirect($jump); }
public function index() { $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 60; //首页缓存10分钟 $field = es_cookie::get("shop_sort_field"); $field_sort = es_cookie::get("shop_sort_type"); $cache_id = md5(MODULE_NAME . ACTION_NAME . implode(",", $_REQUEST) . $field . $field_sort); if (!$GLOBALS['tmpl']->is_cached("page/score.html", $cache_id)) { require APP_ROOT_PATH . 'app/Lib/page.php'; $cates = intval($_REQUEST['cates']); $GLOBALS['tmpl']->assign("cates", $cates); $integral = intval($_REQUEST['integral']); $GLOBALS['tmpl']->assign("integral", $integral); $sort = intval($_REQUEST['sort']); //1.最新 2.热门 3.积分 $GLOBALS['tmpl']->assign("sort", $sort); //输出投标列表 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $condition = " 1=1"; if ($sort == 1) { $condition .= " AND is_new = 1"; } elseif ($sort == 2) { $condition .= " AND is_hot = 1 "; } elseif ($sort == 3) { $orderby = " score desc"; } if ($cates > 0) { $cates_id = $GLOBALS['db']->getAll("select id from " . DB_PREFIX . "goods_cate where pid = " . $cates); $flatmap = array_map("array_pop", $cates_id); $cates_ids = implode(',', $flatmap); if ($cates_ids == "") { $condition .= " AND cate_id in (" . $cates . ") "; } else { $condition .= " AND cate_id in (" . $cates . "," . $cates_ids . ") "; } } if ($integral == 0) { $condition .= ""; } elseif ($integral == 1) { $condition .= " AND score <= 500"; } elseif ($integral == 2) { $condition .= " AND score between 500 and 1000"; } elseif ($integral == 3) { $condition .= " AND score between 1000 and 3000"; } elseif ($integral == 4) { $condition .= " AND score between 3000 and 5000"; } else { $condition .= " AND score >= 5000"; } $result = get_goods_list($limit, $condition, $orderby); $GLOBALS['tmpl']->assign("goods_list", $result['list']); $page_args['cates'] = $cates; $page_args['integral'] = $integral; $page_args['sort'] = $sort; //商品类别 $cates_urls = load_auto_cache("score_cates"); //$cates_urls = $GLOBALS['db']->getAll("SELECT id,name FROM ".DB_PREFIX."goods_cate WHERE is_effect=1 and is_delete = 0 and pid= 0"); $cates_url = array(); $cates_url[0]['id'] = 0; $cates_url[0]['name'] = "不限"; $tmp_args = $page_args; $tmp_args['cates'] = 0; $cates_url[0]['url'] = url("index", "score#index", $tmp_args); foreach ($cates_urls as $k => $v) { $cates_url[$k + 1]['id'] = $v['id']; $cates_url[$k + 1]['name'] = $v['name']; $tmp_args = $page_args; $tmp_args['cates'] = $v['id']; $cates_url[$k + 1]['url'] = url("index", "score#index", $tmp_args); } $GLOBALS['tmpl']->assign('cates_url', $cates_url); //积分范围 $integral_url = array(array("name" => "不限"), array("name" => "500积分以下"), array("name" => "500-1000积分"), array("name" => "1000-3000积分"), array("name" => "3000-5000积分"), array("name" => "5000积分以上")); foreach ($integral_url as $k => $v) { $tmp_args = $page_args; $tmp_args['integral'] = $k; $integral_url[$k]['url'] = url("index", "score#index", $tmp_args); } $GLOBALS['tmpl']->assign('integral_url', $integral_url); //排序 $sort_url = array(array("name" => "默认排序"), array("name" => "最新"), array("name" => "热门"), array("name" => "积分")); foreach ($sort_url as $k => $v) { $tmp_args = $page_args; $tmp_args['sort'] = $k; $sort_url[$k]['url'] = url("index", "score#index", $tmp_args); } $GLOBALS['tmpl']->assign('sort_url', $sort_url); $page_pram = ""; foreach ($page_args as $k => $v) { $page_pram .= "&" . $k . "=" . $v; } $page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE"), $page_pram); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("page_args", $page_args); $GLOBALS['tmpl']->assign("field", $field); //?? $GLOBALS['tmpl']->assign("field_sort", $field_sort); //?? } $GLOBALS['tmpl']->display("page/score.html", $cache_id); }
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========="); } } }
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); //定义模板路径 $tmpl_path = SITE_DOMAIN . APP_ROOT . "/app/Tpl/"; $GLOBALS['tmpl']->assign("TMPL", $tmpl_path . app_conf("TEMPLATE"));
<?php // +---------------------------------------------------------------------- // | Fanwe 方维众筹商业系统 // +---------------------------------------------------------------------- // | Copyright (c) 2011 http://www.fanwe.com All rights reserved. // +---------------------------------------------------------------------- // | Author: 甘味人生(526130@qq.com) // +---------------------------------------------------------------------- require './system/system_init.php'; require './app/Lib/App.class.php'; if ($_REQUEST['is_pc'] == 1) { es_cookie::set("is_pc", "1", 24 * 3600 * 30); } if (isMobile() && !isset($_REQUEST['is_pc']) && es_cookie::get("is_pc") != 1 && is_dir(APP_ROOT_PATH . "wap") & $_REQUEST['ctl'] != 'collocation' && $_REQUEST['ctl'] != 'collocation') { $ctl = $_REQUEST['ctl'] ? $_REQUEST['ctl'] : 'index'; $act = $_REQUEST['act'] ? $_REQUEST['act'] : 'index'; $id = $_REQUEST['id']; if ($id) { app_redirect(url_wap($ctl . "#" . $act, array('id' => $id))); } else { app_redirect(url_wap($ctl . "#" . $act)); } } else { set_source_url(); //实例化一个网站应用实例 $AppWeb = new App(); } //实例化一个网站应用实例
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" => $_REQUEST['cid'], "aid" => intval($_REQUEST['aid']), "tid" => intval($_REQUEST['tid']), "qid" => intval($_REQUEST['qid']), "min_price" => doubleval($_REQUEST['min_price']), "max_price" => doubleval($_REQUEST['max_price']), "keyword" => $keyword); if (intval($_REQUEST['is_redirect']) == 1) { app_redirect(url("youhui", "ycate", $url_param)); } $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index")); $site_nav[] = array('name' => $GLOBALS['lang']['NEED_BUY_YOUHUI'], 'url' => url("youhui", "ycate#index")); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav //输出热卖 $res = search_youhui_list(app_conf("SIDE_DEAL_COUNT"), 0, "", "d.buy_count desc", true, ""); $GLOBALS['tmpl']->assign("hot_sale_list", $res['list']); $seo_title = $GLOBALS['lang']['NEED_BUY_YOUHUI']; $seo_keyword = $GLOBALS['lang']['NEED_BUY_YOUHUI']; $seo_description = $GLOBALS['lang']['NEED_BUY_YOUHUI']; // $city_id = intval($GLOBALS['deal_city']['id']); //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $id = intval($_REQUEST['cid']); if ($id == 0) { $uname = addslashes(trim($_REQUEST['id'])); } $cate_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_cate where id = " . $id . " or (uname = '" . $uname . "' and uname <> '')"); $condition = " d.is_shop = 2 "; //条件 $tp_url_param = $url_param; unset($tp_url_param['min_price']); unset($tp_url_param['max_price']); unset($tp_url_param['keyword']); $sub_nav[] = array("name" => $GLOBALS['lang']['FREE_YOUHUI'], "url" => url("youhui", "fcate", $tp_url_param), "current" => 0); $sub_nav[] = array("name" => $GLOBALS['lang']['NEED_BUY_YOUHUI'], "url" => url("youhui", "ycate", $tp_url_param), "current" => 1); $sub_nav[] = array("name" => $GLOBALS['lang']['TUAN'], "url" => url("youhui", "tuan", $tp_url_param), "current" => 0); $GLOBALS['tmpl']->assign("sub_nav", $sub_nav); $GLOBALS['tmpl']->assign("url_param", $tp_url_param); //将变量输出到模板 $ids = load_auto_cache("deal_sub_cate_ids", array("cate_id" => intval($cate_item['id']))); $cache_param = array("city_id" => $city_id, "cid" => $cate_item['id'], "tid" => $url_param['tid'], "aid" => $url_param['aid'], "qid" => $url_param['qid']); $result = load_auto_cache("byouhui_filter_nav_cache", $cache_param); //输出大区 $append_seo = ""; $area_id = intval($_REQUEST['aid']); $quan_id = intval($_REQUEST['qid']); 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(d.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))"; } } $GLOBALS['tmpl']->assign("area_list", $result['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(d.locate_match) against('" . $kw_unicode . "' IN BOOLEAN MODE)) "; $append_seo = $append_seo . $area_name; } $GLOBALS['tmpl']->assign("quan_list", $result['quan_list']); } //输出分类 $cate_id = $cate_item['id']; $GLOBALS['tmpl']->assign("cate_list", $result['cate_list']); //输出小分类 $deal_type_id = intval($_REQUEST['tid']); $deal_cate_id = $cate_item['id']; $deal_quan_id = $area_id; if ($deal_cate_id > 0) { $GLOBALS['tmpl']->assign("scate_list", $result['scate_list']); if ($append_seo != "") { $append_seo .= " - "; } $append_seo .= $cate_item['name']; } //输出价格区间 $min_price = doubleval($_REQUEST['min_price']); $max_price = doubleval($_REQUEST['max_price']); $GLOBALS['tmpl']->assign("min_price", $min_price); $GLOBALS['tmpl']->assign("max_price", $max_price); if ($min_price > 0) { $condition .= " and d.current_price >= " . $min_price; } if ($max_price > 0) { $condition .= " and d.current_price <= " . $max_price; } $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 ($sort_field != "update_time" && $sort_field != "current_price" && $sort_field != "buy_count" && $sort_field != "avg_point" && $sort_field != "sort") { $sort_field = "sort"; } 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 ($deal_type_id > 0) { $deal_type_name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate_type where id = " . $deal_type_id); $deal_type_name_unicode = str_to_unicode_string($deal_type_name); $condition .= " and (match(d.deal_cate_match) against('" . $deal_type_name_unicode . "' IN BOOLEAN MODE)) "; $append_seo .= $deal_type_name; } $seo_title = $append_seo . $seo_title; $seo_keyword = $append_seo . $seo_keyword; $seo_description = $append_seo . $seo_keyword; if ($keyword) { $kws_div = div_str($keyword); foreach ($kws_div as $k => $item) { $kw[$k] = str_to_unicode_string($item); } $ukeyword = implode(" ", $kw); $condition .= " and (match(d.name_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or d.name like '%" . $keyword . "%') "; $seo_title = $keyword . " - " . $seo_title; } $result = search_youhui_list($limit, intval($cate_item['id']), $condition, "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); $GLOBALS['tmpl']->assign("cate_id", $cate_item['id']); // $GLOBALS['tmpl']->assign("page_title", $seo_title); $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword); $GLOBALS['tmpl']->assign("page_description", $seo_description); $GLOBALS['tmpl']->display("youhui_ycate.html"); }
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"); }
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) { $GLOBALS['tmpl']->display("deals_grid.html"); } else { $GLOBALS['tmpl']->display("deals.html"); } } else { $GLOBALS['tmpl']->display($no_deal_page); } }
public function loginout() { require_once APP_ROOT_PATH . "system/libs/user.php"; $result = loginout_user(); if ($result['status']) { $s_user_info = es_session::get("user_info"); es_cookie::delete("user_name"); es_cookie::delete("user_pwd"); $GLOBALS['tmpl']->assign('integrate_result', $result['msg']); $before_loginout = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : url("index"); if (trim(app_conf("INTEGRATE_CODE")) == '') { app_redirect($before_loginout); } else { showSuccess($GLOBALS['lang']['LOGINOUT_SUCCESS'], 0, $before_loginout); } } else { app_redirect(url("index")); } }
public function close_notify() { es_cookie::set("hide_user_notify", 1); }
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'); } }
//输出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")); //删除超过三天的订单 //$GLOBALS['db']->query("delete from ".DB_PREFIX."deal_order where order_status = 0 and credit_pay = 0 and ".NOW_TIME." - create_time > ".(24*3600*3)); $has_deal_notify = intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_notify")); define("HAS_DEAL_NOTIFY", $has_deal_notify); //存在待发的项目通知 if ($user_info) { $user_notify_count = intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_notify where user_id = " . intval($user_info['id']) . " and is_read = 0")); $user_message_count = intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_message where user_id = " . intval($user_info['id']) . " and is_read = 0")); $GLOBALS['tmpl']->assign("USER_NOTIFY_COUNT", $user_notify_count); $GLOBALS['tmpl']->assign("USER_MESSAGE_COUNT", $user_message_count); $GLOBALS['tmpl']->assign("HIDE_USER_NOTIFY", intval(es_cookie::get("hide_user_notify"))); } } $g_links = get_link_by_id(); $GLOBALS['tmpl']->assign("g_links", $g_links); //页脚的文章分类信息 star $help_cates = load_auto_cache("new_hepls"); $GLOBALS['tmpl']->assign("help_cates", $help_cates); //页脚的文章分类信息 end //get_mortgate(); $GLOBALS['tmpl']->assign("now", NOW_TIME); $is_tg = intval(is_tg()); $is_user_tg = is_user_tg(); $is_user_investor = is_user_investor(); if ($is_tg) { $GLOBALS['tmpl']->assign("tg_register_url", APP_ROOT . "/index.php?ctl=collocation&act=CreateNewAcct&user_type=0&user_id=" . $GLOBALS['user_info']['id']);
/** * 获取当前团购城市 */ function get_current_deal_city() { if (es_cookie::is_set("deal_city")) { $deal_city_id = es_cookie::get("deal_city"); $deal_city = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_city where is_effect = 1 and is_delete = 0 and id = " . intval($deal_city_id)); } if (!$deal_city) { //设置如存在的IP订位 if (file_exists(APP_ROOT_PATH . "system/extend/ip.php")) { require_once APP_ROOT_PATH . "system/extend/ip.php"; $ip = get_client_ip(); $iplocation = new iplocate(); $address = $iplocation->getaddress($ip); foreach ($city_list as $city) { if (strpos($address['area1'], $city['name'])) { $deal_city = $city; break; } } } if (!$deal_city) { $deal_city = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_city where is_default = 1 and is_effect = 1 and is_delete = 0"); } } return $deal_city; }