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 DeleteReply 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: HttpSession session = request.getSession(true);
22: String sessionType = (String) session.getAttribute("type");
23:
24: String forum_id = request.getParameter("forum_id");
25: String thread_id = request.getParameter("thread_id");
26: String reply_id = request.getParameter("reply_id");
27: String start = request.getParameter("start");
28:
29: if (sessionType.equals("Admin")) {
30:
31: db.connect();
32:
33: db.query("DELETE FROM forum_message WHERE forum_id=\""
34: + forum_id + "\" AND thread_id=\"" + thread_id
35: + "\" AND reply_id=\"" + reply_id + "\"");
36:
37: db.close();
38:
39: response
40: .sendRedirect(Variable.getForumPath()
41: + "index.jsp?page=message&forum_id="
42: + forum_id + "&thread_id=" + thread_id
43: + "&start=" + start);
44: }
45:
46: } catch (Exception e) {
47: }
48:
49: }
50:
51: public void doGet(HttpServletRequest request,
52: HttpServletResponse response) throws ServletException,
53: IOException {
54: doPost(request, response);
55: }
56:
57: }
|