checklogin.jsp

来自「毕业设计时做的,一个管理关于污染管理的, 源代码,呵呵 想想当时还真厉害,可以」· JSP 代码 · 共 33 行

JSP
33
字号
<HTML>
<BODY>
<%@ page import="java.sql.*"
	contentType="text/html;charset=GB2312" %>
<jsp:useBean id="pool" scope="application" class="chapter10.ConnPool"/>
<%boolean success=true;
boolean disable=false;
String name=new String(request.getParameter("name").getBytes("ISO8859_1"),"GBK");
String password=new String(request.getParameter("password").getBytes("ISO8859_1"),"GBK");%>
<%@ include file="conn.jsp"%>  
<%sql="select * from Users where Name='"+name+"' and Password='"+password+"'";
  ResultSet rs =statement.executeQuery(sql);
  if (rs.next()){
  	disable=rs.getBoolean("Disable");
  	if (disable) {success=false;}
  }else{
  	success=false;
  }
%>
<%@ include file="disconn.jsp"%>  
<%if (success){
	session.setAttribute("Name",name);
	response.sendRedirect("list.jsp");
}else if (disable){%>
该用户已经被禁用!
<%}else{%>
用户名或密码有误,请重新登录!
<%}%>
<a href="javascript:history.back();">返回</a>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?