JAVAEE-based-parking-manage.../tingchechang/WebContent/dengluchuli.jsp

55 lines
1.9 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030" import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="guanli" class="com.DB" scope="page" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
String username=new String(request.getParameter("username").getBytes("ISO-8859-1"),"GB18030");
String password=new String(request.getParameter("password").getBytes("ISO-8859-1"),"GB18030");
String quanxian=new String(request.getParameter("quanxian").getBytes("ISO-8859-1"),"GB18030");
Connection con=guanli.getCon();
if(quanxian.equals("管理员")){
String sql="select * from login where username='"+username+"' and password='"+password+"'";
ResultSet rs=guanli.GetRs(sql);
if(rs.next()){
//session.setAttribute("jibie",""+quanxian+"");
session.setAttribute("guanliyuan",""+username+"");
out.println("<script lanage='javascript'>alert('登录成功');window.location.href='admin/index.jsp';</script>");
}
else{
out.println("<script lanage='javascript'>alert('登陆错误,请核实用户名和密码是否输入正确,重新输入');javascript:history.go(-1);</script>");
}
guanli.closed();
}
if(quanxian.equals("用户")){
String sql="select * from reg where username='"+username+"' and password='"+password+"'";
ResultSet rs=guanli.GetRs(sql);
if(rs.next()){
//session.setAttribute("bianhao",""+rs.getString("bianhao")+"");
session.setAttribute("ck",""+username+"");
out.println("<script lanage='javascript'>alert('登录成功');window.location.href='huiyuan/h_index.jsp';</script>");
}
else{
out.println("<script lanage='javascript'>alert('登陆错误,请核实用户名和密码是否输入正确,重新输入');javascript:history.go(-1);</script>");
}
guanli.closed();
}
%>
</body>
</html>