📄 chklogin.jsp
字号:
<div align="left">
<%@ page contentType="text/html;charset=gb2312"%> <%@include file="../incoming/Common.jsp"%> <%@include file="../incoming/ConnectDB.jsp"%> </div><%
String username = request.getParameter("username");
String password = request.getParameter("password");
String loginmsg;
sql1 = "SELECT * FROM Manager WHERE ManagerID='"+username+"' AND Password='"+password+"'";
rs1 = smt1.executeQuery(sql1);
if (!rs1.next())
{
loginmsg="userwrong";
response.sendRedirect("login.jsp?loginmsg="+loginmsg);
return;
}
sql2 = "UPDATE Manager SET LoginNum=LoginNum+1 WHERE ManagerID=?";
PreparedStatement prepstmt = null;
prepstmt=con.prepareStatement(sql2);
prepstmt.setBytes(1,username.getBytes("GB2312"));
prepstmt.executeUpdate();
request.getSession(true);
session.putValue("IsLogin","true");
session.putValue("UserName",username);
if(username.equals("root"))
{
response.sendRedirect("RootMain.jsp");
}
else
{
sql2 = "SELECT CategoryID FROM Manager WHERE ManagerID='"+username+"'";
rs2 = smt1.executeQuery(sql2);
rs2.next();
response.sendRedirect("Main.jsp?categoryid="+rs2.getInt("CategoryID"));
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -