alert('参数传递有误,系统返回!');window.history.back(-1);"; die(""); } //更新浏览次数 $sql="update gongqiu set clicknum=clicknum+1 where id=$id"; mysql_query($sql); //获取新闻分类数组 $sql="select * from gongqiu where id=$id"; $result=mysql_query($sql); if($result){ $row=mysql_fetch_array($result); $title=$row["title"]; $content=$row["content"]; $regdate=$row["regdate"]; $enddate=$row["enddate"]; $userid=$row["userid"]; $clicknum=$row["clicknum"]; $class=$row["class"]; $gpic=$row["gpic"]; $scontent=mysubstr(strip_tags($content),0,150); if($class==1){ $newsclass="供应酒水"; $newsclasslink="供应酒水"; }else{ $newsclass="求购酒水"; $newsclasslink="求购酒水"; } if($gpic!=""){ $gpicpath="$title"; }else{ $gpicpath=""; } $smarty->assign("newsid",$id); $smarty->assign("newsclass",$newsclass); $smarty->assign("newsclasslink",$newsclasslink); $smarty->assign("title",$title); $smarty->assign("content",$content); $smarty->assign("scontent",$scontent); $smarty->assign("gpic",$gpicpath); $smarty->assign("click",$clicknum); $smarty->assign("enddate",$enddate); $smarty->assign("userid",$userid); if($class==1){ $lflag=1; //检索联系信息 $usql="select * from users where id=$userid"; $uresult=mysql_query($usql); if($uresult){ if($urow=mysql_fetch_array($uresult)){ $lxr=$urow["lxr"]; $phone=$urow["phone"]; $email=$urow["email"]; $qq=$urow["qq"]; $address=$urow["address"]; } } }else{ //检索联系信息 if($_SESSION["userid"]==""){ $lflag=0; $lxr="******"; $phone="******"; $email="******"; $qq="******"; $address="******"; }else{ $lflag=1; //检索联系信息 $usql="select * from users where id=$userid"; $uresult=mysql_query($usql); if($uresult){ if($urow=mysql_fetch_array($uresult)){ $lxr=$urow["lxr"]; $phone=$urow["phone"]; $email=$urow["email"]; $qq=$urow["qq"]; $address=$urow["address"]; } } } } $smarty->assign("lflag",$lflag); $smarty->assign("lxr",$lxr); $smarty->assign("phone",$phone); $smarty->assign("email",$email); $smarty->assign("qq",$qq); $smarty->assign("address",$address); }else{ echo ""; die(""); } if($class==""){ $class=1; } //检索上一遍文章 $sql="select * from gongqiu where id<$id and class=$class order by id desc limit 0,1"; $result=mysql_query($sql); if($result){ if($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=trim($row["title"]); $stitle=trim($row["title"]); if(strlen($title)>40) $stitle=mysubstr($title,0,40); $prenews="$stitle"; }else{ $prenews="没有了"; } } //检索下一遍文章 $sql="select * from gongqiu where id>$id and class=$class limit 0,1"; $result=mysql_query($sql); if($result){ if($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=trim($row["title"]); $stitle=trim($row["title"]); if(strlen($title)>40) $stitle=mysubstr($title,0,40); $nextnews="$stitle"; }else{ $nextnews="没有了"; } } //检索相关主题内容 $sql="select * from gongqiu where class=$class order by id desc limit 0,10"; $result=mysql_query($sql); if($result){ while($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=$row["title"]; $xtitle=$row["xtitle"]; $xtitle=mysubstr(strip_tags($title),0,32); $xgxw[]=array("title"=>"·$xtitle"); } } //检索最新供应 $sql="select * from gongqiu where class=$class and isopen=1 order by id desc limit 0,10"; $result=mysql_query($sql); if($result){ while($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=$row["title"]; $xtitle=$row["xtitle"]; $xtitle=mysubstr(strip_tags($title),0,34); $zxzx[]=array("title"=>"·$xtitle"); } } //检索热点供应 $sql="select * from gongqiu where class=$class and isopen=1 order by clicknum desc limit 0,10"; $result=mysql_query($sql); if($result){ while($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $title=$row["title"]; $xtitle=$row["xtitle"]; $xtitle=mysubstr(strip_tags($title),0,34); $hotnews[]=array("title"=>"·$xtitle"); } } //检索推荐产品 $sql="select * from product where pclass=0 and msggrade=2 and pisopen=1 order by id desc limit 0,8"; $result=mysql_query($sql); if($result){ while($row=mysql_fetch_array($result)){ $rowid=$row["id"]; $pname=$row["pname"]; $pspic=$row["pspic"]; $xpname=mysubstr(strip_tags($pname),0,14); $product[]=array("id"=>$rowid,"pic"=>"../uploadfile/$pspic","name"=>$pname,"xname"=>$xpname); } } $smarty->assign("prenews",$prenews); $smarty->assign("nextnews",$nextnews); $smarty->assign("zxzx",$zxzx); $smarty->assign("hotnews",$hotnews); $smarty->assign("product",$product); $smarty->assign("xgxw",$xgxw); //$smarty->caching = true; //$smarty->cache_lefetime = 86400; //$my_cache_id = $_GET['id']; //$smarty->display("gqview.html","$my_cache_id"); $smarty->display("gqview.html"); ?>