<?php

require_once('data.php');
if($_COOKIE['x_Cookie']!=$adminname or $_COOKIE['y_Cookie']!=md5($password)){
	echo"<script>location.href='index.php';</script>";
	exit;
}
?>
<!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="Content-Type" content="text/html; charset=gb2312" />
<title>搜索引擎蜘蛛访问日志查看器</title>
<link rel="stylesheet" type="text/css" href="css/admin.css">
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
p {	
	margin: 0 0 10px 5px;
	
}
.f {color: #CCCCCC}
-->
</style>
</head>

<body>
<?
include '../inc/config.php';
?>
<div class="right">
  <? include "welcome.php"; ?>
  <div class="right_main">
<form name=form method=post id=form> 


 <table width="98%" border="0" cellpadding="4" cellspacing="1" class="tableoutline">
 <tr nowrap  class="tb_head">
          <td colspan="6" id="a"><h2>蜘蛛访问记录</h2></td>
        </tr>

 <tr nowrap class="firstalt">
   <td width="50" height="30"><div align="center">ID</div></td>
   <td><div align="center">蜘蛛</div></td>
   <td><div align="center">蜘蛛IP</div></td>
   <td><div align="center">来访时间</div></td>
   <td><div align="center">页面URL</div></td>
   <td>删除</td>
 </tr>
 <?
$scriptname = split('[/]',$_SERVER['SCRIPT_NAME']);
$filename = end($scriptname);
$MM_Conn_STRING="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("../db/bot.mdb") ." ;DefaultDir=". realpath(".");
$Conn=new COM("ADODB.Connection");
$RS =new COM("ADODB.RecordSet");//数据集
$Conn->open($MM_Conn_STRING);//链接打开数据源
$query="select * from bot order by id desc";
$RS->open($query,$Conn,1,1);//执行语句,返回记录集
$pagesize=$RS->Pagesize=40;//设置每页显示条数
if($RS->PageCount<>0){//防止数据库为空
if(!empty($_GET['page'])){
if($_GET['page']<=0){
$RS->AbsolutePage=1;
$nowpage=1;
}elseif($_GET['page']>$RS->PageCount){
$RS->AbsolutePage=$RS->PageCount;
$nowpage=$RS->PageCount;
}else{
$RS->AbsolutePage=$_GET['page'];
$nowpage=$_GET['page'];
}
}else{
$RS->AbsolutePage=1;
$nowpage=1;
}
}else{
$nowpage = 1;
$pagesize = 0;
}
echo "<div align='center' style='color:green;'>";
echo "当前显示第".$nowpage."页　";
echo "每页".$pagesize.'条　';
echo "共有".$RS->RecordCount."条记录　";
echo "共有".$RS->PageCount."页　";
echo "<span style='padding-left:30;'><a href=\"delzz.php?Act=Delete2\">清空全部记录</a></span><br>";
if($RS->PageCount<>0){//防止数据库为空
echo "<a href=".$filename."?page=1".">首页</a>　";
}
if (!($nowpage<1)){
$nowpage=$nowpage-1;
echo "<a href=".$filename."?page=".$nowpage.">上一页</a>　";
}
if (!($nowpage>=$RS->PageCount)){
echo "<a href=".$filename."?page=".$nowpage=$nowpage+2 .">下一页</a>　";
}
echo "<a href=".$filename."?page="."$RS->PageCount".">尾页</a>　";
echo "</div>";
for ($m=1; $m<=$pagesize; $m++)//按照每页显示条数的设定进行循环
{
if (!$RS->EOF){//防止达到记录集尾产生错误
echo "<tr  style=\"background-color:#FFFFFF\">";

if ($RS->fields["bot"]->value=='Google')
$b = "#FF0000" ;
  elseif ($RS->fields["bot"]->value=='Baidu')
   $b="#0000FF";
     elseif ($RS->fields["bot"]->value=='Yahoo!')
	   $b="#ff9966";
	     else
		 $b="#000000" ;

echo "<td height='20'>".$RS->fields["id"]->value."</td>";
echo "<td  align=\"center\">"."<font color=".$b.">".$RS->fields["bot"]->value."</font>"."</td>";
echo "<td  align=\"center\">".$RS->fields["serverip"]->value."</td>";
echo "<td  align=\"center\">".$RS->fields["shijian"]->value."</td>";
echo "<td>"."<a href=".$RS->fields["url"]->value. ">".$RS->fields["url"]->value."</a>"."</td>";
echo "<td>"."<a href='delzz.php?Act=Delete1&id=".$RS->fields["id"]->value. "'>" ."删除</a>"."</td>";
echo"</tr>";
$RS->MoveNext();
}
}
echo "</table>";
if($RS->PageCount==0){//防止数据库为空
echo "<tr><td colspan='3'><div align='center'>没有数据</div></td></tr>";
echo "</table><br>";
echo "</form>";
}
//释放资源
$Conn->Close();
$RS=NULL;
$Conn =NULL;

?>
</div>
</div>
<? include "footer.php"; ?>
</body>
</html>

