?? usermanage.jsp
字號:
<%@ page contentType="text/html;charset=GBK" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="conn.jsp"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href=../css.css rel=STYLESHEET type=text/css>
</head>
<script>
function user(id) { window.open("viewuser.asp?user_id="+id,"","height=400,width=600,left=190,top=0,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");}
</script>
<%!
boolean IsInt(String NInt)
{
try {
int n;
n=Integer.parseInt(NInt);
return true;
}
catch(NumberFormatException e){
return false;
}
}
%>
<%
if(session.getAttribute("admin_name")==null){
;}else{
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#808080" height="77">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr bgcolor="688cb8">
<td width="7%" height="17" bgcolor="#808080">
<div align="center"><font color="#FFFFFF">ID</font></div>
</td>
<td width="9%" height="17" bgcolor="#808080">
<div align="center"><font color="#FFFFFF">用戶名</font></div>
</td>
<td width="14%" height="17" bgcolor="#808080">
<div align="center"><font color="#FFFFFF">E-mail </font></div>
</td>
<td width="11%" height="17" bgcolor="#808080">
<div align="center"><font color="#FFFFFF">郵政編碼</font></div>
</td>
<td width="18%" height="17" bgcolor="#808080">
<div align="center"><font color="#FFFFFF">地址</font></div>
</td>
<td width="11%" height="17" bgcolor="#808080">
<div align="center"><font color="#FFFFFF">注冊時間</font></div>
</td>
<td width="8%" height="17" bgcolor="#808080">
<div align="center"><font color="#FFFFFF">類型</font></div>
</td>
<td width="10%" height="17" bgcolor="#808080">
<div align="center"><font color="#FFFFFF">刪除</font></div>
</td>
<td width="12%" bgcolor="#808080" height="17">
<div align="center"><font color="#FFFFFF">升級成VIP</font></div>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<%
String mypage;
int intpage=1;
mypage=request.getParameter("page");
if(mypage=="")
intpage=1;
if(!IsInt(mypage))
intpage=1;
if(IsInt(mypage))
intpage=Integer.parseInt(mypage);
if(intpage<1)
intpage=1;
mypage=Integer.toString(intpage);
sql="select * from member order by user_id desc";
rs=mdb.executeQuery(sql);
if(!rs.next()){
%>
<td colspan="9">暫且沒有任何用戶注冊</td>
</tr>
<%}else{
int PageSize =20; //設(shè)置每張網(wǎng)頁顯示兩條記錄
int ShowPage = 1; //設(shè)置欲顯示的頁數(shù)
int RowCount = 0; //ResultSet的記錄數(shù)目
int PageCount = 0; //ResultSet分頁后的總頁數(shù)
int duoyu=0;
if(rs.next())
{
//建立ResultSet(結(jié)果集)對象,并執(zhí)行SQL語句
rs.last(); //將指標(biāo)移至最后一筆記錄
RowCount=rs.getRow();
duoyu=RowCount % PageSize;
if(duoyu==0)
{
PageCount=RowCount/PageSize;
}
else{
PageCount=(RowCount-duoyu)/PageSize;
PageCount++;
}
// PageCount=((RowCount % PageSize) == 0?(RowCount/PageSize) : (RowCount/PageSize)+1);
//計算顯示的頁數(shù)
//String ToPage = request.getParameter("ToPage");
//if(ToPage==""){ToPage="1";}
//判斷是否可正確取得ToPage參數(shù),
//可取得則表示JSP網(wǎng)頁應(yīng)顯示特定分頁記錄的語句
//if(ToPage!=""){
ShowPage=intpage; //取得指定顯示的分頁頁數(shù)
//下面的if語句將判斷用戶輸入的頁數(shù)是否正確
if(ShowPage>PageCount)
{ //判斷指定頁數(shù)是否大于總頁數(shù), 是則設(shè)置顯示最后一頁
ShowPage=PageCount;
}
else if(ShowPage<=0)
{ //若指定頁數(shù)小于0, 則設(shè)置顯示第一頁的記錄
ShowPage = 1;
}
}
rs.absolute((ShowPage - 1) * PageSize + 1);
int i=1;
rs.previous();
while(rs.next()&&i<=PageSize){
i++;
int user_id=rs.getInt("user_id");
String user_mail=rs.getString("user_mail");
String user_name=rs.getString("user_name");
String user_adds=rs.getString("user_adds");
String user_postcode=rs.getString("user_postcode");
Date user_regtime=rs.getDate("user_regtime");
String user_type=rs.getString("user_type");
%>
<tr bgcolor="#FFFFFF">
<td width="7%" height="15"><%=user_id%>
<div align="center"></div>
</td>
<td width="9%" height="15"><%=user_name%>
<div align="center"></div>
</td>
<td width="14%" height="15"><%=user_mail%>
<div align="center"></div>
</td>
<td width="11%" height="15"><%=user_postcode%>
<div align="center"></div>
</td>
<td width="18%" height="15">
<div align="center"><%=user_adds%></div>
</td>
<td width="11%" height="15"><%=user_regtime%> </td>
<td width="8%" height="15"><%=user_type%> </td>
<td width="10%" height="15">
<div align="center"><a href="viewuser.jsp?user_id=<%=user_id%>&action=deluser">刪除</a></div>
</td>
<td width="12%" height="15">
<div align="center"><a href="sheng.jsp?user_id=<%=user_id%>&action=up">升級</a>
</div>
</td>
</tr>
<%}
%>
<tr bgcolor="#FFFFFF" align="right">
<td colspan="9" height="2">
<p align="left">共<font color=red><%=PageCount%></font>頁 第<%=intpage%>頁
<font color=666666>
<%if(intpage-1>0){%>
<a href="usermanage.jsp?page=<%=intpage-1%>">上一頁</a>
<%}else{%>
<font color=666666>上一頁</font>
<%}%>
<%if(intpage+1<=PageCount){%>
<a href="usermanage.jsp?page=<%=intpage+1%>">下一頁</a>
<%}else{%>
<font color=666666>下一頁</font>
<%}%>
</font></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%
}
mdb.Close();}
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -