📄 load1.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" import="java.sql.*,java.io.*"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>管理员登陆</title>
</head>
<body>
<%if(session.getAttribute("flag")=="1")
out.print("<script> {alert('您已经是用户登陆状态!');window.open('allleavewords.jsp','_self') }</script>");
request.setCharacterEncoding("gb2312");
String username=request.getParameter("gly");
if(username==null){}
else{
String password=request.getParameter("pwd");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:test","sa","sa");
String message="select * from gly1 where username='"+username+"'and password='"+password+"'";
Statement sql=con.createStatement();
ResultSet rs=sql.executeQuery(message);
if(rs.next()){
session.setAttribute("flag1","2");
session.setAttribute("gly",username);
out.print("<script>alert('登陆成功!');location.href='guanli.jsp'</script>");
%>
<% }
else {
out.print("<script>alert('您的密码有误,请核对您的密码!');location.href='load1.jsp';</script>");
}
con.close();
}
%>
<form name="aaa" method="post" action="" onSubmit="return check()"><label>
<script language="javascript">
</script>
<script language="javascript">function check()
{
if (aaa.gly.value=="")
{
alert("用户名不能为空!");
return false;
}
if (aaa.pwd.value=="")
{
alert("密码不能为空!");
return false;
}
return true;
}
</script>
<p>管理员登陆</p>
<p align="left">管理员:<input name="gly" type="text"></p>
<p align="left">密 码:<input type="password" name="pwd"></label></p>
<p align="left"><input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="取消"></p>
</form>
<a href="index.jsp">返回 </a>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -