【JSP开源代码栏目提醒】:网学会员为广大网友收集整理了,adminzone.jsp,希望对大家有所帮助!
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<% request.setCharacterEncoding("gb2312"); %>
<%
// *** Logout the current user.
String MM_Logout = request.getRequestURI() + "?MM_Logoutnow=1";
if (request.getParameter("MM_Logoutnow") != null && request.getParameter("MM_Logoutnow").equals("1")) {
session.putValue("MM_Username", "");
session.putValue("MM_UserAuthorization", "");
String MM_logoutRedirectPage = "member.jsp";
// redirect with URL parameters (remove the "MM_Logoutnow" query param).
if (MM_logoutRedirectPage.equals("")) MM_logoutRedirectPage = request.getRequestURI();
if (MM_logoutRedirectPage.indexOf("?") == -1 && request.getQueryString() != null) {
String MM_newQS = request.getQueryString();
String URsearch = "MM_Logoutnow=1";
int URStart = MM_newQS.indexOf(URsearch);
if (URStart >= 0) {
MM_newQS = MM_newQS.substring(0,URStart) + MM_newQS.substring(URStart + URsearch.length());
}
if (MM_newQS.length() > 0) MM_logoutRedirectPage += "?" + MM_newQS;
}
response.sendRedirect(response.encodeRedirectURL(MM_logoutRedirectPage));
return;
}
%>
<%@ include file="../Connections/myeshop.jsp" %>
<%
// *** Restrict Access To Page: Grant or deny access to this page
String MM_authorizedUsers="";
String MM_authFailedURL="admin_login.jsp";
boolean MM_grantAccess=false;
if (session.getValue("MM_Username") != null && !session.getValue("MM_Username").equals("")) {
if (true || (session.getValue("MM_UserAuthorization")=="") ||
(MM_authorizedUsers.indexOf((String)session.getValue("MM_UserAuthorization")) >=0)) {
MM_grantAccess = true;
}
}
if (!MM_grantAccess) {
String MM_qsChar = "?";
if (MM_authFailedURL.indexOf("?") >= 0) MM_qsChar = "&";
String MM_referrer = request.getRequestURI();
if (request.getQueryString() != null) MM_referrer = MM_referrer + "?" + request.getQueryString();
MM_authFailedURL = MM_authFailedURL + MM_qsChar + "accessdenied=" + java.net.URLEncoder.encode(MM_referrer);
response.sendRedirect(response.encodeRedirectURL(MM_authFailedURL));
return;
}
%>
<%
Driver Driverrecmlist = (Driver)Class.forName(MM_myeshop_DRIVER).newInstance();
Connection Connrecmlist = DriverManager.getConnection(MM_myeshop_STRING,MM_myeshop_USERNAME,MM_myeshop_PASSWORD);
PreparedStatement Statementrecmlist = Connrecmlist.prepareStatement("SELECT * FROM memdata ORDER BY m_joindate DESC");
ResultSet recmlist = Statementrecmlist.executeQuery();
boolean recmlist_isEmpty = !recmlist.next();
boolean recmlist_hasData = !recmlist_isEmpty;
Object recmlist_data;
int recmlist_numRows = 0;
%>
<%
int Repeat1__numRows = 10;
int Repeat1__index = 0;
recmlist_numRows += Repeat1__numRows;
%>
<%
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
int recmlist_first = 1;
int recmlist_last = 1;
int recmlist_total = -1;
if (recmlist_isEmpty) {
recmlist_total = recmlist_first = recmlist_last = 0;
}
//set the number of rows displayed on this page
if (recmlist_numRows == 0) {
recmlist_numRows = 1;
}
%>
<%
// *** Recordset Stats: if we don't know the record count, manually count them
if (recmlist_total == -1) {
// count the total records by iterating through the recordset
for (recmlist_total = 1; recmlist.next(); recmlist_total++);
// reset the cursor to the beginning
recmlist.close();
recmlist = Statementrecmlist.executeQuery();
recmlist_hasData = recmlist.next();
// set the number of rows displayed on this page
if (recmlist_numRows < 0 || recmlist_numRows > recmlist_total) {
recmlist_numRows = recmlist_total;
}
// set the first and last displayed record
recmlist_first = Math.min(recmlist_first, recmlist_total);
recmlist_last = Math.min(recmlist_first + recmlist_numRows - 1, recmlist_total);
}
%>
<% String MM_paramName = ""; %>
<%
// *** Move To Record and Go To Record: declare variables
ResultSet MM_rs = recmlist;
int MM_rsCount = recmlist_total;
int MM_size = recmlist_numRows;
String MM_uniqueCol = "";
MM_paramName = "";
int MM_offset = 0;
boolean MM_atTotal = false;
boolean MM_paramIsDefined = (MM_paramName.length() != 0 && request.getParameter(MM_paramName) != null);
%>
<%
// *** Move To Record: handle 'index' or 'offset' parameter
if (!MM_paramIsDefined && MM_rsCount != 0) {
//use index parameter if defined, otherwise use offset parameter
String r = request.getParameter("index");
if (r==null) r = request.getParameter("offset");
if (r!=null) MM_offset = Integer.parseInt(r);
// if we have a record count, check if we are past the end of the recordset
if (MM_rsCount != -1) {
if (MM_offset >= MM_rsCount || MM_offset == -1) { // past end or move last
if (MM_rsCount % MM_size != 0) // last page not a full repeat region
MM_offset = MM_rsCount - MM_rsCount % MM_size;
else
MM_offset = MM_rsCount - MM_size;
}
}
//move the cursor to the selected record
int i;
for (i=0; recmlist_hasData && (i < MM_offset || MM_offset == -1); i++) {
recmlist_hasData = MM_rs.next();
}
if (!recmlist_hasData) MM_offset = i; // set MM_offset to the last possible record
}
%>
<%
// *** Move To Record: if we dont know the record count, check the display range
if (MM_rsCount == -1) {
// walk to the end of the display range for this page
int i;
for (i=MM_offset; recmlist_hasData && (MM_size < 0 || i < MM_offset + MM_size); i++) {
recmlist_hasData = MM_rs.next();
}
// if we walked off the end of the recordset, set MM_rsCount and MM_size
if (!recmlist_hasData) {
MM_rsCount = i;
if (MM_size < 0 || MM_size > MM_rsCount) MM_size = MM_rsCount;
}
// if we walked off the end, set the offset based on page size
if (!recmlist_hasData && !MM_paramIsDefined) {
if (MM_offset > MM_rsCount - MM_size || MM_offset == -1) { //check if past end or last
if (MM_rsCount % MM_size != 0) //last page has less records than MM_size
MM_offset = MM_rsCount - MM_rsCount % MM_size;
else
MM_offset = MM_rsCount - MM_size;
}
}
// reset the cursor to the beginning
recmlist.close();
recmlist = Statementrecmlist.executeQuery();
recmlist_hasData = recmlist.next();
MM_rs = recmlist;
// move the cursor to the selected record
for (i=0; recmlist_hasData && i < MM_offset; i++) {
recmlist_hasData = MM_rs.next();
}
}
%>
<%
// *** Move To Record: update recordset stats
// set the first and last displayed record
recmlist_first = MM_offset + 1;
recmlist_last = MM_offset + MM_size;
if (MM_rsCount != -1) {
recmlist_first = Math.min(recmlist_first, MM_rsCount);
recmlist_last = Math.min(recmlist_last, MM_rsCount);
}
// set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount != -1 && MM_offset + MM_size >= MM_rsCount);
%>
<%
// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
String MM_keepBoth,MM_keepURL="",MM_keepForm="",MM_keepNone="";
String[] MM_removeList = { "ind
上一篇:
adminview.jsp
下一篇:
计算机毕业论文答辩2014年