<!--#include file="ACT.Function.asp"-->
<!--#include file="../ACT_inc/cls_pageview.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ACTCMS_Admin</title>
<link href="Images/css1/css.css" rel="stylesheet" type="text/css">
</head>

<body>
<% 
 If Not ACTCMS.ChkAdmin() Then '超级管理员检测
	Call Actcms.ACTCMSErr("")
 End If 
	Dim ShowErr
	IF Request.QueryString("Action") = "Del" Then
		Dim DatAllowDate ,Sqllog
		DatAllowDate = DateAdd("d", -2, Date) 
		Sqllog = "Delete From Log_ACT Where Times<=#" & DatAllowDate & " 23:59:59#"
		Conn.Execute (Sqllog)		
		ShowErr = "<li>日志删除成功,注意!!!两天内的日志不会被删除</li>"
		Response.Redirect("Error.asp?Errs="&Server.URLEncode(ShowErr)&"&ErrorUrl=ACT.Log.asp"&"&Title=")
		Response.end
		
	End IF
	
	Dim strLocalUrl
	strLocalUrl = request.ServerVariables("SCRIPT_NAME")
	
	Dim intPageNow
	intPageNow = request.QueryString("page")
	
	Dim intPageSize, strPageInfo
	intPageSize = 30
	
	Dim arrRecordInfo, i
	Dim sql, sqlCount,Sqls,pages
	pages = "Type="&Request("Type")&"&page"
	Select Case Request.QueryString("Type")
		Case "0"
			Sqls = "  where ResultTF=0  "
		Case "1"
			Sqls = "  where ResultTF=1  "
		Case Else
			Sqls = ""
	End Select
	sql = "SELECT [ID], [UserName], [ResultTF], [Times], [LoginIP], [ACTError], [lx]" & _
		" FROM [Log_ACT]" &Sqls& _
		"ORDER BY [ID] DESC"
	sqlCount = "SELECT Count([ID])" & _
			" FROM [Log_ACT]"

		Dim clsRecordInfo
		Set clsRecordInfo = New Cls_PageView
			clsRecordInfo.intRecordCount = 2816
			clsRecordInfo.strSqlCount = sqlCount
			clsRecordInfo.strSql = sql
			clsRecordInfo.intPageSize = intPageSize
			clsRecordInfo.intPageNow = intPageNow
			clsRecordInfo.strPageUrl = strLocalUrl
			clsRecordInfo.strPageVar = pages
		clsRecordInfo.objConn = Conn		
		arrRecordInfo = clsRecordInfo.arrRecordInfo
		strPageInfo = clsRecordInfo.strPageInfo
		Set clsRecordInfo = nothing
	 %><form name="SysLog" method="post" action="?Action=">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  <tr>
    <td  class="bg_tr"><strong>系统设置----日志管理首页<a href="#" target="_blank" style="cursor:help;'" class="Help"></a></strong></td>
  </tr>
  <tr>
    <td><strong><a href="?">首页</a> ┆ <a href="?Type=0">错误日志 </a>┆<a href="?Type=1">成功日志 </a>┆</strong></td>
    </tr>
</table>
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
      <td colspan="6" class="bg_tr">您现在的位置：系统设置 &gt;&gt; <a href="?"><font class="bg_tr">日志管理</font></a> </td>
    </tr>
    <tr>
      <td width="136" align="center">管理员</td>
      <td width="123" align="center">状态</td>
      <td width="245" align="center">登录时间</td>
      <td width="182" align="center">登录IP</td>
      <td width="261" align="center">错误信息</td>
    </tr>
	 <%
		Dim bgColor
		If IsArray(arrRecordInfo) Then
			For i = 0 to UBound(arrRecordInfo, 2)
			
		
	%>
    <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
      <td align="center" ><%= arrRecordInfo(1,i) %></td>
      <td align="center" ><%
		Dim acte
		Select Case  arrRecordInfo(6,i)
			Case "1"
				acte="登录"
			Case "2"
				acte="生成"
		End Select 
	   IF arrRecordInfo(2,i) = 1 Then
	   Response.Write "<font color=green>"&acte&"成功</font>"
	   Else 
	   Response.Write "<font color=red>"&acte&"失败</font>"
	   End If %></td>
      <td align="center"><%= arrRecordInfo(3,i) %></td>
      <td align="center" ><%= arrRecordInfo(4,i) %>&nbsp;&nbsp;&nbsp;&nbsp;
	  <a target="_blank" href="http://www.actcms.com/ip/?q=<%= arrRecordInfo(4,i) %>"><font color=green title="连接至官方IP查询,新窗口打开">查询来源</font></a></td>
      <td align="center"><%= arrRecordInfo(5,i) %></td>
    </tr>
	<% 
	Next
	End If
	%>
    <tr >
      <td height="30" colspan="6" align="right">
	   <input name="Action" type="hidden" id="Action">
	    <input type="button" class="ACT_btn" value="删除所有日志，只能删除最近两天以前的日志"  onClick="delpost()">		</td>
    </tr>
    <tr >
      <td height="25" colspan="6" align="center"><%= strPageInfo%></td>
    </tr>
  </table>
</form>
<script language="javascript">


function overColor(Obj)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className="tdbg1"
		Obj.bgColor="";
	}
	
}
function outColor(Obj)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className="tdbg";
		Obj.bgColor="";
	}
}
 
function delpost(){
    document.SysLog.method="post";
    document.SysLog.action="?Action=Del";
{
	if(confirm('确定清空所有日志吗?注意!两天内的日志将不会被清空!')){
	this.document.SysLog.submit();
	return true;}return false;
}
	}


</script>
<% CloseConn %>
</body>
</html>
