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 DeleteForum 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:
25: String forum_id = request.getParameter("forum_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 + "\"");
33: db.query("DELETE FROM forum_forums WHERE forum_id=\""
34: + forum_id + "\"");
35:
36: db.close();
37:
38: response.sendRedirect(Variable.getForumPath()
39: + "index.jsp");
40: }
41:
42: } catch (Exception e) {
43: }
44:
45: }
46:
47: public void doGet(HttpServletRequest request,
48: HttpServletResponse response) throws ServletException,
49: IOException {
50: doPost(request, response);
51: }
52:
53: }
|