<?php
require_once("global.php");
require_once("checkpostandget.php");
$id=$_GET['id'];
if (isset($_POST['yue'])&&isset($_POST['ri'])) {
$yue = $_POST['yue'];
$ri = $_POST['ri'];
}
else {
			$yue = date("m");
			$ri = date("d");
}
if (isset($id)) {

	$query="select * from list Where id=".intval($_GET['id'])."";
}
else 
{
$query="select * from list Where M=".$yue." And D=".$ri."";	
}
$result=mysql_query($query);
$numrows = mysql_num_rows($result);
if($numrows==0) 
{
   echo "没找到你要的内容！";
   exit;//结束程序
}
if (isset($id)) {
	$c=mysql_query($query);
  $r=mysql_fetch_object($c);  
 $tit=$yue."月".$ri."日-".$r->Title; 
}
else {
	$tit=$yue."月".$ri."日-历史上的今天";
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><? echo $tit;?><? echo $site;?></title>
<meta name="keywords" content="<? echo $tit;?>,<? echo $keyword;?>" />
<meta name="description" content="<? echo $tit;?>,<? echo $keyword;?>">
<link href="i/common.css" rel="stylesheet" type="text/css" />

</head>

<body>
<div align="center">

<br>
<table width="700" cellpadding=2 cellspacing=0 style="border:1px solid #B2D0EA;">
<tr><th valign="middle" align="left">历史上的今天</th></tr>
<tr><td align="center" style="line-height:250%" valign="top">
<table border="0" width="100%" align="center">
<tr>
<td width="200" style="padding:5px;" valign="top">
<form action="" method="post">
<input name="act" type="hidden" value="yi" />
</form>
<form action="" method="post">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td bgcolor="#FDF3D5" style="padding: 5px;font-weight:bold">日期查询</td></tr>
<tr><td style="padding: 5px"><select name="nian" id="nian">
<option value="2008" selected="selected">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
</select> 年<br />
<select name="yue" id="yue">
<option value="<?=date("m")?>" selected="selected"?><?=date("n")?></option>
<option value="01">1</option>
<option value="02">2</option>
<option value="03">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select> 月 <select name="ri" id="ri">
<option value="<?=date("d")?>" selected="selected"><?=date("j")?></option>
<option value="01">1</option>
<option value="02">2</option>
<option value="03">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select> 日 <input name="act" type="hidden" value="li" /><input type="submit" value="查看" />
</td></tr>
</table>
</form>
<br />
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td bgcolor="#FDF3D5" style="padding: 5px;font-weight:bold">快速链接</td></tr>
<tr><td style="padding: 5px"><a href="http://www.toolxp.cn/nongli/">今日老黄历</a></td></tr>
<tr><td style="padding: 5px"><a href="http://www.toolxp.cn/weather/">今日天气</a></td></tr>
<tr><td style="padding: 5px"><a href="http://www.toolxp.cn/wnl/">万年历查询</a></td></tr>

<tr><td style="padding: 5px">　</td></tr>
</table>

</td>
<td style="padding:5px;border-left:1px dotted #B2D0EA;" valign="top">
<style>
.stab th{font-weight:normal;}
.stab td{padding:5px;}
</style>

<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tr><td><h1 style="font-size:18px;padding:5px;">历史上的<? echo $yue; ?> 月 <? echo $ri; ?>日</h1></td></tr>
</table>
<table border="0" cellpadding="5" cellspacing="5" width="100%" class="stab">
<?
while ($rs=mysql_fetch_object($result)){ 	
	if (isset($id)) {	
?>

<tr><p align=center><strong><?php echo $rs->Title;?></strong></p><p><?php echo $rs->Content;?></p></tr>
<?
	}
	else {
	?>
<tr><th align="left" valign="middle"><li><a href="?id=<?php echo $rs->ID;?>" target=_blank><?php echo $rs->Title;?></a></li></th></tr>
<?
	}
}
?>
</table>

</td>
</tr>
</table>

</td></tr>
</table>
</div><div id="footer"></div>
</body>
</html>