日期:2014-05-17 浏览次数:20650 次
<?php set_time_limit(0); $prescription = trim($_GET['q']); $id = intval(base64_decode($_GET['id'])); $r_num = 0; //结果个数 $lan = 1; //首页分列 $pf = ""; $pf_l = ""; if($prescription!=""){ $dreamdb=file("date/njjzw.dat");//读取库 $count=count($dreamdb);//计算行数 for($i=0; $i<$count; $i++) { $keyword=explode(" ",$prescription);//拆分关键字 $dreamcount=count($keyword);//关键字个数 for ($ai=0; $ai<$dreamcount; $ai++) { @eval("\$found = eregi(\"$keyword[$ai]\",\"$dreamdb[$i]\");"); //按行查询 if(($found)){ $detail=explode("\t",$dreamdb[$i]);//按tab if(fmod($r_num,$lan)==0) $pf_l .= "<tr>"; $pf_l .= '<td width="'.(100/$lan).'%"><img src="/img/dot.gif" />'; $pf_l .= '<a href="'.base64_encode(($i+1)).'.html">'.$detail[0].'</a></br></td>'; if(fmod($r_num,$lan)+1==$lan) $pf_l .= "</tr>"; $r_num++; break; } } } $pf_l = '<div class="zt"><b><a href="./">脑筋急转弯大全</a>:找到 <a href="./?q='.urlencode($prescription).'"><font color="#c60a00">'.$prescription.'</font></a> 的相关'.$r_num.'个</b></div><div class="wenzi"><table cellpadding="5" cellspacing="10" width="100%">'.$pf_l.'</table> </p></div> <!--内容结束--> '; }elseif($id>0){ $dreamdb=file("date/njjzw.dat");//读取库 $count=count($dreamdb);//计算行数 $detail=explode("\t",$dreamdb[$id-1]); $pf = '<div class="zt"><b><a href="./">脑筋急转弯大全</a> /脑筋急转弯问题</b><td align="right">'; $pf .= '</td></tr><tr></div><div class="wenzi"><table cellpadding="5" cellspacing="10" width="100%"><tr><td colspan="3"><h3> <P class="f14 l200">脑筋急转弯:'.$detail[0].'<SPAN class=hidden>http://www.vipcha.net/naojinjizhuanwan/Mjcx.html</SPAN></P> <P id=midir class="f14 hidden">答案:'.$detail[1].'</P> <P id=midi class=f14><A class=f14 onclick="document.getElementById("midi").innerHTML = document.getElementById("midir").innerHTML;" href="javascript:void(0)">查看答案</A></P> </h3></td></tr><tr> </tr></tr></table></div>'; }else{ $dreamdb=file("date/njjzw.dat");//读取库 $count=count($dreamdb);//计算行数 $pfl = rand(0,intval($count/30)); for($i=$pfl*30; $i<$pfl*30+30; $i++) { if($i>=$count-1) break; $detail=explode("\t",$dreamdb[$i]); if(fmod($r_num,$lan)==0) $pf_l .= "<tr>"; $pf_l .= '<td width="'.(100/$lan).'%"><img src="/img/dot.gif" />'; $pf_l .= '<a href="'.base64_encode(($i+1)).'.html">'.$detail[0].'</a></br></td>'; if(fmod($r_num,$lan)+1==$lan) $pf_l .= "</tr>"; $r_num++; } $pf_l = '<div class="zt"><b>推荐脑筋急转弯大全'.$r_num.'个</b></div><div class="wenzi"><table cellpadding="5" cellspacing="10" width="100%">'.$pf_l.'</table> </p></div>&l