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

📄 syslog.jsp

📁 考试系统 软件功能涉及网上考试、作业、练习、在线监考、在线批卷、成绩排行、调查问卷、发布公告等管理的各方面。
💻 JSP
字号:
<%@ page session="true" buffer="none" contentType="text/html; charset=GB2312" import="java.sql.*,java.util.*,java.lang.*,net.xerllent.campus.util.*,net.xerllent.campus.database.*,net.xerllent.campus.sysadmin.*" %>
<%
  security.checkAuth(session,"Id",response,request);
  int AuthLevel=security.getAuthLevel(session,"Id");
%>
<%
//得到用户所选的查询条件值
String logtime=ParamUtils.getParameter(request,"selectlogtime","*");
String username=ParamUtils.getParameter(request,"textusername","");
//检查是否有删除标志,如有则删除该条记录
if(ParamUtils.getParameter(request,"ondelete","0").equals("1")){
  if(AuthLevel<3){
    response.sendRedirect("/prog/nopermission.jsp");
  }else{
    int count=ParamUtils.getIntParameter(request,"recordcount",10);
    Connection conn=DbConnectionManager.getConnection();
    Statement sta=conn.createStatement();
    for(int i=0;i<count;i++){
      if(ParamUtils.getParameter(request,"deletechk"+i)!=null){
        int systemlogid=ParamUtils.getIntParameter(request,"deletechk"+i,0);
        sta.executeUpdate("delete from act_systemlog where SystemLogID='"+systemlogid+"'");
        int LogID=0;
        if(session.getAttribute("LogID")!=null)
          LogID=((Integer)session.getAttribute("LogID")).intValue();
        security.recordAction(LogID,"删除日志记录");
      }
    }
    sta.close();
    conn.close();
  }
}

    //显示所有的日志信息,并分页显示之
  String str="";
  int currentRecord=0;            //记录的当前位置
  int pagecolorint=0;             //记录页面颜色的交替显示顺序
  String PageColor=new String();  //页面显示的颜色
  Calendar cal=Calendar.getInstance();
  CString cstring=new CString();
  String nowstr=cstring.getDateTimeString(cal.getTime());
  String sqlstr="select SystemLogID,LogUser,LogIP,LogTime,LogOffTime,Action from act_systemlog,act_user where act_user.UserID=act_systemlog.LogUser";

  if(ParamUtils.getParameter(request,"onseek")!=null&&ParamUtils.getParameter(request,"onseek").equals("1")){
    sqlstr+=" and act_user.UserTrueName like '%"+ParamUtils.getParameter(request,"textusername","")+"%'";
  }
  if(!logtime.equals("*")){
    cal.add(Calendar.DATE,-Integer.parseInt(logtime));
    String timestr=cstring.getDateString(cal.getTime());
    sqlstr+=" and LogTime>='"+timestr+"'";
  }
  sqlstr+=" order by LogTime desc";

  DbQuery myQuery=new DbQuery ();
  myQuery.setPageSize(request);
  myQuery.setCurrentPage(request) ;
  myQuery._currentPageURL="";
  myQuery.setHidden("selectlogtime",logtime);
  myQuery.setHidden("textusername",username);
  myQuery.prepareStatement(sqlstr);
  myQuery.executeQuery();

%>
<html>
<head>
<title>校园.NET</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312; no-cache">
<meta http-equiv="Expires"  content="Mon,04 Dec 1980 11:11:11 GMT">
<script src="../../jscript/floatPanel.js"></script>
<script>

//js函数将所有的checkbox都选中
function delchkAllItem()
{
  var count;
  count=form1.recordcount.value;
  if(form1.deletechk.checked==true)
  {
    for(i=0;i<count;i++)
    {
      eval("form1.deletechk"+i+".checked=true");
    }
  }
  else
  {
    for(i=0;i<count;i++)
    {
      eval("form1.deletechk"+i+".checked=false");
    }
  }
}

//确认函数,是否真要删除记录

function checkit()
{
  if(confirm("删除该日志信息,确认要删除吗?"))
  {
     form1.ondelete.value="1";
     form1.submit();
  }
}

//提醒输入查询条件

function seekuser()
{
  if(form2.textusername.value=="")
  {
    alert("请输入查询条件!");
    return;
  }
  form2.onseek.value="1";
  form2.submit();
}

</script>
<link rel="stylesheet" href="../../images/campus.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0">
<table width="100%" height="22" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td ></td>
    </tr>
</table>

<DIV id=floater style="LEFT: 0px; TOP: 0px">
  <table width="100%" class="gl_mainBar" height="22" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="200" nowrap>【系统管理-系统日志】</td>
      <td align="right" nowrap>
        <input type="button" name="Submit1" value="删 除" class="button1" onClick="checkit()" <%if(AuthLevel<3){out.print("disabled");}%>>
        <input type="button" name="Submit2" value="恢 复" class="button1" onClick="form1.reset()">
      </td>
      <td width="10">&nbsp;</td>
    </tr>
  </table>
