修复论坛空白输入,上传文件未完成

This commit is contained in:
FJY
2017-11-18 20:28:08 +08:00
parent 6ed6a77b0e
commit a303f56e12
47 changed files with 1699 additions and 615 deletions

View File

@@ -1,5 +1,5 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.sql.*"%>
<%-- <%!
public String codeString(String s)
{ String str=s;
@@ -12,24 +12,40 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="2;url=../index.jsp">
<meta http-equiv="refresh" content="1;url=../index.jsp">
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String k2 = request.getParameter("subject");
String k3 = request.getParameter("content");
Connection con;Statement sql;ResultSet rs;
try{Class.forName("com.mysql.jdbc.Driver"); } catch(ClassNotFoundException e){out.print("驱动异常");}
try{con=DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8","root","");
sql=con.createStatement();
String text="insert into send(subject,content,time) values('"+k2+"','"+k3+"',now())";
sql.executeUpdate(text);
sql.close();
con.close();
out.print("成功发表帖子");
}catch(SQLException event){out.print("数据更新异常");}
%>
<%
/* String URL = "sendForum.jsp";
String referer = response.getHeader("Referer");
if (referer == null || !referer.startsWith(URL)) {
response.sendRedirect(URL);
return;
} */
request.setCharacterEncoding("utf-8");
String k2 = request.getParameter("subject");
String k3 = request.getParameter("content");
String k4 = request.getParameter("username");
Connection con;
Statement sql;
ResultSet rs;
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
out.print("驱动异常");
}
try {
con = DriverManager.getConnection(
"jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8", "root", "");
sql = con.createStatement();
String text = "insert into send(subject,content,time,username) values('" + k2 + "','" + k3 + "',now(),'" + k4 + "')";
sql.executeUpdate(text);
sql.close();
con.close();
out.print("成功发表帖子");
} catch (SQLException event) {
out.print("数据更新异常");
}
%>
</body>
</html>