1 package forum; 2 3 import java.io.*; 4 import javax.servlet.*; 5 import javax.servlet.http.*; 6 import java.util.*; 7 import java.sql.*; 8 import java.sql.Connection ; 9 import java.sql.Statement ; 10 import java.sql.ResultSet ; 11 12 13 public class DeleteReply extends HttpServlet { 14 15 DBConnectie db = new DBConnectie(Variable.getDb(),Variable.getDbLogin(),Variable.getDbPassword()); 16 17 public void doPost (HttpServletRequest request, HttpServletResponse response) 18 throws ServletException, IOException{ 19 try{ 20 HttpSession session = request.getSession(true); 21 String sessionType = (String )session.getAttribute("type"); 22 23 String forum_id = request.getParameter("forum_id"); 24 String thread_id = request.getParameter("thread_id"); 25 String reply_id = request.getParameter("reply_id"); 26 String start = request.getParameter("start"); 27 28 if(sessionType.equals("Admin")){ 29 30 db.connect(); 31 32 db.query("DELETE FROM forum_message WHERE forum_id=\"" + forum_id + "\" AND thread_id=\""+ thread_id + "\" AND reply_id=\"" + reply_id + "\""); 33 34 db.close(); 35 36 response.sendRedirect(Variable.getForumPath() + "index.jsp?page=message&forum_id=" + forum_id + "&thread_id=" + thread_id + "&start=" + start); 37 } 38 39 }catch(Exception e){} 40 41 42 } 43 public void doGet (HttpServletRequest request, HttpServletResponse response) 44 throws ServletException, IOException{ 45 doPost(request, response); 46 } 47 48 } | Popular Tags |