⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_log.asp

📁 依蓝旅游网站管理系统Elan2008.SP2
💻 ASP
字号:
<%
Option Explicit
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
%>
<!--#Include File="../Conn.asp"-->
<!--#Include File="../Inc/MD5.asp"-->
<!--#Include File="Admin_CheckPurview.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href='Admin_Style.css' type='text/css' rel='stylesheet'>
<title>网站日志管理</title>
<script language="javascript" src="../js/Common.js"></script>
<script language="javascript" src="../js/InstallDir.js"></script>
</head>
<body>
<%

Dim CurrentPath, Search_Keywords, Search_Field
Dim LogType, ArrLogItem(10)

ArrLogItem(0) = "0$所有日志$所有日志"
ArrLogItem(1) = "1$后台相关操作$后台相关操作:管理员管理、会员管理操作、数据库管理、后台访问权限等日志"
ArrLogItem(2) = "2$后台登陆日志$后台登陆日志"
ArrLogItem(3) = "3$订单操作日志$订单操作日志"
ArrLogItem(4) = "4$论坛操作日志$论坛操作日志"

Search_Keywords = EL_Common.ReplaceBadChar(EL_Common.ELRequest("Search_Keywords", 1))
Search_Field = EL_Common.ReplaceBadChar(EL_Common.ELRequest("Search_Field", 1))
LogType = EL_Common.ELRequest("LogType", 2)

CurrentPath = "·您现在的位置:<a href='Admin_Log.asp'>网站日志管理</a> "

%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td align="center" class="top_25"><strong>网站日志管理</strong></td>
  </tr>
  <tr>
    <td class="td_50">
	管理导航:<a href="Admin_Log.asp">所有日志</a>
	<%
	  Dim k, arr
	  For k = 1 To UBound(ArrLogItem)
	     If ArrLogItem(k) <> "" Then
		    arr = Split(ArrLogItem(k), "$")
			Response.Write " | <a href='Admin_Log.asp?LogType="& arr(0) &"'>"& arr(1) &"</a>"
		 End If
	  Next
	%>
	</td>
  </tr>
</table>
<br>
<%
Select Case Action
   Case "": Call ManageLog()
   Case "Show": Call ShowLog()
   Case "Delete": Call DeleteLog(1)
   Case "Clear": Call DeleteLog(2)
End Select
Call EL_Common.Bottom()
Call ApplicationTerminate()

Sub DeleteLog(SetType)
   On Error Resume Next
   Dim LogCmd, ArrLogID, LogID
   
   LogID = EL_Common.ELRequest("LogID", 2)
   ArrLogID = EL_Common.ELRequest("CheckObject", 1)   
   ArrLogID = EL_Common.Join2String(ArrLogID, LogID, ",")
   Call EL_Common.InitCommand(LogCmd, "EL_SP_Log")
   With LogCmd
	     .Parameters.Append .CreateParameter("@Type", 3, 1, 4, SetType)
		 .Parameters.Append .CreateParameter("@ArrLogID", 200, 1, 500, ArrLogID)
		 .Parameters.Append .CreateParameter("@LogType", 3, 1, 4, 0)
		 .Parameters.Append .CreateParameter("@ScriptName", 200, 1, 255, "")
		 .Parameters.Append .CreateParameter("@Parameters", 203, 1, 1, "")
		 .Parameters.Append .CreateParameter("@PostURL", 200, 1, 255, "")
		 .Parameters.Append .CreateParameter("@LogText", 200, 1, 255, "")
		 .Parameters.Append .CreateParameter("@RemoteIp", 200, 1, 15, "")
		 .Parameters.Append .CreateParameter("@Editor", 200, 1, 50, "")
		 .Execute()
   End With
   Set LogCmd = Nothing
   EL_Common.ShowScriptError()
   Call EL_Common.InsertLog(1, ComeURL, "删除网站日志", EL_Admin.AdminName)
   Response.Redirect ComeURL
End Sub

Sub ShowLog()
On Error Resume Next
Dim LogCmd, rsLog, LogID
LogID = EL_Common.ELRequest("LogID", 2)
Call EL_Common.InitCommonCmd(LogCmd, rsLog, "EL_Log", "*", "LogID="& LogID)
rsLog.Close()
If LogCmd(0) <> 1 Then
   EL_Common.ShowErrorMsg("指定日志不存在")
   Set rsLog = Nothing
   Set LogCmd = Nothing
   Exit Sub
End If
rsLog.Open()
CurrentPath = CurrentPath &" >> 查看日志详细信息"
%>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td><%=CurrentPath%></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td colspan="2" class="top_25"><strong>日志详细信息</strong></td>
  </tr>
  <tr>
    <td width="14%" class="td_ItemName"><strong>操作人</strong></td>
    <td width="86%" class="item_25"><%=EL_Common.ServerHTMLEncode(rsLog("Editor"))%></td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>IP地址</strong></td>
    <td class="item_25"><%=rsLog("RemoteIP")%></td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>发生时间</strong></td>
    <td class="item_25"><%=rsLog("UpdateTime")%></td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>操作信息</strong></td>
    <td class="item_25"><%=rsLog("LogText")%></td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>发生页面</strong></td>
    <td class="item_25"><%=EL_Common.ServerHTMLEncode(rsLog("ScriptName"))%></td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>提交地址</strong></td>
    <td class="item_25"><%=rsLog("PostURL")%></td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>提交参数</strong></td>
    <td class="td_25" style="WORD-BREAK: break-all">
    <textarea name="textarea" rows="17" style="width:100%"><%=(rsLog("Parameters"))%></textarea></td>
  </tr>
  <tr>
    <td class="td_ItemName">&nbsp;</td>
    <td class="td_50"><input type="button" name="Submit3" value=" 返 回 " onClick="history.back()"></td>
  </tr>
</table>
<%
rsLog.Close()
Set rsLog = Nothing
Set LogCmd = Nothing
EL_Common.ShowScriptError()
End Sub

Sub ManageLog()
On Error Resume Next
Dim ManageCmd, rsLog, StrFields, StrCondition, TempString
Dim PageCounts, RowCount, TotalRowCount
StrFields = "LogID,ScriptName,LogText,RemoteIp,Editor,UpdateTime"
StrCondition = "1=1 "
If LogType > 0 Then
   StrCondition = StrCondition &" And LogType="& LogType
End If
If Search_Keywords<>"" And Search_Field<>"" Then 
   StrCondition = StrCondition &"And "& Search_Field &" Like '%"& Search_Keywords &"%' "
End If

Call EL_Common.InitCommand(ManageCmd, "EL_SP_SplitPage")
With ManageCmd
  .Parameters.Append .CreateParameter("RETURN", 3, 4, 4)
  .Parameters.Append .CreateParameter("@Tables", 200, 1, 50, "EL_Log")
  .Parameters.Append .CreateParameter("@PrimaryKey", 200, 1, 20, "LogID")
  .Parameters.Append .CreateParameter("@Sort", 200, 1, 200, "UpdateTime DESC")
  .Parameters.Append .CreateParameter("@CurrentPage", 3, 1, 4, CurrentPage)
  .Parameters.Append .CreateParameter("@PageSize", 3, 1, 4, PageSizes)
  .Parameters.Append .CreateParameter("@Fields", 200, 1, 1000, StrFields)
  .Parameters.Append .CreateParameter("@Filter", 200, 1, 1000, StrCondition)
  .Parameters.Append .CreateParameter("@Group", 200, 1, 1, "")
  .Parameters.Append .CreateParameter("@TotalRowCount", 3, 2, 4)
  .Parameters.Append .CreateParameter("@PageCount", 3, 2, 4)
  Set rsLog = .Execute()
End With
rsLog.Close()
RowCount = ManageCmd(0)
TotalRowCount = ManageCmd(9)
PageCounts = ManageCmd(10)

Dim arr
arr = Split(ArrLogItem(LogType), "$")
CurrentPath = CurrentPath &" >> "& arr(2)
%>
<script language="javascript">
function CheckedAll(){
  for (var i=0;i<document.myform.elements.length;i++){
    var e = document.myform.elements[i];
    if (e.type == 'checkbox' && e.name=='CheckObject' && e.disabled == false){
       e.checked = true;
    }
  }
  getObject("myselect").innerHTML = "[<a href='javascript:CancelAll()'>取消</a>]";
}
function CancelAll(){
  for (var i=0;i<document.myform.elements.length;i++){
    var e = document.myform.elements[i];
    if (e.type == 'checkbox' && e.name=='CheckObject' && e.disabled == false){
       e.checked = false;
    }
  }
  getObject("myselect").innerHTML = "[<a href='javascript:CheckedAll()'>全选</a>]";
}
function CheckObject(){
   var frm = getObject("myform");
   for (var i=0;i<frm.elements.length;i++){
    var e = frm.elements[i];
    if (e.type == 'checkbox' && e.name=='CheckObject' && e.disabled == false && e.checked == true ){
       return true
    }
  }
  return false;
}
function Check(frm){
  SubmitOnce(frm);
  return true;
}
var JURL = "<%=EL_CurrentScriptName%>?";
function doDelete(){
  var frm = getObject("myform");
  if(!CheckObject()){
     alert("请至少选定1条日志");
	 return false;
  }
  frm.action = JURL + "Action=Delete";
  if(confirm("本次操作将彻底删除选定的日志记录\n确认要执行选定删除吗?")){
     frm.submit();
	 return;
  }
  return false;
}
function doClear(){
  var frm = getObject("myform");
  frm.action = JURL + "Action=Clear";
  if(confirm("本次将彻底清空所有的日志记录,确认要清空吗?")){
     frm.submit();
	 return;
  }
  return false;
}
</script>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td><%=CurrentPath%></td>
  </tr>
