<?php
set_time_limit(0);
$prescription = trim($_GET['q']);
$id = intval($_GET['id']);

$r_num = 0; //结果个数
$lan = 3;
$pf = "";
$pf_l = "";

if($prescription!=""){
	$dreamdb=file("data/jm.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]);
				if(fmod($r_num,$lan)==0) $pf_l .= "<tr>";
		$pf_l .= '<td width="'.(100/$lan).'%"> <img src="../img/jiantou.gif" />[<a href="./?q='.urlencode($detail[0]).'"class="lan">'.$detail[0].'</a>';
                $pf_l .= ']<a href="?id='.($i+1).'">'.$detail[1].'</a>';
		                if(trim($detail[2],"\r\n")!="") $pf_l .= '</a></td>';
				if(fmod($r_num,$lan)+1==$lan) $pf_l .= "</tr>";
				$r_num++;
				break;
			}
		}
	}
	$pf_l = '<table width="700" cellpadding="2" cellspacing="0" class="mob_ace" style="border:1px solid #A4C4DC;"><tr><td style="background:url(/img/kuang5.gif);padding:0 5px;color:#014198;" height="26" valign="middle" colspan="5"><b><a href="./">周公解梦</a>：找到 <a href="./?q='.urlencode($prescription).'"><font color="#c60a00">'.$prescription.'</font></a> 的相关解梦'.$r_num.'个</b></td></tr><tr><td><table cellpadding="5" cellspacing="10" width="100%">'.$pf_l.'</table></td></tr></table>';
}elseif($id>0){
	$dreamdb=file("data/jm.dat");//读取解梦文件
	$count=count($dreamdb);//计算行数

	$detail=explode("\t",$dreamdb[$id-1]);
	$pf = '<table width="700" cellpadding=2 cellspacing=0 class="mob_ace" style="border:1px solid #A4C4DC;"><tr><td style="background:url(/img/kuang5.gif);padding:0 5px;color:#014198;" height="26" valign="middle"><b><a href="./">周公解梦</a> / <a href="./?q='.urlencode($detail[0]).'">'.$detail[0].'</a> / '.$detail[1].'</b></td><td style="background:url(/img/kuang5.gif);padding:0 5px;color:#014198;" align="right">';
	if($id>1 && $id<=$count) $pf .= '<a href="?id='.($id-1).'">上一个</a> ';
	$pf .= '<a href="./">查看全部</a>';
	if($id>=1 && $id<$count) $pf .= ' <a href="?id='.($id+1).'">下一个</a>';
	$pf .= '</td></tr><tr><td align="center" colspan="2"><h3>'.$detail[1].'</h3></td></tr><tr><td style="padding:5px;line-height:21px;" colspan="2"><p>'.$detail[2].'</p></td></tr></table>';
}else{
	$dreamdb=file("data/jm.dat");//读取解梦文件
	$count=count($dreamdb);//计算行数

	$pfl = rand(0,intval($count/60));

	for($i=$pfl*60; $i<$pfl*60+60; $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/jiantou.gif" />[<a href="./?q='.urlencode($detail[0]).'"class="lan">'.$detail[0].'</a>';
                $pf_l .= ']<a href="?id='.($i+1).'">'.$detail[1].'</a>';
		if(trim($detail[2],"\r\n")!="") $pf_l .= '</a></td>';
		if(fmod($r_num,$lan)+1==$lan) $pf_l .= "</tr>";
		$r_num++;
	}
	$pf_l = '<table width="700" cellpadding="2" cellspacing="0" class="mob_ace" style="border:1px solid #A4C4DC;"><tr><td style="background:url(/img/kuang5.gif);padding:0 5px;color:#014198;" height="26" valign="middle" colspan="5"><b>推荐周公解梦'.$r_num.'个</b></td></tr><tr><td><table cellpadding="5" cellspacing="10" width="100%">'.$pf_l.'</table></td></tr></table>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<?
if($prescription){
	echo "<title>".$prescription."周公解梦大全_365网址导航_天天导航网</title>";
	echo '<meta name="keywords" content="'.$prescription.',周公解梦,中医解梦,中药解梦,解梦大全" />';
}elseif($id>0 && $id<=$count){
	echo "<title>".$detail[1]." - ".$detail[0]."周公解梦大全_365网址导航_天天导航网,娱乐工具</title>";
	echo '<meta name="keywords" content="周公解梦,解梦大全,365官方,手机号码归属地,邮编查询,365网址导航,天天导航,IP地址,实用导航网站'.$detail[1].",".$detail[0].',解梦,周公解梦大全" />';
}else{
	echo "<title>周公解梦大全_365网址导航_天天导航网</title>";
	echo '<meta name="keywords" content="周公解梦,解梦大全,365官方,手机号码归属地,邮编查询,365网址导航,天天导航,IP地址,实用导航网站,中药解梦" />';
	echo '<meta name="description" content="周公解梦大全，《周公解梦大全查询》收录国内最多的梦境破解，是国内最大的周公解梦系统，以原版周公解梦为基础演绎扩充，结合周易占卜原理，为您解开您梦境中的秘密。《周公解梦》是古代一部关于梦的解析与占卜的书，相传为周公所作，其解梦系按《周易》取象推演而来。" />';
}
?>
<link href="../css/jiuyaocha.css" rel="stylesheet" type="text/css" />
<link href="../favicon.ico" rel="shortcut icon" />
</head>
<body>
<style type="text/css">
h3{font-size:24px;padding:15px 10px 5px 10px;color:#014198;}
p{padding: 10px;}
a.lan,a.lan:visited{color:#999;}
</style>
<script language="javascript" src="../adjs/header1.js"></script>
<div class="flo_l nav"><ul><li class="nav2"><a href="../" >生活查询</a></li>
<li class="nav1"><a href="../yule" >娱乐工具</a></li>
<li class="nav2"><a href="../caijing" >财经商务</a></li>
<li class="nav2"><a href="../jisuan" >计算/学习</a></li>
<li class="nav2"><a href="../wangluo" >电脑网络</a></li>
<li class="nav2"><a href="../zhanzhang" >站长工具</a></li>
<li class="nav2"><a href="../jiaotong" >交通查询</a></li>
</ul></div>
</div></div></div>
<div class="w950">
<div class="knr"><div class="xdh">
<ul id="ful">
<script language="javascript" type="text/javascript" src="../js1/yule.js"></script>
</ul></div></div>
<div class="head3"></div></div>

<script language="javascript" type="text/javascript" src="../js1/ad.js"></script>
<div style='height:5px;'></div>
<div class="w950">
  <div class="head4">
    <div class="Ico_aBox">
      <div class="Ico_aBox_icon INico27"></div>
      <div class="Ico_aBox_tit">周公解梦大全</div>
      <div class="Ico_aBox_intro">周公解梦大全</div>
    </div>
  </div>
  <div class="knr">
    <div class="mobile_main">
<table width="700" cellpadding="2" cellspacing="0" style="border:1px solid #A4C4DC;" id="top"><tr><td align="center" valign="middle" height="60"><form action="./" method="get" name="f1"><b>搜索解梦：<b><input name="q" id="q" type="text" size="18" delay="0" value="" style="width:200px;height:22px;font-size:16px;font-family: Geneva, Arial, Helvetica, sans-serif;" /> <input type="submit" class="mob_copy1" value=" 搜索 " /></form></td></tr><tr><td align="center" height="30" style="font-size:14px;">解梦分类：<a href="./?q=%C9%FA%BB%EE%C6%AA">生活</a> <a href="./?q=%CC%EC%CF%F3%C6%AA">天象</a> <a href="./?q=%C9%BD%B5%D8%C6%AA">山地</a> <a href="./?q=%C6%F7%CE%EF%C6%AA">器物</a> <a href="./?q=%BD%A8%D6%FE%C6%AA">建筑</a> <a href="./?q=%CE%C4%BB%AF%C6%AA">文化</a> <a href="./?q=%D6%B2%CE%EF%C6%AA">植物</a> <a href="./?q=%B6%AF%CE%EF%C6%AA">动物</a> <a href="./?q=%C9%F1%B9%ED%C6%AA">神鬼</a> <a href="./?q=%C8%CB%C9%ED%C6%AA">人身</a> <a href="./?q=%C7%E9%B0%AE%C6%AA">情爱</a> <a href="./?q=%C6%E4%CB%FC%C6%AA">其他</a></td></tr></table><div style='height:10px;'></div>
<?
if($prescription!=""){
	//echo $pf_l.$pf;
	echo $pf_l;
}elseif($id>0 && $id<=$count){
	echo $pf;
}else{
	echo '<table width="700" cellpadding="2" cellspacing="0" class="mob_ace" style="border:1px solid #A4C4DC;"><tr><td style="background:url(/img/kuang5.gif);padding:0 5px;color:#014198;" height="26" valign="middle" colspan="5"><b>周公解梦大全</b></td></tr><tr><td><p style="line-height:150%">　　《周公解梦大全查询》收录国内最多的梦境破解，是国内最大的周公解梦系统，以原版周公解梦为基础演绎扩充，结合周易占卜原理，为您解开您梦境中的秘密。<br />　　《周公解梦》是古代一部关于梦的解析与占卜的书，相传为周公所作，其解梦系按《周易》取象推演而来。</p></td></tr></table>
<br>';
	echo $pf_l;
}
?>
</div>
</div>
  <div class="head3"></div>
<script language="javascript" src="../adjs/footer.js"></script>
<div style="display:none">
<script language="javascript" src="../adjs/tongji.js"></script></div>
</body>
</html>