window.location.href="/detail/'.$id.'.html";'; exit; $show_fields="id,title,maintext,answer,pic_name1,pic_intro1,pic_name2,pic_intro2,pic_name3,pic_intro3,author,cate1,relative,status,rank,quality,http,poster,poster_date,dot,keywords"; $fields=explode(",",$show_fields); $sql="select $show_fields from news where status=1 and display=1 and id='".$id."'"; #echo $sql; $query=$db->query($sql); $rs=$db->fetch_array($query); if($rs['id']==''){ echo '非法操作'; exit; } $manager = new TemplateManager(); $template =& $manager->prepare($template); $tproc = new TemplateProcessor(); $rs[posi]=$rs[cate1]; //点击率 $qh="update news set dot=dot+1 where id='".$rs[id]."'"; $db1->query($qh); if($rs[answer]!=''){//脑筋急转弯 $rs[answer]= str_replace(array("\n","\r"),"",$rs[answer]); $rs[njjzw]=1; } $sql1="select id,title from news where cate1='".$rs[cate1]."' and id>".$rs[id]." order by id limit 1"; $query=$db->query($sql1); if($rs1=$db->fetch_array($query)){ //$rs[pagepre]="上一条:".$rs1[title]."(".$rs1[dot].")"; $rs[pagepre]="上一条:".$rs1[title].""; } $sql1="select id,title,dot from news where cate1='".$rs[cate1]."' and id<".$rs[id]." order by id desc limit 1"; $query=$db->query($sql1); if($rs1=$db->fetch_array($query)){ //$rs[pagefor]="下一条:".$rs1[title]."(".$rs1[dot].")"; $rs[pagefor]="下一条:".$rs1[title].""; } foreach($rs as $key=>$values){ //echo $key."=>".$values."
"; $tproc->set($key,$values); } $s=file_get_contents("笑话大全.html"); $tproc->set("笑话大全", $s); $s=file_get_contents("顺口溜.html"); $tproc->set("顺口溜", $s); $s=file_get_contents("智力游戏.html"); $tproc->set("智力游戏", $s); $s=file_get_contents("本周推荐.html"); $tproc->set("本周推荐", $s); if($rs[keywords]){ $k=explode(" ",$rs[keywords]); foreach($k as $key => $val){ $sql_c.=" or keyword='".$val."'"; } $sql="select n.id,n.title,n.poster_date,n.dot from news as n,news_keywords as nk where n.id=nk.asid and n.id<>".$rs[id]." and (0 $sql_c) group by id order by id desc limit 5"; }else{ $sql="select id,title,poster_date,dot from news where cate1='".$rs[cate1]."' order by id desc,dot desc limit 5"; } //echo $sql; $query=$db->query($sql); while($rs=$db->fetch_array($query)){ //$rs[poster_date]=substr($rs[poster_date],5,10); $relative[]=$rs; } $tproc->set("relative",$relative); echo $tproc->process($template); ?>