📄 helix_log.asp
字号:
<!--#include file="chklogin.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>数据库记录清理</title>
<link href="images/style2.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
}
a:link {
color: #0000FF;
text-decoration: none;
}
a:visited {
color: #0000FF;
text-decoration: none;
}
a:hover {
color: #FF0000;
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style>
<script language="JavaScript">
function tourl(form1_url){
location=form1_url;
for(var i=0;i<document.form1.elements.length;i++){
document.form1.elements[i].options[0].selected=true
}
}
</script>
</head>
<body leftMargin="0" topMargin="0" bgcolor="#FFFFFF">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"> </td>
</tr>
</table>
<table width="100%" height="25" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#3975CE">
<tr>
<td align="center" class="font1"><strong>Helix Server连接历史记录</strong></td>
</tr>
</table>
<table width="100%" height="30" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><a href="<%=filename%>?action=del_3day">删除3天前的记录</a> <a href="<%=filename%>?action=del_7day">删除7天前的记录</a> <a href="<%=filename%>?action=del_1month">删除1个月前的记录</a> <a href="<%=filename%>?action=del_all">清空所有记录</a></td>
</tr>
</table>
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from access_log",conn,1,1
if rs.eof and rs.bof then
%>
<table width="100%" height="200" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#E7E7E7">
<tr>
<td align="center">暂时还没有任何链接记录
</tr>
</table>
<%
else
maxpage=10 '每页最大显示数
dim totalhow '数据库中的总记录数
dim totalpage '总共页数
dim CurrentPage '当前处于的页数
currentPage=request.Querystring("page")
totalhow=rs.recordcount
if totalhow mod maxpage=0 then
totalpage= totalhow \ maxpage
else
totalpage = totalhow \ maxpage +1
end if
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPage>totalhow then
if (totalhow mod MaxPage)=0 then
currentpage= totalhow \ MaxPage
else
currentpage= totalhow \ MaxPage + 1
end if
end if
if (currentPage-1)*MaxPage<totalhow then
rs.move (currentPage-1)*MaxPage
else
currentPage=1
end if
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#E7E7E7">
<tr>
<td height="25" align="center" bgcolor="#F7F7F7">IP地址</td>
<td align="center" bgcolor="#F7F7F7">链接文件</td>
<td align="center" bgcolor="#F7F7F7">起始时间</td>
<td align="center" bgcolor="#F7F7F7">断开时间</td>
<td align="center" bgcolor="#F7F7F7">总时长(秒)</td>
<td align="center" bgcolor="#F7F7F7">链接时间</td>
</tr>
<%
i=0
do while not rs.eof
i=i+1
%>
<tr>
<td height="25" align="center" bgcolor="#FFFFFF"><%=rs("ip")%></td>
<td height="25" align="center" bgcolor="#FFFFFF"><%=rs("url")%></td>
<td height="25" align="center" bgcolor="#FFFFFF"><%=rs("start_time")%></td>
<td height="25" align="center" bgcolor="#FFFFFF"><%=rs("end_time")%></td>
<td height="25" align="center" bgcolor="#FFFFFF"><%=rs("total_time")%></td>
<td height="25" align="center" bgcolor="#FFFFFF"><%=rs("log_time")%></td>
</tr>
<%
if i>=maxpage then exit do
rs.movenext
loop
%>
</table>
<table width="100%" height="40" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="form1" method="post">
<tr>
<td align="center"><!-- ########### 开始判断分页类型 ############### -->
<font face="Webdings">7</font>
<%if currentpage>1 then%>
<a href="<%=filename%>?sql=<%=request("sql")%>&var=<%=request("var")%>">
<%end if%>
首页
<%if currentpage>1 then%>
</a>
<%end if%>
<%if currentpage>1 then%>
<a href="<%=filename%>?page=<%=currentPage-1%>&sql=<%=request("sql")%>&var=<%=request("var")%>">
<%end if%>
上一页
<%if currentpage>1 then%>
</a>
<%end if%>
<%if cint(currentpage)<totalpage then%>
<a href="<%=filename%>?page=<%=currentPage+1%>&sql=<%=request("sql")%>&var=<%=request("var")%>">
<%end if%>
下一页
<%if cint(currentpage)<totalpage then%>
</a>
<%end if%>
<%if cint(currentpage)<totalpage then%>
<a href="<%=filename%>?page=<%=totalpage%>&sql=<%=request("sql")%>&var=<%=request("var")%>">
<%end if%>
尾页
<%if cint(currentpage)<totalpage then%>
</a>
<%end if%>
<font face="Webdings">8</font> 共有<span class="font3"><%=totalhow%></span>条记录 共<span class="font3"><%=currentPage%></span>/<span class="font3"><%=totalpage%></span>页
<select name="topage" size="1" class="select1" onChange="JavaScript:tourl(document.form1.topage.options[document.form1.topage.selectedIndex].value)">
<%
for j=1 to totalpage
%>
<option value="<%=filename%>?page=<%=j%>&sql=<%=request("sql")%>&var=<%=request("var")%>" <%if cint(request.Querystring("page"))=j then%>selected<%end if%>> 第<%=j%>页 </option>
<%next%>
</select></td>
</form>
<!-- ############################ 判断分页类型结束 ######################## -->
</table>
<%
end if
if request.QueryString("action")="del_all" then
conn.execute"delete from access_log"
rs.close
set rs=nothing
conn.close
set conn=nothing
Response.Redirect ("helix_log.asp")
response.end
end if
if request.QueryString("action")="del_3day" then
conn.execute "delete From access_log Where log_time<DATEADD(d, -3, getdate())"
rs.close
set rs=nothing
conn.close
set conn=nothing
Response.Redirect ("helix_log.asp")
response.end
end if
if request.QueryString("action")="del_7day" then
conn.execute "delete From access_log Where log_time<DATEADD(d, -7, getdate())"
rs.close
set rs=nothing
conn.close
set conn=nothing
Response.Redirect ("helix_log.asp")
response.end
end if
if request.QueryString("action")="del_1month" then
conn.execute "delete From access_log Where log_time<DATEADD(m, -1, getdate())"
rs.close
set rs=nothing
conn.close
set conn=nothing
Response.Redirect ("helix_log.asp")
response.end
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -