<!--#include file="botconn.asp"-->
<%
Response.Charset = "utf-8"
version="《酷站领地搜索引擎BOT蜘蛛爬行日志访问记录插件》v2.2全功能免费版"
dim session_adminpass,act,seartext,TSum,RowCount,i,cs,tablerow,id,delnews,daynums,nowpageview
session_adminpass=session("adminpass")
act=request("act")
pn=request("pn")
If pn="" or pn<1 Then pn=1

select case act
	case ""
		nowpageview="首页_"
	case "view"
		nowpageview="筛选"&request("botid")&"_"
	case "search"
		seartext=request("seartext")
		nowpageview="搜索"&seartext&"_"
	case "manage"
		nowpageview="后台管理_"
	case "manage_config"
		nowpageview="系统设置_后台管理_"
	case "manage_bottype"
		nowpageview="BOT类别管理_后台管理_"
	case "manage_editadminpass"
		nowpageview="修改后台密码_后台管理_"
	case "manage_editadminpass"
		nowpageview="初始化数据_后台管理_"
end select
if pn>1 then nowpageview=nowpageview&"第"&pn&"页_"

'--分页过程开始
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=1 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 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>")
response.end
end if

'--清理操作
if act="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>")
response.end
end if

'--登录管理
if act="login" then
adminpass=request.form("adminpass")
if adminpass="" then
Response.write("<script>alert('请输入管理密码！');history.back();</script>")
Response.end
end if
	set rs=server.createobject("adodb.recordset")
	rs.open "select adminpass from config",oConn,0,1
	if not rs.eof then
	rs_adminpass=rs(0)
	end if
	rs.close:set rs=nothing
	
	if adminpass<>rs_adminpass then
	Response.write("<script>alert('管理密码错误！');history.back();</script>")
	Response.end
	end if
	session("adminpass")=adminpass
Response.Write("<script>window.location.href='?act=manage';</script>")
response.end
end if

'--添加BOT
if act="addbot" then
botname=request.form("botname")
botinfo=request.form("botinfo")
botcolor=request.form("botcolor")
botnav=request.form("botnav")
if botnav="" then botnav=0
if botname="" then
Response.write("<script>alert('请输入BOT名称！');history.back();</script>")
Response.end
end if
if botinfo="" then
Response.write("<script>alert('请输入BOT标识！');history.back();</script>")
Response.end
end if
	
	SQLstr="Select id from bottype where botinfo='"&botinfo&"'"
	Set Rs=oconn.Execute(SQLstr,0,1) 
	if not rs.eof then
		Response.write("<script>alert('该蜘蛛标识【"&botinfo&"】已存在于数据库中！');history.back();</script>")
		Response.end
	else
		oconn.execute ("insert into bottype(botname,botinfo,botcolor,botnav) values('"&botname&"','"&botinfo&"','"&botcolor&"','"&botnav&"')")
	end if
	rs.close
	set rs=nothing
