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

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

if($mingyan!=""){
	$dreamdb=file("data/mingyan.dat");//读取名人名言文件
	$count=count($dreamdb);//计算行数

	for($i=0; $i<$count; $i++) {
		$keyword=explode(" ",$mingyan);//拆分关键字
		$dreamcount=count($keyword);//关键字个数
		$detail=explode("\t",$dreamdb[$i]);
		for ($ai=0; $ai<$dreamcount; $ai++) {
			@eval("\$found = eregi(\"$keyword[$ai]\",\"$detail[0]\");");
			if(($found)){
				if(fmod($r_num,2)==0) $fcolor=' bgcolor="#f6f6f6"'; else $fcolor='';
				$pf_l .= '<tr'.$fcolor.'><td><a href="?id='.($i+1).'">'.$detail[0].'</a></td><td width="100"><input type="button" value=" 查看答案 " onclick="document.location=\'?id='.($i+1).'\'" /></td></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="25" valign="middle" colspan="5"><b><a href="./">名人名言大全</a>：找到 <a href="./?q='.urlencode($mingyan).'"><font color="#c60a00">'.$mingyan.'</font></a> 的相关名人名言'.$r_num.'个</b></td></tr><tr><td><table id="cont" cellpadding="0" cellspacing="0" width="98%" align="center"><tr><td><strong>名人名言比喻</strong></td><td><strong>名人名言解释</strong></td></tr>'.$pf_l.'</table></td></tr></table>';
}elseif($id>0){
	$dreamdb=file("data/mingyan.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="25" valign="middle"><b><a href="./">名人名言大全</a>：'.$detail[0].'</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 colspan="2" align="center"><br><table border="0" width="90%" style="font-size:14px;line-height:150%"><tr><td width="80">【名人】</td><td>'.$detail[0].'</td></tr><tr><td>【名言】</td><td>'.$detail[1].'</td></tr></table><br></td></tr></table><br />';
}
if($mingyan=="" || $id){
	$dreamdb=file("data/mingyan.dat");//读取名人名言文件
	$count=count($dreamdb);//计算行数
	$pfl = rand(0,intval($count/60));

	for($i=$pfl*60; $i<$pfl*60+60; $i++) {
		if($i>=$count-1) break;
		$detail2=explode("\t",$dreamdb[$i]);
		if(fmod($r_num,2)==0) $fcolor=' bgcolor="#f6f6f6"'; else $fcolor='';
		$pf_l .= '<tr'.$fcolor.'><td><a href="?id='.($i+1).'">'.$detail2[0].'</a></td><td width="100"><input type="button" value=" 快速查看 " onclick="document.location=\'?id='.($i+1).'\'" /></td></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="25" valign="middle" colspan="5"><b>推荐名人名言'.$r_num.'个</b></td></tr><tr><td><br><table id="cont" cellpadding="0" cellspacing="0" width="96%" align="center">'.$pf_l.'</table><br></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($mingyan){
	echo "<title>".$mingyan."名人名言大全_365网址导航_天天导航网</title>";
	echo '<meta name="keywords" content="脑筋急转弯,周公解梦,列车时刻表,手机号码归属地,邮编,黄道吉日,号码吉凶,IP地址,工具大全'.$mingyan.',名人名言,名人名言大全," />';
}elseif($id>0 && $id<=$count){
	echo "<title>".$detail[0]."名人名言大全_365网址导航_天天导航网</title>";
	echo '<meta name="keywords" content="脑筋急转弯,周公解梦,列车时刻表,手机号码归属地,邮编,黄道吉日,号码吉凶,IP地址,工具大全'.$detail[0].',名人名言,名人名言大全" />';
	echo '<meta name="description" content="名人名言比喻：'.$detail[0].' -- 解释：'.trim($detail[1],"\n\r").'" />';
}else{
	echo "<title>名人名言大全_365网址导航_天天导航网</title>";
	echo '<meta name="keywords" content="周公解梦,列车时刻表,手机号码归属地,邮编,黄道吉日,号码吉凶,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:18px;padding:10px 0 0 10px;color:#014198;}
p{padding: 10px;font-size:18px}
a.lan,a.lan:visited{color:#999;}
#cont td{height:30px;font-size:14px;padding:0 10px}
#cont a,#cont a:visited{text-decoration:none;}
#cont a:hover{text-decoration:underline;}
</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 INico64"></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" class="mob_ace" 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=%C2%B3%D1%B8">鲁迅</a>,然后按Enter即可</td></tr></table><div style='height:10px;'></div>
<?
if($mingyan!=""){
	echo $pf_l;
}elseif($id>0 && $id<=$count){
	echo $pf.$pf_l;
}else{
?>
<table width="700" cellpadding="2" class="mob_ace" cellspacing="0" style="border:1px solid #A4C4DC;"><tr><td style="background:url(/img/kuang5.gif);padding:0 5px;color:#014198;" height="25" valign="middle" colspan="5"><b>名人名言大全</b></td></tr><tr><td><p style="line-height:150%;font-size:12px;">　　名人名言指名人所说的话，广泛上来说是比较有名的话与有意义的话，名人所说的谚语，格言等都可以叫名人名言。本系统包含5000多个名人留下的3万多条名言名句，支持模糊查询。　
</p></td></tr></table><div style='height:10px;'></div>
<?
	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>


