drop.jsp

来自「一个bug管理系统」· JSP 代码 · 共 32 行

JSP
32
字号
<%@ page contentType="text/html; charset=gb2312" language="java"
	import="java.sql.*" errorPage=""%>
<%
	String pass = null;
	pass = (String) session.getAttribute("pass");
	if ("y".equals(pass)) {
		String id = request.getParameter("id");

		if (id == null) {
			out.print("<h3><font color=#FF0000>ERROR!</font></h3>");
		} else {
			String host = "localhost";
			String user = "root";
			String pw = "123";
			String db = "numb1";

			Class.forName("com.mysql.jdbc.Driver").newInstance();
			String url = "jdbc:mysql://" + host + "/" + db;
			Connection con = DriverManager.getConnection(url, user, pw);
			java.sql.Statement st = con.createStatement();

			String sql = "delete from lyb where id=" + id;
			st.executeUpdate(sql);
			st.close();
			con.close();
			response.sendRedirect("index.jsp");
		}
	} else {
		response.sendRedirect("log.jsp");
	}
%>

⌨️ 快捷键说明

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