<!--#include file="botconn.asp"-->
<%
dim startime
startime=timer()
dim rs,action,seartext,TSum,RowCount,i,cs,tablerow,id,delnews,daynums
action=request("action")

'--分页过程开始
function JoinChar(strUrl)
	if strUrl="" then
		JoinChar=""
		exit function
	end if
	if InStr(strUrl,"?")<len(strUrl) then 
		if InStr(strUrl,"?")>1 then
			if InStr(strUrl,"&")<len(strUrl) then 
				JoinChar=strUrl & "&"
			else
				JoinChar=strUrl
			end if
		else
			JoinChar=strUrl & "?"
		end if
	else
		JoinChar=strUrl
	end if
end function

sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
	if totalnumber>0 then
	dim n, i,strTemp,strUrl
	if totalnumber mod maxperpage=0 then
    	n= totalnumber \ maxperpage
  	else
    	n= totalnumber \ maxperpage+1
  	end if
	strTemp=strTemp & "共 <font color=blue><b>" & totalnumber & "</b></font> " & strUnit & "&#160;&#160;&#160;"
	strUrl=JoinChar(sfilename)
	if pn<2 then
    		strTemp=strTemp & "首页 上一页&#160;"
  	else
    		strTemp=strTemp & "<a href='" & strUrl & "pn=1'>首页</a>&#160;"
    		strTemp=strTemp & "<a href='" & strUrl & "pn=" & (pn-1) & "'>上一页</a>&#160;"
  	end if

  	if n-pn<1 then
    		strTemp=strTemp & "下一页 尾页"
  	else
    		strTemp=strTemp & "<a href='" & strUrl & "pn=" & (pn+1) & "'>下一页</a>&#160;"
    		strTemp=strTemp & "<a href='" & strUrl & "pn=" & n & "'>尾页</a>"
  	end if
   	strTemp=strTemp & "&#160;页次：<strong><font color=red>" & pn & "</font>/" & n & "</strong>页 "
    strTemp=strTemp & "&#160;<b>" & maxperpage & "</b>" & strUnit & "/页"
	if ShowAllPages=True then
		strTemp=strTemp & "&#160;转到：<select name='page' size='1' onchange=""javascript:window.location='" & strUrl & "pn=" & "'+this.options[this.selectedIndex].value;"">"   
    	for i = 1 to n   
    		strTemp=strTemp & "<option value='" & i & "'"
			if cint(pn)=cint(i) then strTemp=strTemp & " selected "
			strTemp=strTemp & ">第" & i & "页</option>"   
	    next
		strTemp=strTemp & "</select>"
	end if
	response.write strTemp
	end if
end sub
'--分页过程结束

