⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chklogin.jsp

📁 新闻发布系统源代码 可以作为网站的模板
💻 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 + -