admin_userLog.asp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <!--#include file="Inc/common.asp"-->
  2. <!--#include file="Inc/MD5.asp"-->
  3. <!--#include file="Inc/Function.asp"-->
  4. <!--#include file="Admin_Common.asp"-->
  5. <!--#include file="CheckComeUrl.asp"-->
  6. <%
  7. Dim uid, rsRole, isAdmin, rsgan
  8. uid = trim(request("uid"))
  9. if trim(Lcase(AdminName)) = "admin" then
  10. isAdmin = true
  11. else
  12. isAdmin = false
  13. end if
  14. maxperpage = 50
  15. %>
  16. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  17. <html xmlns="http://www.w3.org/1999/xhtml">
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  20. <title><%=systemPageTitle%></title>
  21. <link href="bs2010.css" rel="stylesheet" type="text/css" />
  22. <script type="text/javascript" src="js/share.js"></script>
  23. <script type="text/javascript" src="js/prototype.js"></script>
  24. <script language="javascript" type="text/javascript" src="datepicker/WdatePicker.js"></script>
  25. <script language="javascript">
  26. function GetData()
  27. {
  28. url="alarm.asp";//调用页面
  29. var xmlhttp=null;
  30. if(window.XMLHttpRequest)
  31. {
  32. xmlhttp=new XMLHttpRequest();
  33. }
  34. if(!xmlhttp&&window.ActiveXObject)
  35. {
  36. try
  37. {
  38. xmlhttp=new ActiveXObject("Msxml2.XMLHTTP.5.0")
  39. }
  40. catch(e)
  41. {
  42. try
  43. {
  44. xmlhttp=new ActiveXObject("Msxml2.XMLHTTP.4.0")
  45. }
  46. catch(e){
  47. try
  48. {
  49. new ActiveXObject("Msxml2.XMLHTTP")
  50. }
  51. catch(e)
  52. {
  53. try{
  54. new ActiveXObject("Microsoft.XMLHTTP")
  55. }catch(e)
  56. {
  57. }
  58. }
  59. }
  60. }
  61. }
  62. if(!xmlhttp){alert("XMLHTTP不可用,请升级安装。");location="support/msxml.msi"}
  63. xmlhttp.open("GET",url,false);
  64. xmlhttp.send();
  65. var str = xmlhttp.responseText;
  66. document.getElementById("loadcontent").innerHTML=str;
  67. setTimeout("GetData()",<%=refreshRate%>);
  68. }
  69. </script>
  70. <script language=javascript>
  71. <!--
  72. function CheckForm() {
  73. if(document.searchForm.d1.value == '') {
  74. alert('请选择开始日期!');
  75. document.searchForm.d1.focus();
  76. return false;
  77. }
  78. if(document.searchForm.d2.value == '') {
  79. alert('请选择结束日期!');
  80. document.searchForm.d2.focus();
  81. return false;
  82. }
  83. }
  84. //-->
  85. </script>
  86. </head>
  87. <body onLoad="javascript:GetData();">
  88. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  89. <tr>
  90. <td class="mainbg"><table width="760" border="0" cellspacing="0" cellpadding="0">
  91. <tr>
  92. <td valign="top">
  93. <div id="loadcontent">
  94. <p></p>
  95. 数据载入中……</div>
  96. <br />
  97. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  98. <tr>
  99. <td width="20" height="40"><img src="images/arr1.gif" width="14" height="18" /></td>
  100. <td class="deviceName">用户日志</td>
  101. </tr>
  102. </table>
  103. <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>
  104. <tr class='tdbg'>
  105. <td width='70' height='30'><strong>管理导航:</strong></td>
  106. <td height='30'><a href='Admin_userLog.asp'><%=ChannelShortName%>用户日志首页</a>&nbsp;|&nbsp; <a href="admin_userLog.asp?Action=search">查询</a></td>
  107. </tr>
  108. </table>
  109. <br />
  110. <%
  111. Action = request("Action")
  112. select case Action
  113. case "search"
  114. call Search
  115. case "searchResult0"
  116. call searchResult0
  117. case "searchResult"
  118. call searchResult
  119. case else
  120. call main
  121. end select
  122. sub main()
  123. %>
  124. <form name='myform' method='Post' action='Admin_userLog.asp'>
  125. <%
  126. dim rse, sqle, t_classid, totalPages, totalRecords, i
  127. strFileName = "admin_userLog.asp?action=main"
  128. t_classid = trim(request("t_classid"))
  129. if t_classid = "" then
  130. sqle = "select id, uid, contents, happentime from t_user_log order by happentime desc"
  131. else
  132. sqle = "select id, uid, contents, happentime from t_user_log where uid = '" & t_classid & "' order by happentime desc"
  133. end if
  134. set rse = server.CreateObject("adodb.recordset")
  135. rse.open sqle, conn, 1, 1
  136. rse.pagesize = maxperpage
  137. totalPages = rse.pagecount
  138. totalRecords = rse.recordcount
  139. if rse.bof and rse.eof then
  140. else
  141. dim pageAction
  142. pageAction = request("pageAction")
  143. select case pageAction
  144. case "goPage" session("page") = CLng(request("pageNum"))
  145. case "first" session("page") = 1
  146. case "prev" session("page") = session("page") - 1
  147. case "next" session("page") = session("page") + 1
  148. case "last" session("page") = totalPages
  149. case else session("page") = 1
  150. end select
  151. if session("page") < 1 then session("page") = 1
  152. if session("page") > totalPages then session("page") = totalPages
  153. rse.absolutepage = session("page")
  154. end if
  155. if totalPages > 1 then
  156. if session("page")=1 then
  157. response.write "共有记录<strong>"&TotalRecords&"</strong>条 "&session("Page")&"/"&TotalPages&"页 第一页-上一页 -<a href="&strFileName&"&PageAction=next><strong>下一页</strong></a>-<a href="&strFileName&"&PageAction=last><strong>最后一页</strong></a>"
  158. elseif session("page")=TotalPages Then
  159. response.write "共有记录<strong>"&TotalRecords&"</strong>条 "&session("Page")&"/"&TotalPages&"页 <a href="&strFileName&"&PageAction=first><strong>第一页</strong></a>-<a href="&strFileName&"&PageAction=prev><strong>上一页</strong></a>-下一页-最后一页"
  160. else
  161. response.write "共有记录<strong>"&TotalRecords&"</strong>条 "&session("Page")&"/"&TotalPages&"页 <a href="&strFileName&"&PageAction=first><strong>第一页</strong></a>-<a href="&strFileName&"&PageAction=prev><strong>上一页</strong></a>-<a href="&strFileName&"&PageAction=next><strong>下一页</strong></a>-<a href="&strFileName&"&PageAction=last><strong>最后一页</strong></a>"
  162. end if
  163. else
  164. response.write "共有记录" & totalRecords & "条 " & session("page") & "/" & totalPages & "页"
  165. end if
  166. %>
  167. <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  168. <tr>
  169. <td width="40" class="deviceTdTitle">ID</td>
  170. <td width="120" class="deviceTdTitle">用户 - <a href="admin_userLog.asp" style="font-weight:normal">显示全部</a></td>
  171. <td class="deviceTdTitle">事件</td>
  172. <td width="240" class="deviceTdTitle">发生时间</td>
  173. </tr>
  174. <%
  175. if rse.bof and rse.eof then
  176. %>
  177. <tr class="deviceTd">
  178. <td colspan="4" align="center">没有日志</td>
  179. </tr>
  180. <%
  181. else
  182. i = 0
  183. do while not rse.eof and i < maxperpage
  184. i = i + 1
  185. %>
  186. <tr class="deviceTd">
  187. <td align="center"><%=rse("id")%></td>
  188. <td align="center"><a href="admin_userLog.asp?t_classid=<%=rse("uid")%>"><%=rse("uid")%></a></td>
  189. <td align="center"><%=rse("contents")%></td>
  190. <td align="center"><%=rse("happentime")%></td>
  191. </tr>
  192. <%
  193. rse.movenext
  194. loop
  195. end if
  196. rse.close
  197. set rse = nothing
  198. %>
  199. </table>
  200. </form>
  201. <%
  202. end sub
  203. sub Search()
  204. %>
  205. <form action='admin_userLog.asp' method='post' name='searchForm' id="searchForm" onsubmit='return CheckForm();'>
  206. <p>&nbsp;</p>
  207. <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  208. <tr>
  209. <td colspan="2" class="deviceTdTitle">用户日志查询</td>
  210. </tr>
  211. <tr class="deviceTd">
  212. <td width="18%" align="center"><strong>用户</strong></td>
  213. <td align="left">
  214. <select name='uid'>
  215. <%=GetClass_Option()%>
  216. </select>&nbsp;</td>
  217. </tr>
  218. <tr class="deviceTd">
  219. <td align="center"><strong>日期</strong></td>
  220. <td width="82%" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  221. <tr>
  222. <td align="left">从
  223. <input type="text" id="d1" name="d1" style="border:1px solid #CCC;background:url(DatePicker/skin/datePicker.gif) center right no-repeat" onfocus="WdatePicker({el:'d1',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'<%=startdate%>',maxDate:'#F{$dp.$D(\'d2\')||\'%y-%M-%d %H:%m:%s\'}',onpicked:pickedFunc1})"/>
  224. <script>
  225. function pickedFunc1(){
  226. $dp.$('d1_y').value=$dp.cal.getP('y');
  227. $dp.$('d1_M').value=$dp.cal.getP('M');
  228. $dp.$('d1_d').value=$dp.cal.getP('d');
  229. $dp.$('d1_HH').value=$dp.cal.getP('H');
  230. $dp.$('d1_mm').value=$dp.cal.getP('m');
  231. $dp.$('d1_ss').value=$dp.cal.getP('s');
  232. }
  233. </script></td>
  234. <td align="left">到
  235. <input type="text" id="d2" name="d2" style="border:1px solid #CCC;background:url(DatePicker/skin/datePicker.gif) center right no-repeat" onfocus="WdatePicker({el:'d2',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'d1\')||\'<%=startdate%>\'}',maxDate:'%y-%M-%d %H:%m:%s',onpicked:pickedFunc2})"/>
  236. <script>
  237. function pickedFunc2(){
  238. $dp.$('d2_y').value=$dp.cal.getP('y');
  239. $dp.$('d2_M').value=$dp.cal.getP('M');
  240. $dp.$('d2_d').value=$dp.cal.getP('d');
  241. $dp.$('d2_HH').value=$dp.cal.getP('H');
  242. $dp.$('d2_mm').value=$dp.cal.getP('m');
  243. $dp.$('d2_ss').value=$dp.cal.getP('s');
  244. }
  245. </script></td>
  246. </tr>
  247. </table>
  248. </td>
  249. </tr>
  250. <tr class="deviceTd">
  251. <td colspan="2" align="center">
  252. <input type="hidden" id="Action" name="Action" value="searchResult0" />
  253. <input type="submit" name="submit" id="submit" value="查询" />
  254. </td>
  255. </tr>
  256. </table>
  257. </form>
  258. <%
  259. end sub
  260. sub searchResult0()
  261. session("uid") = trim(request("uid"))
  262. session("d1") = request("d1")
  263. session("d2") = request("d2")
  264. session("page") = 1
  265. call searchResult
  266. end sub
  267. sub searchResult()
  268. dim rse, sqle, t_classid, uid, d1, d2, totalPages, totalRecords, strFileName,i
  269. uid = session("uid")
  270. d1 = session("d1")
  271. d2 = session("d2")
  272. strFileName = "admin_userLog.asp?action=searchResult"
  273. sqle = "select id, uid, contents, happentime from t_user_log where uid = '" & uid & "' and happentime between '"&d1&"' and '"&d2&"' order by happentime desc"
  274. set rse = server.CreateObject("adodb.recordset")
  275. rse.open sqle, conn, 1, 1
  276. rse.pagesize = maxperpage
  277. totalPages = rse.pagecount
  278. totalRecords = rse.recordcount
  279. if rse.bof and rse.eof then
  280. else
  281. dim pageAction
  282. pageAction = request("pageAction")
  283. select case pageAction
  284. case "goPage" session("page") = CLng(request("pageNum"))
  285. case "first" session("page") = 1
  286. case "prev" session("page") = session("page") - 1
  287. case "next" session("page") = session("page") + 1
  288. case "last" session("page") = totalPages
  289. case else session("page") = 1
  290. end select
  291. if session("page") < 1 then session("page") = 1
  292. if session("page") > totalPages then session("page") = totalPages
  293. rse.absolutepage = session("page")
  294. end if
  295. if totalPages > 1 then
  296. if session("page")=1 then
  297. response.write "共有记录<strong>"&TotalRecords&"</strong>条 "&session("Page")&"/"&TotalPages&"页 第一页-上一页 -<a href="&strFileName&"&PageAction=next><strong>下一页</strong></a>-<a href="&strFileName&"&PageAction=last><strong>最后一页</strong></a>"
  298. elseif session("page")=TotalPages Then
  299. response.write "共有记录<strong>"&TotalRecords&"</strong>条 "&session("Page")&"/"&TotalPages&"页 <a href="&strFileName&"&PageAction=first><strong>第一页</strong></a>-<a href="&strFileName&"&PageAction=prev><strong>上一页</strong></a>-下一页-最后一页"
  300. else
  301. response.write "共有记录<strong>"&TotalRecords&"</strong>条 "&session("Page")&"/"&TotalPages&"页 <a href="&strFileName&"&PageAction=first><strong>第一页</strong></a>-<a href="&strFileName&"&PageAction=prev><strong>上一页</strong></a>-<a href="&strFileName&"&PageAction=next><strong>下一页</strong></a>-<a href="&strFileName&"&PageAction=last><strong>最后一页</strong></a>"
  302. end if
  303. else
  304. response.write "共有记录" & totalRecords & "条 " & session("page") & "/" & totalPages & "页"
  305. end if
  306. %>
  307. <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  308. <tr>
  309. <td width="40" class="deviceTdTitle">ID</td>
  310. <td width="120" class="deviceTdTitle">用户</td>
  311. <td class="deviceTdTitle">事件</td>
  312. <td width="240" class="deviceTdTitle">发生时间</td>
  313. </tr>
  314. <%if rse.bof and rse.eof then%>
  315. <tr class="deviceTd">
  316. <td colspan="4" align="center">没有日志</td>
  317. </tr>
  318. <%
  319. else
  320. i = 0
  321. do while not rse.eof and i < maxperpage
  322. i = i + 1
  323. %>
  324. <tr class="deviceTd">
  325. <td align="center"><%=rse("id")%></td>
  326. <td align="center"><%=rse("uid")%></td>
  327. <td align="center"><%=rse("contents")%></td>
  328. <td align="center"><%=rse("happentime")%></td>
  329. </tr>
  330. <%
  331. rse.movenext
  332. loop
  333. end if
  334. rse.close
  335. set rse = nothing
  336. %>
  337. </table>
  338. <%
  339. end sub
  340. %> </td>
  341. </tr>
  342. </table></td>
  343. </tr>
  344. <tr>
  345. <td>&nbsp;</td>
  346. </tr>
  347. </table>
  348. </body>
  349. </html>
  350. <%
  351. Function GetClass_Option()
  352. Dim rsClass, sqlClass, strTemp, tmpDepth, i
  353. sqlClass = "Select uid from t_user_info order by id"
  354. Set rsClass = Conn.Execute(sqlClass)
  355. If rsClass.BOF And rsClass.EOF Then
  356. strTemp = "<option value=''>请先添加用户</option>"
  357. Else
  358. strTemp = ""
  359. Do While Not rsClass.EOF
  360. strTemp = strTemp & "<option value='" & rsClass(0) & "'"
  361. strTemp = strTemp & ">"
  362. strTemp = strTemp & rsClass(0)
  363. strTemp = strTemp & "</option>"
  364. rsClass.MoveNext
  365. Loop
  366. End If
  367. rsClass.Close
  368. Set rsClass = Nothing
  369. GetClass_Option = strTemp
  370. End Function
  371. Function GetPath(ParentID, ParentPath)
  372. on error resume next
  373. Dim strPath, i
  374. If ParentID <= 0 Then
  375. GetPath = "无(所属区域已被删除)"
  376. Exit Function
  377. End If
  378. ParentPath = ParentPath & "," & ParentID
  379. Dim rsParent, sqlParent
  380. sqlParent = "Select * from t_area where t_classid in (" & ParentPath & ") order by Depth"
  381. Set rsParent = Conn.Execute(sqlParent)
  382. Do While Not rsParent.EOF
  383. For i = 1 To rsParent("Depth")
  384. strPath = strPath & "&nbsp;&nbsp;&nbsp;"
  385. Next
  386. If rsParent("Depth") > 0 Then
  387. strPath = strPath & "└&nbsp;"
  388. End If
  389. strPath = strPath & rsParent("ClassName") & "<br>"
  390. rsParent.MoveNext
  391. Loop
  392. rsParent.Close
  393. Set rsParent = Nothing
  394. GetPath = strPath
  395. End Function
  396. Call CloseConn
  397. %>