set oconn=nothing
response.write ("<script>this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
response.end
end if

'--修改BOT
if act="editbottype" then
id=request("id")
botname=request.form("botname")
botinfo=request.form("botinfo")
botcolor=request.form("botcolor")
botnav=request.form("botnav")
if botnav="" then botnav=0
	if botname="" then
	Response.write("<script>alert('请输入BOT名称！');history.back();</script>")
	Response.end
	end if
	if botinfo="" then
	Response.write("<script>alert('请输入BOT标识！');history.back();</script>")
	Response.end
	end if
oconn.execute "update bottype set botname='"&botname&"',botinfo='"&botinfo&"',botcolor='"&botcolor&"',botnav='"&botnav&"' where id="&id
response.write ("<script>this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
response.end
end if

'--删除BOT
if act="delbottype" then
id=request("id")
oconn.execute "delete from bottype where id="&id
set oconn=nothing
response.write ("<script>this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
response.end
end if

'--保存系统配置
if act="configsave" then
needlogin=request.form("needlogin")
login_clear=request.form("login_clear")
login_search=request.form("login_search")
login_del=request.form("login_del")
pagesizenum=request.form("pagesizenum")
viewlistframe=request.form("viewlistframe")
urlrewrite=request.form("urlrewrite")
clearday=request.form("clearday")
	if pagesizenum="" then
	Response.write("<script>alert('请输入列表分页显示个数！');history.back();</script>")
	Response.end
	end if
oconn.execute "update config set needlogin='"&needlogin&"',login_clear='"&login_clear&"',login_search='"&login_search&"',login_del='"&login_del&"',pagesizenum='"&pagesizenum&"',viewlistframe='"&viewlistframe&"',urlrewrite='"&urlrewrite&"',clearday='"&clearday&"' where id=1"
response.write ("<script>alert('保存配置成功！');this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
response.end
end if

'--修改管理员密码
if act="editadminpass" then
oldpass=request.form("oldpass")
newpass=request.form("newpass")
newpass2=request.form("newpass2")
	if newpass<>newpass2 then
	Response.write("<script>alert('两次输入的新密码不一样，请重新输入！');history.back();</script>")
	Response.end
	end if
	SQLstr="Select adminpass from config "
	Set Rs=oconn.Execute(SQLstr,0,1) 
	if not rs.eof then
	oldpassword=rs(0)
	end if
	rs.close:set rs=nothing
	if oldpass<>oldpassword then
	Response.write("<script>alert('旧密码不正确！');history.back();</script>")
	Response.end
	end if
	oconn.execute "update config set adminpass='"&newpass&"' where id=1"
	response.write ("<script>alert('密码修改成功！');this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
	response.end
end if

'--初始化数据
if act="resetdb" then
reset_db=request.form("reset_db")
reset_bottype=request.form("reset_bottype")
if reset_db=1 then
oconn.execute "delete from bot"
oconn.execute "alter table bot alter column id counter (1,1)"
end if
if reset_bottype=1 then
oconn.execute "delete from bottype"
oconn.execute "alter table bottype alter column id counter (1,1)"
end if
oconn.close
set oconn=nothing
	response.write ("<script>alert('初始化数据完成！');this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
	response.end
end if

'--退出
if act="exit" then
session("adminpass")=""
response.write ("<script>this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</script>")
response.end
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=utf-8" />
<title><%=nowpageview%><%=version%></title>
<meta name="robots" content="none">
</head>
<body>

<style type="text/css">
html{background:#fff;}
* {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:14px;color:#333;}
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;}
.navtext,.navtext a{font-size:16px}
.adminbutton{height:25px;border:0;border-radius:3px;background-color:#1EB4F4;color:#fff;}
.admin-btn{text-align:center;padding:6px 12px;border:0;border-radius:3px;color:#fff;background-color:#1EB4F4;cursor:pointer}
.admin-btn:visited{color:#fff}
.admin-btn:hover{text-decoration:none;color:#fff;background-color:#666;}
.inputstyle {background:no-repeat 0 0 scroll ＃EEEEEE;border:none;outline:medium; padding:5px;border: 1px solid #dedede;-moz-border-radius: 2px;-webkit-border-radius: 2px;border-radius:2px;text-align:left;}
.inputstyle:focus {border:#92FF6C 1px solid;-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);box-shadow: 0 0 10px #99FF33;-webkit-transition: all .1s ease-in-out; border-radius: 2px;-webkit-border-radius: 2px;-moz-border-radius: 2px;}
.tableborder {border:0px #8fb9d0 solid;background:#dedede;width:100%;margin-top:0;margin-bottom:5px;magin-right:20px;}
.tablerow1,.tablerow2 {border:1px solid #fff;line-height:23px;padding-right:5px;padding-left:5px;}
.tableborder th,.minwidth{background:#F0F0F0;word-break: keep-all;white-space: nowrap;}
.tableborder td{word-break: keep-all;white-space: nowrap;}
.tablerow1 {background:#fff;}
.tablerow2 {background:#f0f0f0;}
.tablerow {background:#edf3fa;border:1px solid #fff;}
.linear2{
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+*/
} 
input[type=radio] {-webkit-appearance: none;background-color: #fafafa;border: 1px solid #cacece;padding: 9px;border-radius: 50px;display: inline-block;position: relative;margin-bottom: -5px;outline: none;}
input[type=radio]:checked {padding: 7px;background-color: #777;color: #99a1a7;border: 3px solid #dedede;}
input[type=checkbox] {zoom:100%; 
-ms-transform: scale(1.5); /* IE */
  -moz-transform: scale(1.5); /* FireFox */
  -webkit-transform: scale(1.5); /* Safari and Chrome */
  -o-transform: scale(1.5); /* Opera */
margin-right:8px;}

</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.act="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="?">首页</a> | <a href="?act=manage">管理后台</a>
		<%if session("adminpass")<>"" then%> | <a href="?act=exit">退出管理</a><%end if%>
		</b></td>
	</tr>
</table>
<%
select case act
	case ""
		if needlogin=1 then
			call manage_login()
		else
			call main()
		end if
	case "search"
		call main()
		url=FileName & "?act=search&seartext="&seartext&""
	case "view"
		call main()
	case "manage"
		call manage()
	case "manage_config"
		call manage_config()
	case "manage_bottype"
		call manage_bottype()
	case "manage_editadminpass"
		call manage_editadminpass()
	case "manage_reset"
		call manage_reset()
end select
%>

<%sub manage()%>
<%
if session("adminpass")="" then
call manage_login()
response.end
end if
%>
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th align="left" class="tablerow2 linear">后台管理选项</th>
	</tr>
	<tr>
		<td class="tablerow1" align=center><br>
		<a href="?act=manage_config" class="admin-btn">系统设置</a>
		<a href="?act=manage_bottype" class="admin-btn">BOT类型管理</a>
		<a href="?act=manage_editadminpass" class="admin-btn">修改管理密码</a>
		<a href="?act=manage_reset" class="admin-btn">初始化数据</a>
		<br><br></td>
	</tr>
</table>
<%end sub%>

<%sub manage_reset()%>
<%
if session("adminpass")="" then
call manage_login()
response.end
end if
%>
<form name="form_reset" action="?act=resetdb" method=post>
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0" width="1897">
	<tr>
		<th align="left" class="tablerow2 linear" width="1883" colspan="2">初始化数据</th>
	</tr>
	<tr>
		<td class="tablerow1" align=right width="547">初始化爬行数据：</td>
		<td class="tablerow1" align=left width="1323">
		<input type="checkbox" name="reset_db" value="1"> 将会清空所有爬行数据，并重新进行ID序列号排序
		</td>
	</tr>
	<tr>
		<td class="tablerow1" align=right width="547">初始化蜘蛛类别：</td>
		<td class="tablerow1" align=left width="1323">
		<input type="checkbox" name="reset_bottype" value="1"> 将会清空所有已设定的蜘蛛类别数据，并重新进行ID序列号排序
		</td>
	</tr>
	<tr>
		<td class="tablerow1" align=right width="547">&nbsp;</td>
		<td class="tablerow1" align=left width="1323">
		<input type="submit" value="开始初始化" class="admin-btn" name="B5"></td>
	</tr>
</table>
</form>
<%end sub%>

<%sub manage_login()%>
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<td class="tablerow1" width="933" align="center" colspan="6">
		
		<form name=forml method=post id=forml action="?act=login">
		输入管理密码：<input type=password name="adminpass" size="25" value="">
		<input type="submit" value=" 登录 " class="admin-btn" name="B1">
		</form>
		</td>
	</tr>
</table>
<%end sub%>

<%sub manage_config()%>
<%
if session("adminpass")="" then
call manage_login()
response.end
end if
%>
<form name="form_save" action="?act=configsave" method=post>
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th colspan="2" align="left" class="tablerow2 linear">系统设置</th>
	</tr>
	<tr>
		<td class="tablerow1" width="29%" align="right">列表分页显示个数：</td>
		<td class="tablerow1" width="69%" align="left">
		<input class="inputstyle" type="text" name="pagesizenum" size="11" value="<%=pagesizenum%>" style="text-align:center;" maxlength=10 onkeyup="value=value.replace(/[^\d]/g,'')"> 
		个</td>
	</tr>
	<tr>
		<td class="tablerow1" align="right">登陆后才能查看数据：</td>
		<td class="tablerow1" align="left">　<label><input type="radio" value="1" name="needlogin" <%if needlogin=1 then%> checked<%end if%>>是</label> 
		<label><input type="radio" value="0" name="needlogin" <%if needlogin=0 then%> checked<%end if%>>否</label></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right">登陆后才能使用清理：</td>
		<td class="tablerow1" align="left">　<label><input type="radio" value="1" name="login_clear" <%if login_clear=1 then%> checked<%end if%>>是</label> 
		<label><input type="radio" value="0" name="login_clear" <%if login_clear=0 then%> checked<%end if%>>否</label></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right">登陆后才能使用搜索：</td>
		<td class="tablerow1" align="left">　<label><input type="radio" value="1" name="login_search" <%if login_search=1 then%> checked<%end if%>>是</label> 
		<label><input type="radio" value="0" name="login_search" <%if login_search=0 then%> checked<%end if%>>否</label></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right">登陆后才能删除数据：</td>
		<td class="tablerow1" align="left">　<label><input type="radio" value="1" name="login_del" <%if login_del=1 then%> checked<%end if%>>是</label> 
		<label><input type="radio" value="0" name="login_del" <%if login_del=0 then%> checked<%end if%>>否</label></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right">是否显示分页下拉框：　</td>
		<td class="tablerow1" align="left">　<label><input type="radio" value="1" name="viewlistframe" <%if viewlistframe=1 then%> checked<%end if%>>是</label> 
		<label><input type="radio" value="0" name="viewlistframe" <%if viewlistframe=0 then%> checked<%end if%>>否</label></td>
	</tr>

	<tr>
		<td class="tablerow1" align="right">网站是否采用了IIS7伪静态(URL重写)：</td>
		<td class="tablerow1" align="left">　<label><input type="radio" value="1" name="urlrewrite" <%if urlrewrite=1 then%> checked<%end if%>>是</label> 
		<label><input type="radio" value="0" name="urlrewrite" <%if urlrewrite=0 then%> checked<%end if%>>否</label> 
		（请正确设置，否则记录的爬行页面URL将只会记录执行文件，如www.xxx.com/1.html记录时显示的是index.asp而不是index.asp?id=1。win2003开启了伪静态也选择否）
		</td>
	</tr>

	<tr>
		<td class="tablerow1" align="right">默认一键清理天数：</td>
		<td class="tablerow1" align="left">
		<input class="inputstyle" type="text" name="clearday" size="11" value="<%=clearday%>" style="text-align:center;" maxlength=10 onkeyup="value=value.replace(/[^\d]/g,'')"> 
		天</td>
	</tr>

	<tr>
		<td class="tablerow1" align="right">&nbsp;</td>
		<td class="tablerow1" align="left">
		<input type="submit" value="保存系统配置" class="admin-btn" name="B4"></td>
	</tr>
</table>
</form>
<%end sub%>
<%sub manage_editadminpass()%>
<%
if session("adminpass")="" then
call manage_login()
response.end
end if
%>
<form name="form_editadminpass" action="?act=editadminpass" method=post>
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th colspan="2" align="left" class="tablerow2 linear">修改后台密码</th>
	</tr>
	<tr>
		<td class="tablerow1" width="29%" align="right">请输入原密码：</td>
		<td class="tablerow1" width="69%" align="left">
		<input class="inputstyle" type=password name="oldpass" size="20"></td>
	</tr>
	<tr>
		<td class="tablerow1" align="right">新密码：　</td>
		<td class="tablerow1" align="left">
		<input class="inputstyle" type=password name="newpass" size="20"></td>
	</tr>

	<tr>
		<td class="tablerow1" align="right">确认密码：</td>
		<td class="tablerow1" align="left">
		<input class="inputstyle" type=password name="newpass2" size="20"></td>
	</tr>

	<tr>
		<td class="tablerow1" align="right">&nbsp;</td>
		<td class="tablerow1" align="left">
		<input type="submit" value="保存修改" class="admin-btn" name="B4"></td>
	</tr>
</table>
</form>
<%end sub%>
<%sub manage_bottype()%>
<%
if session("adminpass")="" then
call manage_login()
response.end
end if
%>

<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0" width="1897">
	<tr>
		<th colspan="6" align="left" class="tablerow2 linear">BOT类别管理</th>
	</tr>
	<tr>
		<td class="tablerow1" colspan="6" align="left">
		<form name=forma method=post id=forma action="?act=addbot">
		添加新的BOT | 名称：<input class="inputstyle" type="text" name="botname" size="25"> 
		标识：<input class="inputstyle" type="text" name="botinfo" size="25"> 颜色：<input class="inputstyle" type="text" name="botcolor" size="25"> <select class="inputstyle" size="1" name="ColorMode" onChange="botcolor.value=this.value;">
		<option value="">请选择颜色</option>
<%
	botNameColor = ",Aqua,Fuchsia,Gray,Green,Lime,Navy,Olive,Purple,Red,Silver,Teal,White,Yellow,Blue"
	botNameColor = Split(botNameColor, ",")
	For i = 1 To UBound(botNameColor)
		Response.Write ("<option style=""background-color:"& botNameColor(i) &";color: "& botNameColor(i) &""" value='"& botNameColor(i) &"'")
		Response.Write (">"& botNameColor(i) &"</option>")
	Next
%>
		</select>
		<label><input type="checkbox" name="botnav" value="1">在导航显示</label>
		<input type="submit" value="确认添加" class="admin-btn" name="B3">
		</form>
		</td>
	</tr>
	<tr>
		<th class="tablerow2"><b>ID</b></td>
		<th class="tablerow2"><b>BOT名称</b></td>
		<th class="tablerow2"><b>BOT标识</b></td>
		<th class="tablerow2"><b>BOT显示颜色</b></td>
		<th class="tablerow2"><b>导航栏显示</b></td>
		<th class="tablerow2"><b>操作</b></td>
	</tr>
<%
SQLstr="Select * from bottype order by id desc"
Set Rs=oconn.Execute(SQLstr,0,1) 
do while not rs.eof
botid=rs(0)
botname=rs(1)
botinfo=rs(2)
botcolor=rs(3)
botnav=rs(4)
%>
<form action="?act=editbottype&id=<%=botid%>" method="POST" name="forme<%=botid%>" id="forme<%=botid%>">
	<tr>
		<td class="tablerow1" align="center"><%=botid%></td>
		<td class="tablerow1" align="center"><input class="inputstyle" type="text" name="botname" size="20" value="<%=botname%>" style="text-align:center;<%if botcolor<>"" then%>color:<%=botcolor%>;<%end if%>"></td>
		<td class="tablerow1" align="center"><input class="inputstyle" type="text" name="botinfo" size="20" value="<%=botinfo%>" style="text-align:center;"></td>
		<td class="tablerow1" align="center"><input class="inputstyle" type="text" name="botcolor" id="botcolor<%=botid%>" size="20" value="<%=botcolor%>" style="text-align:center;"><select class="inputstyle" size="1" name="ColorMode" onChange="botcolor<%=botid%>.value=this.value;">
		<option value="">请选择颜色</option>
<%
	botNameColor = ",Aqua,Fuchsia,Gray,Green,Lime,Navy,Olive,Purple,Red,Silver,Teal,White,Yellow,Blue"
	botNameColor = Split(botNameColor, ",")
	For i = 1 To UBound(botNameColor)
		Response.Write ("<option style=""background-color:"& botNameColor(i) &";color: "& botNameColor(i) &""" value='"& botNameColor(i) &"'")
		if lcase(botcolor)=lcase(botNameColor(i)) then response.write (" selected")
		Response.Write (">"& botNameColor(i) &"</option>")
	Next
%>
		</select></td>
		<td class="tablerow1" align="center"><input type="checkbox" name="botnav" value="1" <%if botnav=1 then%>checked<%end if%>></td>
		<td class="tablerow1" align="center"><a href="#" onclick="document.getElementById('forme<%=botid%>').submit();return false;" class="admin-btn">修改</a> | <a href="?act=delbottype&id=<%=botid%>" class="admin-btn">删除</a></td>
	</tr>
</form>
<%
rs.movenext
loop
rs.close:set rs=nothing%>
</table>
<%end sub%>
<%sub main()%>
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<td class="tablerow2 navtext" align="center" colspan="6">
		【<a href="?">日志首页</a>】
<%
SQLstr="Select botname,botinfo from bottype where botnav=1"
Set Rs=oconn.Execute(SQLstr,0,1) 
do while not rs.eof
botname=rs(0)
botinfo=rs(1)
%>
		【<a href="?act=view&botid=<%=botinfo%>"><%=botname%></a>】
<%
rs.movenext
loop
rs.close:set rs=nothing%>
		</td>
	</tr>
	<tr>
		<td class="tablerow1" align="left" colspan="6">
		<table border="0" width="100%" cellspacing="0" cellpadding="0" align=center>
			<tr>
				<td align=right width="41%">
				<%if session_adminpass="" and login_clear=1 then%><%else%>
				<form name=formq method=post id=formq action="?act=qingli">一键清理：<input class="inputstyle" type="text" name="daynums" size="6" value="30" onkeyup="value=value.replace(/[^\d]/g,'')"> 天前的数据 <input type="submit" value="确定清理" name="B1" class="admin-btn" onClick="return confirm('确定清理吗？');"></form>
				<%end if%></td>
				<td width="59%">
				<%if session_adminpass="" and login_search=1 then%><%else%> <form name=formsear method=post id=formsear action="?act=search"> &nbsp;搜索：<input class="inputstyle" type="text" name="seartext" size="30" value="<%=seartext%>"> <input type="submit" value="搜索" class="admin-btn" name="B2"> 支持模糊搜索蜘蛛名称、蜘蛛ID标识、IP、访问地址</form>
				<%end if%></td>
			</tr>
		</table>
		</td>
	</tr>
<form name="form" method="post" id="form" action="?act=delete">
	<tr>
		<th class="tablerow2">ID号<%if session_adminpass="" and login_del=1 then%><%else%> <input title=删除 onclick=DelAll() type=button value=删除 name=Submit class="admin-btn" /> <label><input class="chk_1" id=chkAll onclick=CheckAll(this.form) type=checkbox value=checkbox name=chkAll>全选</label><%end if%></td>
		<th class="tablerow2"><b>蜘蛛名称</b></td>
		<th class="tablerow2"><b>蜘蛛标识</b></td>
		<th class="tablerow2"><b>蜘蛛IP</b></td>
		<th class="tablerow2"><b>爬行时间</b></td>
		<th class="tablerow2" style="min-width:300px;"><b>爬行页面</b></td>
	</tr>
<%
'--极速分页模块
pn=request("pn")
Dim PageSize,TabName,SQLrc,TotalRecords,TotalPages,pn,SQLwhere,TotWhere,SQL,url
PageSize=pagesizenum
TabName="bot"
PageNo=pn
if isnumeric(pn)=false then
	response.write "参数错误！"
	response.end
end if
'--极速分页模块
TotWhere=" where 1=1"
botid=request("botid")
	select case act
		case ""
		case "search"
		TotWhere=TotWhere&" and (bot like '%"&seartext&"%' or agent like '%"&seartext&"%' or serverip like '%"&seartext&"%' or url like '%"&seartext&"%') "
		BOTwhere=" and (bot like '%"&seartext&"%' or agent like '%"&seartext&"%' or serverip like '%"&seartext&"%' or url like '%"&seartext&"%') " 
		case "view"
		TotWhere=TotWhere&" and (agent like '%"&botid&"%') "
		BOTwhere=" and (agent like '%"&botid&"%') "
	end select

'--条件处理
SQLrc="Select count(id) As RecordSum From ["&TabName&"] "&TotWhere&" " 
Set Rs=oconn.Execute(SQLrc,0,1) 
TotalRecords=int(Rs(0))
Rs.Close:Set Rs=Nothing
'TotalRecords=1000
if Int(TotalRecords/PageSize)=TotalRecords/PageSize then
TotalPages=TotalRecords/PageSize
else
TotalPages=Int(TotalRecords/PageSize)+1
end if
If pn-TotalPages>0 Then pn=TotalPages
pn=int(pn)
if pn<=0 then pn=1
	if pn=1 then
	SQLwhere=TotWhere
	else
SQLwhere=TotWhere
		'SQLwhere=" where id<(SELECT Min(id) FROM (SELECT TOP "&PageSize*(pn-1)&" id FROM ["&TabName&"] "&TotWhere&" ORDER BY id desc) AS T ) "&BOTwhere
	end if
'--模块处理结束
'response.write SQLwhere
set rs=server.createobject("adodb.recordset")
rs.open "select top 1 id from ["&TabName&"]",oconn,0,1
if not rs.eof then
dbfound=1
end if
rs.close
set rs=nothing

if dbfound=1 then
set rs=server.createobject("adodb.recordset")
rs.open "select max(id) from ["&TabName&"]",oconn,0,1
if not rs.eof then
maxid=rs(0)
end if
rs.close
set rs=nothing
else
maxid=1
end if

if pn>1 then
maxid=maxid-PageSize*(pn-1)
minid=maxid-PageSize+1
else
minid=maxid-PageSize+1
end if

set rs=server.createobject("adodb.recordset")
if act="" then
rs.open "SELECT id,bot,agent,serverip,shijian,url  from ["&TabName&"] "&SQLwhere&" and id>="&minid&" and id<="&maxid&" order by id desc ",oconn,1,1
else
rs.open "SELECT Top "&PageSize&" id,bot,agent,serverip,shijian,url  from ["&TabName&"] "&SQLwhere&" order by id desc ",oconn,1,1
end if
dim rs_url
if not rs.eof then
	dim FileName,FileNameStr
	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 act
		case ""
		url=FileName & "?"
		case "search"
		url=FileName & "?act=search&seartext="&seartext&""
		case "view"
		url=FileName & "?act=view&botid="&botid&""
	end select
else
	'call NoInfo()
end if
%>
<%do while not rs.eof
rs_url=rs("url")
rs_url=replace(rs_url,"cef_index.asp?cname=","")
rs_url=replace(rs_url,"cef_index.asp?","list_")
rs_url=replace(rs_url,".html","")
rs_url=replace(rs_url,"&id=","/")
rs_url=replace(rs_url,"/v","")
rs_url=rs_url&".html"
rs_url=replace(rs_url,"cef_index.asp.html","")
if instr(rs_url,"/list/")>0 then
rs_url=replace(rs_url,"/list/","/")
rs_url=replace(rs_url,".html","/")
end if
%>
<%if cs mod 2 = 0 then
tablerow="tablerow1"
else
tablerow="tablerow2"
end if
cs=cs+1%>
	<tr style="text-align:center;">
		<td class="<%=tablerow%>"><%if session_adminpass="" and login_del=1 then%><%else%><input type="checkbox" name="id" value="<%=rs("id")%>" onclick=Checked(form)><%end if%><%=rs("id")%></td>
		<td class="<%=tablerow%>"><%=rs("bot")%></td>
		<td class="<%=tablerow%>"><%=rs("agent")%></td>
		<td class="<%=tablerow%>"><%=rs("serverip")%></td>
		<td class="<%=tablerow%>"><%=rs("shijian")%></td>
		<td class="<%=tablerow%>"><a href="<%=rs_url%>" target="_blank"><%=rs_url%></a></td>
	</tr>
<%
imgdata=""
rs.MoveNext
loop
rs.close:set rs=nothing
showlist=viewlistframe
%>
</form>
	<tr>
		<td class="tablerow1" width="998" align="center" colspan="6"><% call showpage(url,TotalRecords,pagesize,0,showlist,"条") %>&nbsp;<% 
Dim Endtime 
Endtime = Timer() 
PageExecuteTime=FormatNumber((Endtime-Startime)*1000,0)
if PageExecuteTime="" then PageExecuteTime=0
%>页面执行时间：<%=PageExecuteTime%>毫秒</td>
	</tr>
</table>
<%end sub%>
<%sub  NoInfo()%>
无记录
<%end sub%>
程序开发、技术支持：酷站领地(www.kz6d.com) 
<a target="_blank" href="http://www.kz6d.com/products/3.html"><%=version%></a> | 
<a target="_blank" href="http://www.kz6d.com/bbs/b/?id=8">蜘蛛论坛 </a>
</div>
</body>
</html>