<?php
/*
	[Phpup.Net!] (C)2009-2011 Phpup.net.
	This is NOT a freeware, use is subject to license terms

	$Id: getinfo.php 2010-08-24 10:42 $
*/

define('IN_PHPUP',1);
date_default_timezone_set('Asia/Shanghai');
define('ROOT_PATH',str_replace('models','',dirname(__FILE__)));
include ROOT_PATH.'/data/config.inc.php';
header("Content-type:text/html;charset=".$GLOBALS['charset']);
include ROOT_PATH.'/data/cache/setting.php';
include ROOT_PATH.'/inc/global.func.php';
$setting=$content;
$dbcharset ='utf8';
$serverset = 'character_set_connection='.$dbcharset.', character_set_results='.$dbcharset.', character_set_client=binary';
$link=mysql_pconnect($dbhost,$dbuser,$dbpw);
mysql_query('use '.$dbname,$link);
$version=mysql_get_server_info($link);
$serverset .= $version> '5.0.1' ? ((empty($serverset) ? '' : ',').'sql_mode=\'\'') : '';
$serverset && mysql_query("SET $serverset", $link);
//城市id
$cityid=empty($_REQUEST['cityid'])?'quanguo':trim(strip_tags($_REQUEST['cityid']));
//分类id
$bigcateid=empty($_REQUEST['cateid'])?0:intval($_REQUEST['cateid']);
//子分类id
$smallcateid=empty($_REQUEST['smallid'])?0:intval($_REQUEST['smallid']);
//商圈id
$limit=$setting['site_group_count']>0?$setting['site_group_count']:18;
$bizid=empty($_REQUEST['bizid'])?0:intval($_REQUEST['bizid']);
$sql="select id,subject,thumb,shortsubject,groupsite,siteid,nowprice,oldprice,hits,nowpeople,discount from `".$table_prefix."groups` where 1 ";
if($cityid)
{
	$sql.=' and cityid="'.$cityid.'"';
}
if($bigcateid)
{
	$sql.=' and big_catelist="'.$bigcateid.'"';
}
if($smallcateid)
{
	$sql.=' and small_catelist="'.$smallcateid.'"';
}
if($bizid)
{
	$sql.=' and bizgroup="'.$bizid.'"';
}
$sql.=' order by sortorder desc limit '.$limit.','.$limit;

$groups=array();
$query=mysql_query($sql);
while($data=mysql_fetch_array($query))
{
	$groups[]=$data;
}
include ROOT_PATH.'/views/'.$setting['site_template_dir'].'/index_cate.php';