</table>
<form name="myform" action="" method="post" onSubmit="return Check(this)">
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td width="4%" align="center" nowrap class="top_item"><strong>选择</strong></td>
    <td width="31%" align="center" nowrap class="top_item"><strong>发生页面</strong></td>
    <td width="22%" align="center" nowrap class="top_item"><strong>操作信息</strong></td>
    <td width="16%" align="center" nowrap class="top_item"><strong>发生时间</strong></td>
    <td width="12%" align="center" nowrap class="top_item"><strong>IP地址</strong></td>
    <td width="10%" align="center" nowrap class="top_item"><strong>操作人</strong></td>
    <td width="5%" align="center" nowrap class="top_item"></td>
  </tr>
  <%
    If RowCount = 0 Then
	    Response.Write "<tr><td colspan=7 class=""td_50"" align=""center"">没有相关 ["& arr(1) &"] 日志数据</td></tr>"
	Else
	  Dim i
	  rsLog.Open()
	  For i = 1 To RowCount
  %>
  <tr class="td_25" onMouseOut="this.className='td_25'" onMouseOver="this.className='MouseOver_25'">
    <td align="center"><input name="CheckObject" type="checkbox" id="CheckObject" value="<%=rsLog("LogID")%>"></td>
    <td style="padding-left:5px;"><%=EL_Common.ServerHTMLEncode(rsLog("ScriptName"))%></td>
    <td style="padding-left:5px;"><%=rsLog("LogText")%></td>
    <td align="center" nowrap><%=rsLog("UpdateTime")%></td>
    <td align="center"><%=rsLog("RemoteIp")%></td>
    <td align="center"><%=rsLog("Editor")%></td>
    <td align="center" nowrap><a href="Admin_Log.asp?Action=Show&LogID=<%=rsLog("LogID")%>">查看</a> | <a href="Admin_Log.asp?Action=Delete&LogID=<%=rsLog("LogID")%>" onClick="return confirm('确认要删除该条日志吗?')">删除</a></td>
  </tr>
  <%
           If i<RowCount Then rsLog.MoveNext
		Next
		rsLog.Close()
     End If
  %>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td width="12%"><span id="myselect">[<a href="javascript:CheckedAll()">全选</a>]</span></td>
    <td width="88%" align="right" nowrap><%Call EL_Common.ShowPage(URLParameters, CurrentPage, PageSizes, PageCounts, TotalRowCount, "日志", "条")%></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td height="50" align="center">
	<%
	Dim sDisabled
	sDisabled = "disabled"
	If RowCount>0 Then sDisabled = ""
	%>
	<input type="button" name="Submit" value="删除选定日志" onClick="doDelete()" <%=sDisabled%>>
    <input type="button" name="Submit2" value="清空所有日志" onClick="doClear()" <%=sDisabled%>>
	</td>
  </tr>
</table>
</form>

<form name="search" method="get" action="<%=EL_CurrentScriptName%>">
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td width="8%" nowrap class="td_50">日志搜索:</td>
    <td width="92%" class="td_50">
	  <select name="Search_Field" id="Search_Field">
	  <option value="LogText">操作信息</option>
	  <option value="Editor">操作人</option>
	  <option value="RemoteIp">IP地址</option>
	  <option value="Parameters">提交参数</option>
      </select>
      <input name="Search_Keywords" type="text" id="Search_Keywords" value="关键字">
      <input type="submit" name="Submit3" value="搜索">
    </td>
  </tr>
</table>
</form>
<%
Set rsLog = Nothing
Set ManageCmd = Nothing
EL_Common.ShowScriptError()
End Sub
%>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -