2024/4/15
<%--
Created by IntelliJ IDEA.
User: 联想
Date: 2023/11/24
Time: 10:03
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.*" %>
<%
String url="jdbc:mysql://localhost:3306/fish?serverTimezone=UTC&useSSL=false&characterEncoding=UTF-8";
String user="root";
String password="123456";
String jobid = request.getParameter("jobid");
String password1 = request.getParameter("password");
session.setAttribute("jobid", jobid);
Connection conn;
PreparedStatement stmt;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url,user,password);
stmt = conn.prepareStatement("select * from message1 where jobid=? and password=?");
stmt.setString(1, jobid);
stmt.setString(2, password1);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
session.setAttribute("role", rs.getString("role")); // 从数据库中获取用户的身份信息并存储在session中
response.sendRedirect("distinguish.jsp");
} else {
out.println("账号密码错误");
}
conn.close();
} catch (Exception e) {
out.println("出现错误: " + e.getMessage());
}
%>
Created by IntelliJ IDEA.
User: 联想
Date: 2023/11/24
Time: 10:03
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.*" %>
<%
String url="jdbc:mysql://localhost:3306/fish?serverTimezone=UTC&useSSL=false&characterEncoding=UTF-8";
String user="root";
String password="123456";
String jobid = request.getParameter("jobid");
String password1 = request.getParameter("password");
session.setAttribute("jobid", jobid);
Connection conn;
PreparedStatement stmt;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url,user,password);
stmt = conn.prepareStatement("select * from message1 where jobid=? and password=?");
stmt.setString(1, jobid);
stmt.setString(2, password1);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
session.setAttribute("role", rs.getString("role")); // 从数据库中获取用户的身份信息并存储在session中
response.sendRedirect("distinguish.jsp");
} else {
out.println("账号密码错误");
}
conn.close();
} catch (Exception e) {
out.println("出现错误: " + e.getMessage());
}
%>

浙公网安备 33010602011771号