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

📄 admin.jsp

📁 基于jsp的网络百宝箱
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GB18030" import="java.sql.*,java.util.Date,java.io.*"%>
<%@ include file="config.ini"%>
<%@ include file="conn.jsp"%>
<%@ include file="admin_readlogin.jsp"%>
<jsp:useBean id="iCanDipage" class="com.iCan.DipageBean" scope="page" />
<%
    iCanDipage.setCountPageRecord(recordsPerPage);
%>
<%
ResultSet rs2=iCanDb.doSelect(sqlstr);
%>

<html>

<head>
<%@ include file="head.jsp"%>
</head>

<body>
<center>
<table border="0" width="760" id="table1" cellspacing="0" cellpadding="0">
<tr><td> 
<%@ include file="admin_top.jsp"%>
	</td>

	</tr>
	<tr>
		<td><table border="0" width="100%" id="table8" cellspacing="0" cellpadding="0">
									<tr>
										<td>
										<form method="POST" target="_top" action="admin.jsp" name="form2">
											<p align="right">
											<span style="font-size: 9pt">用户名:<input type="text" name="key" size="14" style="border: 1px solid #0A9EE4">&nbsp;&nbsp;&nbsp;&nbsp;
											<input type="submit" value="搜索" name="B1" style="border: 1px solid #0A9EE4">&nbsp;&nbsp;&nbsp;
											</span></p>
										</form>
										</td>
									</tr>
								</table></td>
	</tr>
	<tr>
		<td height="19"><font color="#0279E3">
		<span style="font-size: 9pt; font-weight: 700"> 
		各用户通讯录、记事本、收藏夹所拥有的记录数和储藏箱占用空间情况统计如下:</span></font></td>
	</tr>
	<tr>
		<td>
		<table border="1" width="760" id="table2" bordercolorlight="#3399FF" cellspacing="0" cellpadding="2" bordercolordark="#FFFFFF">
			<tr>
				<td width="82" align="center">
				<font color="#3399FF">
				<span style="font-size: 9pt; font-weight: 700">注册日期</span></font></td>
				<td width="131" align="center">
				<p align="center"><font color="#3399FF">
				<span style="font-size: 9pt; font-weight: 700">用户名</span></font></td>
				<td width="52" align="center"><font color="#3399FF">
				<span style="font-size: 9pt; font-weight: 700">通讯录</span></font></td>
				<td width="52" align="center"><font color="#3399FF">
				<span style="font-size: 9pt; font-weight: 700">记事本</span></font></td>
				<td width="53" align="center"><font color="#3399FF">
				<span style="font-size: 9pt; font-weight: 700">收藏夹</span></font></td>
				<td width="53" align="center"><font color="#3399FF">
				<span style="font-size: 9pt; font-weight: 700">储藏箱</span></font></td>
				<td align="center" width="164"><font color="#3399FF">
				<span style="font-size: 9pt; font-weight: 700">email</span></font></td>
				<td align="center" width="90"><font color="#3399FF">
				<span style="font-weight: 700; font-size: 9pt">QQ</span></font></td>
				<td align="center" width="71">
				<p align="center"><font color="#3399FF">
				<span style="font-size: 9pt; font-weight: 700">操作</span></font></td>
			</tr>
<%
  //获取管理员提交的要查询的用户的id
  String keyword=codeToString(request.getParameter("key"));
  sqlstr="select * from users";
  if(keyword!=null)
  {sqlstr=sqlstr+" where username like '%"+keyword.trim()+"%'";}
  //根据提交的用户名查询得到结果集
  rs=iCanDb.doSelect(sqlstr);
  if(rs.next())
  {
    rs.last();
    int userscount=rs.getRow();
    rs.beforeFirst();
    //将结果集分页显示
    iCanDipage.setCountRecord(userscount);
    String pages=request.getParameter("dipage");
    if(iCanDipage.isFirstPage(pages))
       rs.beforeFirst();
    else
      rs.absolute(iCanDipage.getAbsoluteLocation());
    int dipagei=0;
    //遍历结果集,得到记录中的字段
    while(rs.next())
     {
      String id=rs.getString("id");
      String username=rs.getString("username");
      String qq=rs.getString("qq");
      String email=rs.getString("email");
      Date datetemp1=rs.getDate("date");
      java.text.SimpleDateFormat datetemp2=new java.text.SimpleDateFormat("yyyy-MM-dd");   
      String date=datetemp2.format(datetemp1);
      //根据用户id查询记录本中的记录个数
      int notecount=0;
      sqlstr="select id from note1 where user='"+id+"'";
      rs2=iCanDb.doSelect(sqlstr);
      if(rs2.next())
      {
        rs2.last();
        notecount=rs2.getRow();
      }
      //根据用户id查询通讯录中的联系人的个数
      int listcount=0;
      sqlstr="select id from list where user='"+id+"'";
      rs2=iCanDb.doSelect(sqlstr);
      if(rs2.next())
      {
        rs2.last();
        listcount=rs2.getRow();
      }
  //根据用户id查询收藏夹中的收藏信息的个数
  int favcount=0;
  sqlstr="select id from fav where user='"+id+"'";
  rs2=iCanDb.doSelect(sqlstr);
  if(rs2.next())
  {
    rs2.last();
    favcount=rs2.getRow();
  }
//获取用户储藏箱中的文件的个数
int boxcount=0;
long userBoxSize=0;
String iCanroot=dirPath.replace('\\','/');
File userBox=new File(iCanroot+"box/"+id);
File userBoxfile[]=userBox.listFiles();
if(userBoxfile.length>0)
{
  for(int i=0;i<userBoxfile.length;i++)
  {
    if(userBoxfile[i].isFile())
    {
      userBoxSize=userBoxSize+userBoxfile[i].length();
    }
  }
  boxcount=(int)userBoxSize/1024/1024;
}
%>
			<tr>
				<td width="82" align="center"><span style="font-size: 9pt"><%=date%></span></font></td>
				<td width="131" align="center"><span style="font-size: 9pt"><%=username%></span></td>
				<td width="52" align="center"><span style="font-size: 9pt"><%=listcount%></span></td>
				<td width="52" align="center"><span style="font-size: 9pt"><%=notecount%></span></td>
				<td width="53" align="center"><span style="font-size: 9pt"><%=favcount%></span></td>
				<td width="53" align="center"><span style="font-size: 9pt"><%=boxcount%>mb</span></td>
				<td align="center" width="164"><span style="font-size: 9pt">&nbsp;<%=email%></span></td>
				<td align="center" width="90"><span style="font-size: 9pt">&nbsp;<%=qq%></span></td>
				<td align="center" width="71"><font color="#3399FF">
				<span style="font-size: 9pt">
				<a target="_top" href="admin_del.jsp?action=confirm&id=<%=id%>"><font color="#3399FF">删除</font></a></span></font></td>
			</tr>
<%
        dipagei++;
        if(dipagei>=iCanDipage.getCountPageRecord()) break; //当前页显示完,则退出循环
    }
%>
</table><table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0" style="font-size: 9pt; font-family: 宋体" height="20">
<tr><td width="100%" valign="bottom">
<%
iCanDipage.showDipageBar("admin.jsp",out);
%></td></tr></table>
<%
  }
  else
  {
%>
			<tr>
				<td width="728" align="center" colspan="9">
				<p align="left"><span style="font-size: 9pt">&nbsp; 暂无记录</span></td>
			</tr></table>
<%
}
%>
		</td>
	</tr>
	<tr>
		<td>
		 </td>
	</tr>
	<tr>
		<td>
		<p align="center"><input type="button" value="返回" name="B2" style="border: 1px solid #156FC7" onclick="javascript:location.href='admin.jsp';"></td>
	</tr>
	<tr>
		<td> </td>
	</tr>
	<tr>
		<td><%@ include file="copyright.jsp"%></td>
	</tr>
</table>
</center>
</body>

</html>

⌨️ 快捷键说明

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