📄 adminlogin.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="Connections/conn.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("a_logname");
if (MM_valUsername != null) {
String MM_fldUserAuthorization="";
String MM_redirectLoginSuccess="adminFrameset.jsp";
String MM_redirectLoginFailed="a_filein.jsp";
String MM_redirectLogin=MM_redirectLoginFailed;
Driver MM_driverUser = (Driver)Class.forName(MM_conn_DRIVER).newInstance();
Connection MM_connUser = DriverManager.getConnection(MM_conn_STRING,MM_conn_USERNAME,MM_conn_PASSWORD);
String MM_pSQL = "SELECT a_logname, a_password";
if (!MM_fldUserAuthorization.equals("")) MM_pSQL += "," + MM_fldUserAuthorization;
MM_pSQL += " FROM dbo.admin WHERE a_logname=\'" + MM_valUsername.replace('\'', ' ') + "\' AND a_password=\'" + request.getParameter("a_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 password 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;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>管理员登录</title>
<STYLE>
#Layer1 {
Z-INDEX: 1;
WIDTH: 118px;
POSITION: absolute;
HEIGHT: 28px
}
body {
}
</STYLE></head>
<body>
<table style="FONT-SIZE: 14px; COLOR: #323229" width="778" border="1" cellpadding="0" cellspacing="1" bordercolor="#FFFCDF">
<tr>
<td valign="top"><table width="213" border="1" cellpadding="0" cellspacing="0" bordercolor="#B98631">
<tr>
<th align="left" bgcolor="#B98631" scope="col"> <span class="STYLE1">管理员登录页面</span></th>
</tr>
<tr>
<td align="center"><a href="index.jsp">[返回首页]</a></td>
</tr>
</table></td>
<td valign="top"><table width="565" border="1" cellpadding="0" cellspacing="0" bordercolor="#B98631">
<tr>
<th align="left" bgcolor="#B98631" scope="col"> <span class="STYLE1">管理员信息</span></th>
</tr>
<tr>
<td><form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> 管理员ID</td>
<td><label>
<input type="text" name="a_logname" />
</label></td>
</tr>
<tr>
<td> 管理密码</td>
<td><label>
<input type="password" name="a_password" />
</label></td>
</tr>
<tr>
<td align="center"><label>
<input type="submit" name="Submit" value="提交" />
</label></td>
<td align="center"><label>
<input type="reset" name="Submit2" value="重置" />
</label></td>
</tr>
</table>
</form>
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -