/** * ECSHOP 首页文件 * ============================================================================ * * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。 * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liubo $ * $Id: index.php 17217 2011-01-19 06:29:08Z liubo $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); if ((DEBUG_MODE & 2) != 2) { $smarty->caching = true; } /* 检测访问终端类型 $ua = strtolower($_SERVER['HTTP_USER_AGENT']); $uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile)/i"; if(($ua == '' || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER['REQUEST_URI']),'wap')) { $Loaction = 'mobile/'; if (!empty($Loaction)) { ecs_header("Location: $Loaction\n"); exit; } } */ /*------------------------------------------------------ */ //-- Shopex系统地址转换 /*------------------------------------------------------ */ $smarty->assign('id', $_SESSION[user_id]); $sql = "select mobile_phone from " . $ecs->table('users') ."WHERE user_id = '".$_SESSION[user_id]."'"; $phone = $db->getRow($sql); $smarty->assign('user_name', $_SESSION['user_name']); $smarty->assign('phone', $phone['mobile_phone']); if ($_REQUEST['pc']) { $_SESSION['pc']=1; } $smarty->assign('pc',$_SESSION['pc']); if (!empty($_GET['gOo'])) { if (!empty($_GET['gcat'])) { /* 商品分类。*/ $Loaction = 'category.php?id=' . $_GET['gcat']; } elseif (!empty($_GET['acat'])) { /* 文章分类。*/ $Loaction = 'article_cat.php?id=' . $_GET['acat']; } elseif (!empty($_GET['goodsid'])) { /* 商品详情。*/ $Loaction = 'goods.php?id=' . $_GET['goodsid']; } elseif (!empty($_GET['articleid'])) { /* 文章详情。*/ $Loaction = 'article.php?id=' . $_GET['articleid']; } if (!empty($Loaction)) { ecs_header("Location: $Loaction\n"); exit; } } //判断是否有ajax请求 $act = !empty($_GET['act']) ? $_GET['act'] : ''; if ($act == 'cat_rec' && $_REQUEST['rec_type'] != "hotels1" && $_REQUEST['rec_type'] != "hotels2" && $_REQUEST['rec_type'] != "hotels3" && $_REQUEST['rec_type'] != "hotels4" && $_REQUEST['rec_type'] != "hotels5" && $_REQUEST['rec_type'] != "hotels6") { $rec_array = array(1 => 'best', 2 => 'new', 3 => 'hot'); $rec_type = !empty($_REQUEST['rec_type']) ? intval($_REQUEST['rec_type']) : '1'; $cat_id = !empty($_REQUEST['cid']) ? intval($_REQUEST['cid']) : '0'; include_once('includes/cls_json.php'); $json = new JSON; $result = array('error' => 0, 'content' => '', 'type' => $rec_type, 'cat_id' => $cat_id); $children = get_children($cat_id); $smarty->assign($rec_array[$rec_type] . '_goods', get_category_recommend_goods($rec_array[$rec_type], $children)); // 推荐商品 $smarty->assign('cat_rec_sign', 1); $properties = get_goods_properties($cat_id); // 获得商品的规格和属性 $smarty->assign('properties', $properties['pro']); // 商品属性 $smarty->assign('specification', $properties['spe']); $result['content'] = $smarty->fetch('library/recommend_' . $rec_array[$rec_type] . '.lbi'); die($json->encode($result)); } //判断是否有ajax请求 if ($act == 'cat_rec') { $rec_array = array('hotels1' => 'hotels1', 'hotels2' => 'hotels2', 'hotels3' => 'hotels3','hotels4' => 'hotels4', 'hotels5' => 'hotels5','hotels6' => 'hotels6');//显示的属性 $rec_type = $_REQUEST['rec_type'];//要求的属性 $hotel_id = !empty($_REQUEST['cid']) ? intval($_REQUEST['cid']) : '0';//酒店的id include_once('includes/cls_json.php'); $json = new JSON; $result = array('error' => 0, 'content' => '', 'type' => 2, 'cat_id' => 16); $brand_info = get_brand_info($hotel_id); $asx = explode("\n",$brand_info['hotel_menu']); foreach ($asx as $v){ $a = explode(":",$v); $ab = explode("~",$a[1]); $asxx[$a[0]]=$ab; } $p=0; if ($_SESSION[brand]){ if ($_REQUEST['pagenum']==null || $_REQUEST['pagenum']==''){ $_REQUEST['pagenum']=1; }else{ $p = ($_REQUEST['pagenum']-1)*25; } $page = "limit ".$p.",25"; if ($_POST["name"] || isset($_POST["name"])) { $_SESSION["name"] = $_POST["name"]; } if ($_POST["phone"] || isset($_POST["phone"])) { $_SESSION["phone"] = $_POST["phone"]; } if ($_POST["startdate"] || isset($_POST["startdate"])) { $_SESSION["startdate"] = $_POST["startdate"]; } if ($_POST["enddate"] || isset($_POST["enddate"])) { $_SESSION["enddate"] = $_POST["enddate"]; } $_SESSION["name"] = str_replace(" ",'',$_SESSION["name"]); $_SESSION["phone"] = str_replace(" ",'',$_SESSION["phone"]); $_SESSION["startdate"] = str_replace(" ",'',$_SESSION["startdate"]); $_SESSION["enddate"] = str_replace(" ",'',$_SESSION["enddate"]); if ($_POST['name'] || $_SESSION["name"]){ $and .= "and (mr like '%".$_SESSION['name']."%' or mi like '%".$_SESSION['name']."%')"; } if ( $_POST['phone'] || $_SESSION["phone"]){ $and .= "and (mrp = '".$_SESSION['phone']."' or mip = '".$_SESSION['phone']."')"; } if ($_POST['startdate'] || $_SESSION["startdate"]){ $and .= "and t >= '".$_SESSION['startdate']."' "; } if ($_POST['enddate'] || $_SESSION["enddate"]){ $and .= "and t <= '".$_SESSION['enddate']."'"; } $smarty->assign('name', $_SESSION['name']); $smarty->assign('phone', $_SESSION['phone']); $smarty->assign('startdate', $_SESSION['startdate']); $smarty->assign('enddate', $_SESSION['enddate']); $msg=$db->getAll("select * from msg where u2 like '%".$_SESSION[brand]."%' $and order by t desc ,id desc $page "); foreach ($msg as $k=>$v){ $msg2 = explode(",",$v['m']); /* $msg2[0] = str_replace(" ","",$msg2[0]); if ($msg[$k]['mr']=='' && $msg[$k]['mi']==''){ $namemmm = explode(":",mb_ereg_replace('[0-9]','',$msg2[0])); $msg[$k]['mr'] =$namemmm[0]; $msg[$k]['mi'] = $namemmm[1]; $phoness = str_replace($namemmm[0],"",$msg2[0]); $phoness = str_replace($namemmm[1],"",$phoness); $phoness2 = explode(":",$phoness); $msg[$k]['mrp'] =$phoness2[1]; $msg[$k]['mip'] = $phoness2[2]; }*/ if ($msg[$k]['mrp'] != 0){ $msg[$k]['mrp'] =$msg[$k]['mrp'][0].$msg[$k]['mrp'][1].$msg[$k]['mrp'][2].$msg[$k]['mrp'][3]."***".$msg[$k]['mrp'][7].$msg[$k]['mrp'][8].$msg[$k]['mrp'][9].$msg[$k]['mrp'][10]; } if ($msg[$k]['mip'] != 0){ $msg[$k]['mip'] =$msg[$k]['mip'][0].$msg[$k]['mip'][1].$msg[$k]['mip'][2].$msg[$k]['mip'][3]."***".$msg[$k]['mip'][7].$msg[$k]['mip'][8].$msg[$k]['mip'][9].$msg[$k]['mip'][10]; } //$msg[$k]['user'] = $msg2[0]; $msg[$k]['hq'] = $msg2[1]; $msg[$k]['zs'] = $msg2[2]; $msg[$k]['ys'] = $msg2[3]; } $all=$db->getOne("select count(*) from msg where u2 like '%".$_SESSION[brand]."%' $and "); $smarty->assign('all', $all); $pageall=ceil($all/25);//总页数 $smarty->assign('pageall', $pageall); $smarty->assign('hotel_msg', $msg); } $pages=''; $pages.=' 第一页     '; if ($_REQUEST['pagenum']>1){ $pages.=' 前一页'; } for ($i=($_REQUEST['pagenum']-10);$i<$_REQUEST['pagenum'];$i++){ if ($i>1){ $pages.=' '.$i.''; } } $pages.=' 当前第'.$_REQUEST['pagenum'].'页'; for ($i=($_REQUEST['pagenum']+1);$i<=($_REQUEST['pagenum']+10);$i++){ if ($i<=$pageall){ $pages.=' '.$i.''; }} if ($_REQUEST['pagenum']<$pageall){ $pages.='     后一页'; } $pages.='     最后页'; $smarty->assign('pages', $pages); $hotel_youh=explode("\n",$brand_info['hotel_giving']);// 优惠 $smarty->assign('brand_name', urlencode($brand_info['brand_name'])); $smarty->assign('hotel_menu', $asxx); $smarty->assign('hotel_youh', $hotel_youh); $smarty->assign('hotel_metro2', $brand_info['hotel_metro2']); $smarty->assign('hotel_metro', $brand_info['hotel_metro']); $smarty->assign('hotel_address', $brand_info['hotel_address']); $sql = "select * from brand_map WHERE brand_name = '".$brand_info['brand_id']."'"; $hotel_map=$db->getRow($sql); $smarty->assign('hotel_map',$hotel_map); $result['content'] = $smarty->fetch('library/' . $rec_array[$rec_type] . '.lbi'); die($json->encode($result)); } /*------------------------------------------------------ */ //-- 判断是否存在缓存,如果存在则调用缓存,反之读取相应内容 /*------------------------------------------------------ */ /* 缓存编号 */ $cache_id = sprintf('%X', crc32($_SESSION['user_rank'] . '-' . $_CFG['lang'])); if (!$smarty->is_cached('index.dwt', $cache_id)) { assign_template(); $position = assign_ur_here(); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 /* meta information */ $smarty->assign('keywords', htmlspecialchars($_CFG['shop_keywords'])); $smarty->assign('description', htmlspecialchars($_CFG['shop_desc'])); $smarty->assign('feed_url', ($_CFG['rewrite'] == 1) ? 'feed.xml' : 'feed.php'); // RSS URL $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('best_goods', get_recommend_goods('best',16)); // 推荐商品 //$smarty->assign('new_goods', get_recommend_goods('new',16)); // 最新商品 // $smarty->assign('hot_goods', get_recommend_goods('hot',16)); // 热点文章 $smarty->assign('promotion_goods', get_promote_goods()); // 特价商品 $smarty->assign('new_hotel',$db->getAll('SELECT * from '. $GLOBALS['ecs']->table('brand')." WHERE 1 and is_hot = 1 and is_show = 1 order by sort_order desc limit 0,8")); $_REQUEST['hotel_ss']='10';//5星级酒店 $smarty->assign('new_hotel3',$db->getAll('SELECT * from '. $GLOBALS['ecs']->table('brand')." WHERE 1 and hotel_ss = 10 and is_show = 1 order by sort_order desc limit 0,16")); //$smarty->assign('new_hotel3',category_get_hotels("brand_id", "DESC", 1,12)); // 最新商品 $_REQUEST['hotel_ss']='9';//4星级酒店 $smarty->assign('new_hotel2',$db->getAll('SELECT * from '. $GLOBALS['ecs']->table('brand')." WHERE 1 and hotel_ss = 9 and is_show = 1 order by sort_order desc limit 0,12")); //$smarty->assign('new_hotel2',category_get_hotels("brand_id", "DESC", 1,8)); // 最新商品 $_REQUEST['hotel_ss']='7';//特色餐厅酒店 $smarty->assign('new_hotel4',$db->getAll('SELECT * from '. $GLOBALS['ecs']->table('brand')." WHERE 1 and hotel_ss = 7 and is_show = 1 order by sort_order desc limit 0,8")); // 最新商品 $_REQUEST['hotel_ss']='6';//特色餐厅酒店 $smarty->assign('new_hotel5',$db->getAll('SELECT * from '. $GLOBALS['ecs']->table('brand')." WHERE 1 and hotel_ss = 6 and is_show = 1 order by sort_order desc limit 0,8")); // 最新商品 $smarty->assign('hot_hotel', get_recommend_goods('hot',16)); // 热点文章 $smarty->assign('promotion_hotel', get_promote_goods()); // 特价商品 $smarty->assign('brand_list', get_brands()); $smarty->assign('promotion_info', get_promotion_info()); // 增加一个动态显示所有促销信息的标签栏 $smarty->assign('invoice_list', index_get_invoice_query()); // 发货查询 $smarty->assign('new_articles', index_get_new_articles()); // 最新文章 $smarty->assign('group_buy_goods', index_get_group_buy()); // 团购商品 $smarty->assign('auction_list', index_get_auction()); // 拍卖活动 $smarty->assign('shop_notice', $_CFG['shop_notice']); // 商店公告 /* 首页主广告设置 */ $smarty->assign('index_ad', $_CFG['index_ad']); if ($_CFG['index_ad'] == 'cus') { $sql = 'SELECT ad_type, content, url FROM ' . $ecs->table("ad_custom") . ' WHERE ad_status = 1'; $ad = $db->getRow($sql, true); $smarty->assign('ad', $ad); } $flash = get_flash_xml('data'); $smarty->assign('flash', $flash); /* links */ $links = index_get_links(); $smarty->assign('img_links', $links['img']); $smarty->assign('txt_links', $links['txt']); $smarty->assign('data_dir', DATA_DIR); // 数据目录 /* 首页推荐分类 */ $cat_recommend_res = $db->getAll("SELECT c.cat_id, c.cat_name, cr.recommend_type FROM " . $ecs->table("cat_recommend") . " AS cr INNER JOIN " . $ecs->table("category") . " AS c ON cr.cat_id=c.cat_id"); if (!empty($cat_recommend_res)) { $cat_rec_array = array(); foreach($cat_recommend_res as $cat_recommend_data) { $cat_rec[$cat_recommend_data['recommend_type']][] = array('cat_id' => $cat_recommend_data['cat_id'], 'cat_name' => $cat_recommend_data['cat_name']); } $smarty->assign('cat_rec', $cat_rec); } $num11 = $db->getAll("SELECT * FROM ".$ecs->table("other")." where name = 1 "); foreach ($num11 as $k=>$v){ $num1[$k+1] = $v; } $num2 = $db->getAll("SELECT * FROM ".$ecs->table("other")." where name = 2 "); $smarty->assign('num1',$num1); $smarty->assign('num2',$num2); $other_slider1 = $db->getAll("SELECT * FROM other_slider1 where 1 order by num desc "); $smarty->assign('other_slider1',$other_slider1); $other_slider2 = $db->getAll("SELECT * FROM other_slider2 where 1 order by num desc"); $smarty->assign('other_slider2',$other_slider2); /* 页面中的动态内容 */ assign_dynamic('index'); } $smarty->display('index.dwt', $cache_id); /*------------------------------------------------------ */ //-- PRIVATE FUNCTIONS /*------------------------------------------------------ */ /** * 调用发货单查询 * * @access private * @return array */ function get_flash_xml($flash_data='flash_data') { $flashdb = array(); if (file_exists(ROOT_PATH . DATA_DIR . "/flashdata/default/$flash_data.xml")) { $data = file_get_contents(ROOT_PATH . DATA_DIR . "/flashdata/default/$flash_data.xml"); preg_match_all('|item_url="(.*?)"|', $data, $img, PREG_SET_ORDER); preg_match_all('|link="(.*?)"|', $data, $url, PREG_SET_ORDER); preg_match_all('|text="(.*?)"|', $data, $text, PREG_SET_ORDER); foreach ($img as $k=>$v){ $flashdb[$k][] = $img[$k][1]; $flashdb[$k][] = $url[$k][1]; $flashdb[$k][] = $text[$k][1]; } } return $flashdb; } function get_brand_info($id) { $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('brand') . " WHERE brand_id = '$id'"; return $GLOBALS['db']->getRow($sql); } function index_get_invoice_query() { $sql = 'SELECT o.order_sn, o.invoice_no, s.shipping_code FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o' . ' LEFT JOIN ' . $GLOBALS['ecs']->table('shipping') . ' AS s ON s.shipping_id = o.shipping_id' . " WHERE invoice_no > '' AND shipping_status = " . SS_SHIPPED . ' ORDER BY shipping_time DESC LIMIT 10'; $all = $GLOBALS['db']->getAll($sql); foreach ($all AS $key => $row) { $plugin = ROOT_PATH . 'includes/modules/shipping/' . $row['shipping_code'] . '.php'; if (file_exists($plugin)) { include_once($plugin); $shipping = new $row['shipping_code']; $all[$key]['invoice_no'] = $shipping->query((string)$row['invoice_no']); } } clearstatcache(); return $all; } /** * 获得最新的文章列表。 * * @access private * @return array */ function index_get_new_articles() { $sql = 'SELECT a.article_id, a.title, ac.cat_name, a.add_time, a.file_url, a.open_type, ac.cat_id, ac.cat_name ' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' AS a, ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac' . ' WHERE a.is_open = 1 AND a.cat_id = ac.cat_id AND ac.cat_type = 1' . ' ORDER BY a.article_type DESC, a.add_time DESC LIMIT ' . $GLOBALS['_CFG']['article_number']; $res = $GLOBALS['db']->getAll($sql); $arr = array(); foreach ($res AS $idx => $row) { $arr[$idx]['id'] = $row['article_id']; $arr[$idx]['title'] = $row['title']; $arr[$idx]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title']; $arr[$idx]['cat_name'] = $row['cat_name']; $arr[$idx]['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']); $arr[$idx]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']); $arr[$idx]['cat_url'] = build_uri('article_cat', array('acid' => $row['cat_id']), $row['cat_name']); } return $arr; } /** * 获得最新的团购活动 * * @access private * @return array */ function index_get_group_buy() { $time = gmtime(); $limit = get_library_number('group_buy', 'index'); $group_buy_list = array(); if ($limit > 0) { $sql = 'SELECT gb.act_id AS group_buy_id, gb.goods_id, gb.ext_info, gb.goods_name, g.goods_thumb, g.goods_img ' . 'FROM ' . $GLOBALS['ecs']->table('goods_activity') . ' AS gb, ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "WHERE gb.act_type = '" . GAT_GROUP_BUY . "' " . "AND g.goods_id = gb.goods_id " . "AND gb.start_time <= '" . $time . "' " . "AND gb.end_time >= '" . $time . "' " . "AND g.is_delete = 0 " . "ORDER BY gb.act_id DESC " . "LIMIT $limit" ; $res = $GLOBALS['db']->query($sql); while ($row = $GLOBALS['db']->fetchRow($res)) { /* 如果缩略图为空,使用默认图片 */ $row['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $row['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); /* 根据价格阶梯,计算最低价 */ $ext_info = unserialize($row['ext_info']); $price_ladder = $ext_info['price_ladder']; if (!is_array($price_ladder) || empty($price_ladder)) { $row['last_price'] = price_format(0); } else { foreach ($price_ladder AS $amount_price) { $price_ladder[$amount_price['amount']] = $amount_price['price']; } } ksort($price_ladder); $row['last_price'] = price_format(end($price_ladder)); $row['url'] = build_uri('group_buy', array('gbid' => $row['group_buy_id'])); $row['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; $row['short_style_name'] = add_style($row['short_name'],''); $group_buy_list[] = $row; } } return $group_buy_list; } /** * 取得拍卖活动列表 * @return array */ function index_get_auction() { $now = gmtime(); $limit = get_library_number('auction', 'index'); $sql = "SELECT a.act_id, a.goods_id, a.goods_name, a.ext_info, g.goods_thumb ". "FROM " . $GLOBALS['ecs']->table('goods_activity') . " AS a," . $GLOBALS['ecs']->table('goods') . " AS g" . " WHERE a.goods_id = g.goods_id" . " AND a.act_type = '" . GAT_AUCTION . "'" . " AND a.is_finished = 0" . " AND a.start_time <= '$now'" . " AND a.end_time >= '$now'" . " AND g.is_delete = 0" . " ORDER BY a.start_time DESC" . " LIMIT $limit"; $res = $GLOBALS['db']->query($sql); $list = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $ext_info = unserialize($row['ext_info']); $arr = array_merge($row, $ext_info); $arr['formated_start_price'] = price_format($arr['start_price']); $arr['formated_end_price'] = price_format($arr['end_price']); $arr['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $arr['url'] = build_uri('auction', array('auid' => $arr['act_id'])); $arr['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($arr['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $arr['goods_name']; $arr['short_style_name'] = add_style($arr['short_name'],''); $list[] = $arr; } return $list; } /** * 获得所有的友情链接 * * @access private * @return array */ function index_get_links() { $sql = 'SELECT link_logo, link_name, link_url FROM ' . $GLOBALS['ecs']->table('friend_link') . ' ORDER BY show_order'; $res = $GLOBALS['db']->getAll($sql); $links['img'] = $links['txt'] = array(); foreach ($res AS $row) { if (!empty($row['link_logo'])) { $links['img'][] = array('name' => $row['link_name'], 'url' => $row['link_url'], 'logo' => $row['link_logo']); } else { $links['txt'][] = array('name' => $row['link_name'], 'url' => $row['link_url']); } } return $links; } function category_get_hotels( $sort="brand_id", $order="DESC", $page=1,$size=10) { $display = $GLOBALS['display']; if ($sort == "shop_price") { $sort = "hotel_price"; if ($order == "ASC") { $where2 .= " hotel_min_price "; } if ($order == "DESC") { $where2 .= " hotel_max_price "; } } if ($sort == "goods_id") { $sort = "hotel_table"; if ($order == "ASC") { $where2 .= " hotel_min_table "; } if ($order == "DESC") { $where2 .= " hotel_max_table "; } } if ($sort == "last_update") { $where2 .= " hotel_points "; } if ($sort == "brand_id") { $where2 .= " sort_order "; $order = "desc"; } if ($sort == null) { $where2 .= " sort_order "; $order = "desc"; } if ($_REQUEST['hotel_area']) { $where1 .= " and hotel_area = ".$_REQUEST['hotel_area'] ; } if ($_REQUEST['hotel_ss'] !== ",,,," && $_REQUEST['hotel_ss'] !== "" && $_REQUEST['hotel_ss'] !== null) { $hotel_sss=explode(",",$_REQUEST['hotel_ss']); $fs=0; foreach ($hotel_sss as $v){ if ($v) { if ($fs) { $where1 .= " or hotel_ss like "."'%".$v."%'" ; }else{ $where1 .= " and hotel_ss like "."'%".$v."%'" ; $fs++; } } } } if ($_REQUEST['hotel_metro']) { $where1 .= " and hotel_metro =".$_REQUEST['hotel_metro'] ; } if ($_REQUEST['hotel_zs']) { $where1 .= " and hotel_zs = ".$_REQUEST['hotel_zs'] ; } if ($_REQUEST['hotel_jg']) { $where1 .= " and hotel_jg =". $_REQUEST['hotel_jg'] ; } /* 获得商品列表 */ $sql = 'SELECT * from'. $GLOBALS['ecs']->table('brand') . "WHERE 1 $where1 ORDER BY $where2 $order"; $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $arr[$row['brand_id']]=$row; } return $arr; } ?>