<!--#INCLUDE FILE="conn.asp" -->
<!--#include file="inc/char.asp"-->
<!--#include file="admin_Checkuser.asp"-->
<HTML><HEAD><title><%=StrVar(1)%>--管理页面</title>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<!--#include file="inc/admin_main.css"-->
</HEAD>
<BODY leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<%
if  not sysadmin or session("adminlogin")<>"0K" Then
	Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用，请<a href=admin_index.asp target=_top>登陆</a>后进入。"
	Call Error("Information",ErrMsg)
	else
call main()
Call endconnection()
end if
sub main()	
%><table cellpadding=5 cellspacing=1 border=0 width=90% Class=TableBorder align=center>
  <tr>
	<th>欢迎<b><%=membername%></b>进入管理页面</th>
</tr>
</table>
      <%
select case request("action")
  case "删除日志"
     call dellog()
case else	 
	call alllog()
end select
%>
<%
end sub
sub dellog()
Dim idlist,idarr,logid
   
if Request("logid")="" Then
	Errmsg=Errmsg+"<br>"+"<li>请选择所要进行管理操作的日志！"
	Call Error("Information",ErrMsg)
	Exit Sub
End if

idlist=Request("logid")

idArr=Split(idlist,",")
SucDelNum=0
for i = 0 to ubound(idarr)
	logid=Clng(idarr(i))

   Sql = "Delete From log Where logid="&logid
   Conn.Execute(Sql)
   SucDelNum=SucDelNum+1
next
Call adminmsg("恭喜，成功删除&nbsp;<font color=brown>"&SucDelNum&"</font>&nbsp;条日志！")
end sub

sub alllog()

dim classid,searchname
searchname=trim(request("name"))
classid=trim(request("classid"))
if classid="" then classid=0
%>
<TABLE border=0 width=600 align=center Class=TableBorder>
  <TR> 
    <TD colspan="2" class=forumRowHighlight><b>说明：</b><br>
      (1)此列表是管理每个学校的管理历史记录，可以单独查看每个学校的管理记录<br> 
      (2)一旦删除管理历史记录，就无法恢复，请慎重考虑！</TD>
  </TR>
  <TR> 
    <TD width="30%" class=forumrow>
    </TD><form name="form2" method="post" action="">
      <TD width="70%" class=forumrow align=right> 查看某用户的学校管理历史记录
		<input name="classid" type="hidden" id="classid" value="<%=classid%>">
        <input name="name" type="text" id="name" value="<%=searchname%>" size="15">
        <input type="submit" name="Submit" value="提交">
      </TD></form>
  </TR>
</TABLE>
<br>
 <script language=JavaScript src="../inc/jsfun.asp"></script>
<table width="90%"  border="0" align="center" cellpadding="2" cellspacing="1" Class=TableBorder>
<form action="admin_log.asp" method="post">
  <tr> 
    <th width="86">用户</th>
    <th width="129">学校</th>
    <th width="116">时间</th>
    <th width="348">内容</th>
    <th width="35">选择</th>
  </tr>
  <%
if classid>0 and searchname<>"" then
sql="Select L.userid,L.classid,L.content,L.mgrdate,L.logid,C.classname from log L inner join class C on L.classid=C.classid where L.userid='"&searchname&"' and C.classid="&classid&" order by logid desc"  
else
sql="Select L.userid,L.classid,L.content,L.mgrdate,L.logid,C.classname from log L inner join class C on L.classid=C.classid order by logid desc"  
end if
Set rs=Server.CreateObject("ADODB.RecordSet") 
rs.Open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<tr><td colspan=""5"" class=forumrow>还没有任何日志！</td></tr>" 
else
page=1 '设置变量初始值PAGE=1
page=request.querystring("page")  'page值为接受值 
const PageSize = 20 '每页显示记录数
if Not IsEmpty(trim(Request("Page"))) then '如果PAGE已经初始化...
 Page = CInt(Request("Page")) '接收PAGE并化为数字型赋给PAGE变量    
    if Page > rs.PageCount then '如果接收的页数大于总页数
        rs.AbsolutePage = rs.PageCount '设置当前显示页等于最后页        
    elseif Page <= 0 then '如果page小于等于0
        Page = 1 '设置PAGE等于第一页
    else
        rs.AbsolutePage = Page '如果大于零,显示当前页等于接收的页数 
    end if
End if
Page = rs.AbsolutePage
dim i
i = 0
do while not rs.eof
%>
  <tr> 
    <td class=forumrow><a href=../Class_Userinfo.asp?Name=<%=rs(0)%>  title=个人资料 target=_blank><%=rs(0)%></a></td>
    <td class=forumrow><a href=../Class_index.asp?ClassID=<%=rs(1)%> title=进入该学校页面 target=_blank><%=rs(5)%></a></td>
    <td class=forumrow><%=rs(3)%></td>
    <td class=forumrow><%=rs(2)%></td>
    <td class=forumrow align=center><input type="checkbox" name="logid" value=<%=rs(4)%>></td>
  </tr>
  <%
i=i+1
	      if i>=PageSize then exit do
	      rs.movenext
	loop
  %>
  <tr> 
    <td colspan="5" Class=forumrowhighlight> 
      <div align="right"> 
        <%
	    dim n
  if rs.RecordCount mod pagesize=0 then
     n= rs.RecordCount \ pagesize
  else
     n= rs.RecordCount \ pagesize+1
  end if
  response.write " <table><tr><td>"
  if Page<2 then
    response.write "首页 | 上一页 | "
  else
    response.write "<a href="&filepath&"?name="&searchname&"&classid="&classid&"&page=1>首页</a> | "
    response.write "<a href="&filepath&"?name="&searchname&"&classid="&classid&"&page="&Page-1&">上一页</a> | "
  end if
  if n-page<1 then
    response.write "下一页 | 尾页"
  else
    response.write "<a href="&filepath&"?name="&searchname&"&classid="&classid&"&page="&(Page+1)&">"
    response.write "下一页</a> | <a href="&filepath&"?name="&searchname&"&classid="&classid&"&page="&n&">尾页</a>"
  end if
    response.write "&nbsp;共"&rs.RecordCount&"个"
    response.write " 转到第&nbsp;<select name=""page"" style=""width:35px"" onChange=""location.href='?name="&searchname&"&classid="&classid&"&page='+this.options[selectedIndex].value"">"
             dim ii
             ii=1
             do while ii<=n
             if ii=Page then
             response.write("<option selected value="&ii&">"&ii&"</option>")
             else
             response.write("<option value="&ii&">"&ii&"</option>")
             end if
             ii=ii+1
             loop
              
response.write "</select>"
 response.write " /"&n&"页 "
 response.write "&nbsp;&nbsp<input type=checkbox name=chkall onclick=""CheckAll(this.form)"">全选/取消&nbsp;&nbsp;<input type=submit value=删除日志 name=action class=button></td></tr></table>"
%></div></td>
  </tr>
  <%end if
    rs.close   
set rs=nothing
%>
</form>
</table>
<%
end sub
%>
</BODY></HTML>