user_deal.jsp

来自「JSPshop JSPshop JSPshop」· JSP 代码 · 共 47 行

JSP
47
字号
<%@ page contentType="text/html; charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="db" class="wssd.connectDB" />
<%
	String name = request.getParameter("user");
	String psw = request.getParameter("psw");
	ResultSet rs = null;
	try
	{
		String sql = "select * from wssd_adminuser where username = '"+name+"' and password = '"+psw+"'";
		rs = db.executeQuery(sql);
		if(rs.next())
		{
			session.setAttribute("adminname",name);
			session.setAttribute("priority",rs.getString("priority"));
		}
		else
		{
			session.removeAttribute("adminname");
			session.removeAttribute("priority");
		}
		%>
		<script language="javascript">
			top.location.href="index.html";
		</script>
		<%		
	}
	catch(Exception e)
	{
		session.setAttribute("error","1");
		session.removeAttribute("adminname");
		session.removeAttribute("priority");
	}
	finally
	{
		try
		{
			db.closeDB();
			rs.close();
		}
		catch(Exception ee)
		{
			session.setAttribute("error","1");
			session.removeAttribute("username");
			session.removeAttribute("priority");
		}
	}
%>

⌨️ 快捷键说明

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