</DIV>
<%
%>
<form name="form2" action="syslog.jsp" method=post class="form">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" height="40" class="f90">
    <tr>
      <td width="128" background="../../images/ModIco_System.gif" nowrap valign="bottom" align="right"><font size="3"><b>系统日志</b></font></td>
      <td align="right" nowrap> 登陆时间
        <select name="selectlogtime" class="input1" onchange="form2.submit()">
          <option value="0" <% if(logtime.equals("0")) { %>selected<% } %>>今天</option>
          <option value="7" <% if(logtime.equals("7")) { %>selected<% } %>>1星期内</option>
          <option value="30" <% if(logtime.equals("30")) { %>selected<% } %>>1月内</option>
          <option value="*" <% if(logtime.equals("*")) { %>selected<% } %>>所有</option>
        </select> 用户
        <input type="text" name="textusername" class="input1">
        <input type="button" name="seekbutton" value="查 询" class="button1" onclick="seekuser();">
        <input type="hidden" name="onseek" value="0">
      </td>
      <td align="right" width="10">&nbsp;</td>
    </tr>
  </table>
</form>
<%myQuery.printPageBooter(out);%>
    <form name='form1' action='' class='form' method=post>
      <table width='90%' border='0' cellspacing='0' cellpadding='0' class='f90' align='center'>
        <tr>
          <td width='30' height='20' class='gl_tdBar'>
              <input type='checkbox' name='deletechk' value='checkbox' onclick='delchkAllItem();'>
          </td>
          <td class='gl_tdBar' nowrap>用户姓名</td>
          <td class='gl_tdBar' nowrap>登陆帐号</td>
          <td class='gl_tdBar' nowrap >登陆IP</td>
          <td class='gl_tdBar' nowrap>登陆时间</td>
          <td class='gl_tdBar' nowrap>注销时间</td>
          <td class='gl_tdBar' width='120' >执行操作</td>
        </tr>
    <%
      ResultSet rs = myQuery.getResultSet();
      int recordcount=0;
      if(rs!=null)  {
     //循环显示所有查询出来的结果
    for(int i=0;i<myQuery._pageSize;i++){
        if(pagecolorint==0){
        PageColor="gl_tdColor1";
        pagecolorint=1;
        }
        else{
        PageColor="gl_tdColor2";
        pagecolorint=0;
        }
        str=("<tr><td align='center' width=30 class='"+PageColor+"'>");
        str+="<input type='checkbox' name=\"";
        str+="deletechk"+i;
        str+="\" value='"+rs.getInt("SystemLogID")+"'>";
        str+=("</td><td  class='"+PageColor+"'>");
        out.println(str) ;

        str="<a href='../UserUpdate.jsp?UserID="+rs.getInt("LogUser")+"'>" ;
        str+=User.getUserTrueName(rs.getInt("LogUser")) ;
        str+="</a>";
        str+=("</td><td  class='"+PageColor+"'>") ;
        out.println(str) ;

        str=User.getUserName(rs.getInt("LogUser")) ;
        str+=("</td><td  class='"+PageColor+"'>");
        out.println(str) ;

        str=rs.getString("LogIP");
        str+=("</td><td  class='"+PageColor+"'>");
        out.println(str) ;

        str=rs.getString("LogTime");
        str+=("</td><td  class='"+PageColor+"'>");
        out.println(str) ;

        str=rs.getString("LogOffTime");
        str+=("</td><td  class='"+PageColor+"'>");
        out.println(str) ;

        str="<a href='javascript:  window.showModalDialog(\"actionlog.jsp?logid="+rs.getInt("SystemLogID")+"\",1,\"dialogWidth:280px;dialogHeight:410px\");'>" ;
        str+=rs.getString("Action").substring(0,20)+"<br>"+rs.getString("Action").substring(20,28)+"……";
        str+=("</a></td></tr>");

        out.println(str) ;
        recordcount++;
        if(!rs.next()){
          break;
        }
    }
  }
  myQuery.close();
    %>
     <tr>
      <td width='30' height='20' class='gl_tdBar'>&nbsp删 </td>
      <td class='gl_tdBar' nowrap>用户姓名</td>
      <td class='gl_tdBar' nowrap>登陆帐号</td>
      <td class='gl_tdBar' nowrap >登陆IP</td>
      <td class='gl_tdBar' nowrap>登陆时间</td>
      <td class='gl_tdBar' nowrap>注销时间</td>
      <td class='gl_tdBar' width='120'>执行操作</td>
     </tr>
    </table>
    <input type='hidden' name='ondelete' value="0">
    <input type='hidden' name='recordcount' value=<%=recordcount%>>
  </form>
<%myQuery.printPageFooter(out);%>
</body>
</html>

⌨️ 快捷键说明

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