'--删除操作
if request("act")="Delete" then
id=request.querystring("id")
oconn.execute "delete from bot where id in ("&request("id")&")"
set oconn=nothing
response.write ("<script>alert('删除成功！');this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
end if

'--清理操作
if request("action")="qingli" then
daynums=request.form("daynums")
oconn.execute "delete * from bot where datediff('d',shijian,now)>='"&daynums&"'"
set oconn=nothing
response.write ("<script>alert('清理【"&daynums&"】天前的数据已经完成！');this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
end if
%>
<!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>《58天搜索引擎蜘蛛爬行访问记录日志插件》免费版</title>
<meta name="robots" content="none">
</head>
<body>

<style type="text/css">
html{
background:#E6F6FF;
}
* {word-wrap:break-word;word-break:break-all;}
html{
	scrollbar-face-color:#95DBFA; scrollbar-highlight-color:#D2F3FE;
	scrollbar-shadow-color:#2BB9EF; scrollbar-3dlight-color:#2BB9EF;
	scrollbar-arrow-color:#357CC5; scrollbar-track-color:#E5F5FF;
	scrollbar-darkshadow-color:#D2F3FE; scrollbar-base-color:#E5F5FF;
}

body{margin:0px auto;padding:0px;height:auto;}
body,div,span,td,th,li,dd,dt,a,p,b,i,input,textarea,select,button {font-family:Verdana, 宋体, fantasy;font-size:12px;color:#2F969B;}
input,textarea,select,button {color:#111;}
a,li a {color:#0F78BA;text-decoration:none;}
a:hover,li a:hover{color:#f60;text-decoration:underline;}
a.showmenu {color:blue; text-decoration:none; }
a.showmenu:hover {color:#FF8E20; text-decoration: underline}
a.showlink {color:red; text-decoration:none; }
a.showlink:hover {color:blue; text-decoration: underline}
a.showtitle {color: #fff;text-decoration: none;}
a.showtitle:hover {color: #fff;text-decoration: underline;}

.tableborder {border:0px #8fb9d0 solid;background:#b6e6fb;width:100%;margin-top:0;margin-bottom:5px;}
.tablerow1,.tablerow2 {border:1px solid #fff;line-height:23px;padding-right:5px;padding-left:5px;}
.tablerow1 {background:#F8FDFF;}
.tablerow2 {background:#E6F3FA;}
.tablerow {background:#edf3fa;border:1px solid #fff;}
.linear{ 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#BFE4F7', GradientType='0'); /*IE*/
background: -ms-linear-gradient(top, #fff,  #BFE4F7);        /* IE 10 */
background:-moz-linear-gradient(top,#fff,#BFE4F7);/*火狐*/ 
background:-webkit-gradient(linear, 0% 0%, 0% 100%,from(#fff), to(#BFE4F7));/*谷歌*/ 
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#BFE4F7));      /* Safari 4-5, Chrome 1-9*/
background: -webkit-linear-gradient(top, #fff, #BFE4F7);   /*Safari5.1 Chrome 10+*/
background: -o-linear-gradient(top, #fff, #BFE4F7);  /*Opera 11.10+*/
} 
</style>
<script language=javascript>
function CheckAll(form)
{
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
}
function Checked()
{
	var j = 0
	for(i=0;i < document.form.elements.length;i++){
		if(document.form.elements[i].name == "id"){
			if(document.form.elements[i].checked){
				j++;
			}
		}
	}
	return j;
}
function DelAll()
{
	if(Checked()  <= 0){
		alert("您至少选择1条信息!");
	}	
	else{
		if(confirm("确定要删除选择的信息吗？\n此操作不可以恢复！")){
			form.action="botlog.asp?Act=Delete";
			form.submit();
		}
	}
}
</script>
<div align="center">
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">

	<tr>
		<td class="tablerow2 linear" width="933" align="center" colspan="6"><b>
		<a href="http://www.58day.com/" target=_blank>《58天搜索引擎蜘蛛爬行访问记录日志插件》免费版</a></b></td>
	</tr>

	<tr>
		<td class="tablerow1" width="933" align="center" colspan="6">
		【<a href="?">日志首页</a>】
		【<a href="?action=view&botid=baiduspider">百度</a>】
		【<a href="?action=view&botid=googlebot">Google</a>】
		【<a href="?action=view&botid=sogou">搜狗</a>】
		【<a href="?action=view&botid=yahoo">雅虎</a>】
		【<a href="?action=view&botid=360Spider">360</a>】
		【<a href="?action=view&botid=bingbot">必应</a>】
		【<a href="?action=view&botid=msnbot">MSN</a>】
				
		
		
		</td>
	</tr>

	<tr>
		<td class="tablerow1" width="933" align="left" colspan="6">
		
		<table border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td><form name=formq method=post id=formq action="?action=qingli">一键清理：<input type="text" name="daynums" size="6" value="30">天前的数据 <input type="submit" value="【确定清理】" name="B1" onClick="return confirm('确定清理吗？');"></form></td>
				<td><form name=formsear method=post id=formsear action="?action=search">搜索：<input type="text" name="seartext" size="30" value="<%=request.form("seartext")%><%=seartext%>"> <input type="submit" value="【搜索】" name="B2"> 支持模糊搜索蜘蛛名称、蜘蛛ID标识、IP、访问地址</form></td>
			</tr>
		</table>
		
		
		
		</td>
	</tr>

<form name=form method=post id=form>
	<tr>
		<td class="tablerow2 linear" width="98" align="center"><input id=chkAll onclick=CheckAll(this.form) type=checkbox value=checkbox name=chkAll><input title=删除 onclick=DelAll() type=button value=删除 name=Submit class="inputs" /></td>
		<td class="tablerow2 linear" width="121" align="center"><b>蜘蛛名称</b></td>
		<td class="tablerow2 linear" width="140" align="center"><b>蜘蛛ID</b></td>
		<td class="tablerow2 linear" width="140" align="center"><b>蜘蛛IP</b></td>
		<td class="tablerow2 linear" width="148" align="center"><b>来访时间</b></td>
		<td class="tablerow2 linear" width="426" align="center"><b>访问页面地址</b></td>
	</tr>
<%
set rs=server.createobject("adodb.recordset")
if action="" then
rs.open "select * from bot order by id desc",oconn,1,1
elseif action="search" then
seartext=request("seartext")
rs.open "select * from bot where bot like '%"&seartext&"%' or agent like '%"&seartext&"%' or url like '%"&seartext&"%' or serverip like '%"&seartext&"%' order by id desc",oconn,1,1
elseif action="view" then
botid=request("botid")
rs.open "select * from bot where agent like '%"&botid&"%' order by id desc",oconn,1,1
end if
if not rs.eof then
					
	dim FileName,FileNameStr,maxperpage,url,pn
	FileName=Request.ServerVariables("PATH_INFO")
	for i=len(FileName) to 1 step -1
		if mid(FileName,i,1)="/" then
		filename=right(FileName,len(FileName)-i)
		exit for
		end if
	next
	select case action
		case ""
		url=FileName & "?"
		case "search"
		url=FileName & "?action=search&seartext="&seartext&""
		case "view"
		url=FileName & "?action=view&botid="&botid&""
	end select
	
	if session("webid")<>"" then url=url&"&username="&session("webid")
	rs.pagesize=20
	pn=REQUEST("pn")
	if pn="" or pn=0 then pn=1
	RS.AbsolutePage=pn
	TSum=rs.pagecount
	maxperpage=rs.pagesize
	RowCount=rs.PageSize
	   pn=pn+1
	   pn=pn-1
	if CINT(pn)>1 then
	    if CINT(pn)>CINT(TSum) then
		  response.Write("对不起没有您想要的页数")
          Response.End
	    end if
	end if  
    if pn<0 then
	    response.Write("没有这一页!")
		Response.End
	End if
	if pn=1 then i=rs.RECORDCOUNT else i=rs.RECORDCOUNT-(30*(pn-1))
end if
%>
<% DO WHILE NOT rs.EOF AND RowCount>0%>
<%
dim a
if rs("bot")="○Google谷歌○2.1" then
   a="blue"
   else 
       if rs("bot")="★百度★" then
		  a="red"
		   else 
		      if rs("bot")="Yahoo!雅虎" then
			     a="#9900CC"
			   else
			   	 if rs("bot")="Soso腾讯搜搜" then
			        a="#008000"
			      else
			       a="#000000"
			      end if
			end if
	   end if
end if				
%>
<%if cs mod 2 = 0 then
tablerow="tablerow1"
else
tablerow="tablerow2"
end if
cs=cs+1%>
	<tr>
		<td class="<%=tablerow%>" width="98" align="center"><input type="checkbox" name="id" value="<%=rs("id")%>" onclick=Checked(form)><%=rs("id")%></td>
		<td class="<%=tablerow%>" width="121" align="center"><font color="<%=a%>"><%=rs("bot")%></font></td>
		<td class="<%=tablerow%>" width="140" align="center"><%=rs("agent")%></td>
		<td class="<%=tablerow%>" width="140" align="center"><%=rs("serverip")%></td>
		<td class="<%=tablerow%>" width="148" align="center"><%=rs("shijian")%></td>
		<td class="<%=tablerow%>" width="426" align="center"><a href="<%=rs("url")%>" target="_blank"><%=rs("url")%></a></td>
	</tr>
<%
      rs.MoveNext
	  RowCount = RowCount - 1 
      Loop
%>

	<tr>
		<td class="tablerow1" width="998" align="center" colspan="6"><% call showpage(url,rs.RECORDCOUNT,maxperpage,false,false,"条爬行记录") %>&nbsp;<% 
Dim Endtime 
Endtime = Timer() 
%><%=FormatNumber((Endtime-Startime)*1000,0)%>毫秒</td>
	</tr>
</table></div>
</form>
</body>
</html>