01: package forum;
02:
03: import java.io.*;
04: import javax.servlet.*;
05: import javax.servlet.http.*;
06: import java.util.*;
07: import java.sql.*;
08: import java.sql.Connection;
09: import java.sql.Statement;
10: import java.sql.ResultSet;
11:
12: public class DeleteThread extends HttpServlet {
13:
14: DBConnectie db = new DBConnectie(Variable.getDb(), Variable
15: .getDbLogin(), Variable.getDbPassword());
16:
17: public void doPost(HttpServletRequest request,
18: HttpServletResponse response) throws ServletException,
19: IOException {
20: try {
21:
22: HttpSession session = request.getSession(true);
23: String sessionType = (String) session.getAttribute("type");
24: String forum_id = request.getParameter("forum_id");
25: String thread_id = request.getParameter("thread_id");
26:
27: if (sessionType.equals("Admin")) {
28:
29: db.connect();
30:
31: db.query("DELETE FROM forum_message WHERE forum_id=\""
32: + forum_id + "\" AND thread_id=\"" + thread_id
33: + "\"");
34: db.query("DELETE FROM forum_threads WHERE forum_id=\""
35: + forum_id + "\" AND thread_id=\"" + thread_id
36: + "\"");
37:
38: db.close();
39:
40: response.sendRedirect(Variable.getForumPath()
41: + "index.jsp?page=thread&forum_id=" + forum_id);
42: }
43:
44: } catch (Exception e) {
45: }
46:
47: }
48:
49: public void doGet(HttpServletRequest request,
50: HttpServletResponse response) throws ServletException,
51: IOException {
52: doPost(request, response);
53: }
54:
55: }
|