【JSP开源代码栏目提醒】:网学会员为广大网友收集整理了,vote_login.jsp,希望对大家有所帮助!
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.
sql.*" errorPage="" %>
<%request.setCharacterEncoding("gb2312");%>
<%@ include file="../Connections/myeshop.jsp" %>
<%
// *** Validate request to log in to this site.
String MM_LoginAction = request.getRequestURI();
if (request.getQueryString() != null && request.getQueryString().length() > 0) {
String queryString = request.getQueryString();
String tempStr = "";
for (int i=0; i < queryString.length(); i++) {
if (queryString.charAt(i) == '<') tempStr = tempStr + "<";
else if (queryString.charAt(i) == '>') tempStr = tempStr + ">";
else if (queryString.charAt(i) == '"') tempStr = tempStr + """;
else tempStr = tempStr + queryString.charAt(i);
}
MM_LoginAction += "?" + tempStr;
}
String MM_valUsername=request.getParameter("username");
if (MM_valUsername != null) {
String MM_fldUserAuthorization="";
String MM_redirectLoginSuccess="vote_admin.jsp";
String MM_redirectLoginFailed="vote.jsp";
String MM_redirectLogin=MM_redirectLoginFailed;
Driver MM_driverUser = (Driver)Class.forName(MM_myeshop_DRIVER).newInstance();
Connection MM_connUser = DriverManager.getConnection(MM_myeshop_STRING,MM_myeshop_USERNAME,MM_myeshop_PASSWORD);
String MM_pSQL = "SELECT username, Password";
if (!MM_fldUserAuthorization.equals("")) MM_pSQL += "," + MM_fldUserAuthorization;
MM_pSQL += " FROM admins WHERE username=\'" + MM_valUsername.replace('\'', ' ') + "\' AND Password=\'" + request.getParameter("password").toString().replace('\'', ' ') + "\'";
PreparedStatement MM_statementUser = MM_connUser.prepareStatement(MM_pSQL);
ResultSet MM_rsUser = MM_statementUser.executeQuery();
boolean MM_rsUser_isNotEmpty = MM_rsUser.next();
if (MM_rsUser_isNotEmpty) {
// username and pass
word match - this is a valid user
session.putValue("MM_Username", MM_valUsername);
if (!MM_fldUserAuthorization.equals("")) {
session.putValue("MM_UserAuthorization", MM_rsUser.getString(MM_fldUserAuthorization).trim());
} else {
session.putValue("MM_UserAuthorization", "");
}
if ((request.getParameter("accessdenied") != null) && false) {
MM_redirectLoginSuccess = request.getParameter("accessdenied");
}
MM_redirectLogin=MM_redirectLoginSuccess;
}
MM_rsUser.close();
MM_connUser.close();
response.sendRedirect(response.encodeRedirectURL(MM_redirectLogin));
return;
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>
网络投票--版主登入</title>
<script language="JavaScript" type="text/
JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<style type="text/css">
<!--
.bluebox { border: 1px solid #000099;
}
.box { border: 3px double #DD127B;
margin: 0px;
}
.style1 {color: #000099}
.bluebox1 {border: 1px solid #0B85C4;
margin: 0px 0px 2px;
padding: 0px;
}
.style11 {font-size: 30pt;
font-weight: bold;
}
.style10 {color: #FFFFFF; font-size: 18px; }
.style11 {color: #0066CC}
.style3 {font-size: 30pt; font-weight: bold; color: #DE137C; }
-->
</style>
</head>
<body>
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center" valign="top" >
<td height="50" colspan="3"><img name="" src="images/table_top.jpg" width="810" height="50" alt=""></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="54" height="135" align="left" valign="top" bgcolor="#BADB80"><img name="" src="images/table_lu.gif" width="50" height="130" alt=""></td>
<td valign="middle" bgcolor="#BADB80"><div align="center">
<table border="3" cellspacing="2" cellpadding="0">
<tr>
<td width="687"><img src="images/Vote_title.jpg" width="680" height="110" border="0" align="absmiddle" class="box"></td>
</tr>
</table>
</div></td>
<td width="53" align="right" valign="top" bgcolor="#BADB80"><img name="" src="images/table_ru.gif" width="50" height="130" alt=""></td>
</tr>
<tr bgcolor="#BADB80">
<td width="54"> </td>
<td rowspan="2" valign="top" bgcolor="#BADB80"><table width="99%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#0B85C4">
<tr bordercolor="#0B85C4" bgcolor="#FFFFFF" class="blueb