📄 log.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
String name="";
String password="";
String usertype="";
String url="jdbc:oracle:thin:@10.0.0.4:1521:ORCL";
String user="mms";
String psw="mms123";
name=request.getParameter("name");
name=new String(name.getBytes("ISO-8859-1"),"gb2312");
password=request.getParameter("password");
try
{
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
}
catch(Exception e)
{
out.println("没找到数据库驱动!");
}
try
{
Connection con=DriverManager.getConnection(url,user,psw);
String sql="select name from userinfo where name='"+name+"'";
Statement stm=con.createStatement();
ResultSet rs=stm.executeQuery(sql);
if(rs.next())
{ out.print(name);
String sqls="select * from userinfo where userpassword='"+password+"'";
Statement stm1=con.createStatement();
ResultSet rs1=stm.executeQuery(sqls);
if(rs1.next())
{
session.putValue("ID",name);
name="";
usertype=rs1.getString("usertype");
out.print(usertype);
session.putValue("user_type",usertype);
if(usertype.equals("admin"))
response.sendRedirect("findmessage_admin.jsp");
if(usertype.equals("op"))
response.sendRedirect("findmessage_op.jsp");
if(usertype.equals("guest"))
response.sendRedirect("findmessage.jsp");
}
else
{
response.sendRedirect("checkUser.jsp?action=password&name=name");
}
}
else
{
response.sendRedirect("checkUser.jsp?action=username&name=name");
}
rs.close();
}
catch(SQLException e)
{out.print(e);}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -