session_start();
header('Content-Type: text/html; charset=gb2312');
require "../inc/global.php";
require "../inc/function.php";
$pageID = empty($_REQUEST["pageID"]) ? 30 : $_REQUEST["pageID"];
$db=new db();
//catalog option
$sql="select ID,Title from prog_catalog where FormainId=7 and disp=0 order by disp_id ";
$query = $db->query($sql);
$option="";$i = 0;
while($forum = $db->fetch_array($query)) {
if ($_REQUEST['gsmq'] == $forum['ID']) {
$option .="";
} else {
$option .="";
}
$catalog[$i]['Title'] = $forum['Title'];
$catalog[$i]['ID'] = $forum['ID'];$i++;
}
$gsmq = empty($_REQUEST['gsmq']) ? $catalog[0]['ID'] : $_REQUEST['gsmq'];
//echo $gsmq;
//catalog option
$sql="select ID,FormainID,classes,Title,path from prog_catalog where ID=".$gsmq;
$db = new db();
$query = $db->query($sql);
while($forum = $db->fetch_array($query)) {
if (!empty($forum[path])) {
$logo="
点击上图浏览厂家网站!";
} else {
$logo="";
}
}
$sql="select text from cy_productinfo where kind = 0 and maker = ".$gsmq;
$query = $db->query($sql);
$forum=$db->fetch_array($query);
$gsjj = html_entity_decode($forum['text'],ENT_QUOTES);
$sql="select prog_catalog.ID,prog_catalog.Title,prog_catalog.Description,cy_productinfo.text from prog_catalog Left JOIN cy_productinfo ON (prog_catalog.ID = cy_productinfo.xh and cy_productinfo.kind = 1) where prog_catalog.FormainID='".$gsmq."' and prog_catalog.disp=0 order by prog_catalog.disp_id";
$query = $db->query($sql);
$i=0;
while($forum = $db->fetch_array($query)) {
$xlmq[$i]['ID'] = $forum['ID'];//echo $forum['Title']."
";
if ($forum['Description']=="new") { $xlmq[$i]['new']="";} else { $xlmq[$i]['new']="";}
$xlmq[$i]['Title'] = $forum['Title'];
$xlmq[$i]['text'] = html_entity_decode($forum['text'],ENT_QUOTES);$i++;
}
$xlno = empty($_REQUEST['xlno'])? 0 : $_REQUEST['xlno'];
$xlmq_arry['ID'] = $xlmq[$xlno]['ID'];
$xlmq_arry['Title'] = $xlmq[$xlno]['Title'];
$xlmq_arry['text'] = nl2br($xlmq[$xlno]['text']);
//product
$sql="select ID,XKMQ,XKBM,price,unit,pro_new,spec,spec_date1,spec_date2,kick,img_path,photoview,tao_url,only_spec ";
$sql=$sql."from cy_product where GXMQ='".$gsmq."' and XLMQ='".$xlmq_arry['ID']."' and kind=2 order by forid";
$query = $db->query($sql);
$IP = $db -> check_ip($_SERVER['REMOTE_ADDR']);
$i=0;
while($forum = $db->fetch_array($query)) {
$product[$i]['ID'] = $forum['ID'];
$product[$i]['XKMQ'] = $forum['XKMQ'];//echo $forum['XKMQ']."
";
$product[$i]['XKBM'] = empty($forum['XKBM'])? "": " ";
if ($IP != "ok") { $price = 0;} else { $price = $forum['price'];}
$product[$i]['unit'] = empty($forum['unit'])? "" : "规格:".$forum['unit'];
$product[$i]['pro_new'] = empty($forum['pro_new'])? "" : "";
$product[$i]['price'] = show_spec($price,$forum['only_spec'],$forum['spec'],$forum['spec_date1'],$forum['spec_date2']);
$product[$i]['shopcard']= ($price == 0 || $_SESSION["checkout"]=="on")? "": "";
$product[$i]['kick'] = $forum['kick'];
$product[$i]['img_path'] = $forum['img_path'];
$product[$i]['photoview'] = $forum['photoview'];
$product[$i]['tao_url'] = empty($forum['tao_url'])? "" : " ";
$i++;
}
//product
//echo $pagestr;
$viewdata = array("pageID" => $pageID ,
"siteinfo" => $siteinfo,
"sitename" => $sitename,
"news" => $news,
"option" => $option,
"catalog" => $catalog,
"logo" => $logo,
"product" => $product,
"gsmq" => $gsmq,
"xlmq" => $xlmq,
"xlno" => $xlno,
"xlmq_arry" => $xlmq_arry,
"gsjj" => $gsjj,
"menu" => showmenu($pageID)
);
$tplname= CModel($_SERVER["SCRIPT_NAME"]);
callview($viewdata,$tplname);
?>