<%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="java.sql.*"%> 
<%@ page import="java.util.*"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.*"%>
<%@ include file="checkbbsuser.jsp"%>
<%@ include file="../inc/conn.jsp"%>
<%!int admintobz;%>
<%
String sql,myname;
String id = request.getParameter("id");
String postuser = request.getParameter("postuser"); 
String bbsname = (String)session.getAttribute("name");
sql="SELECT top 1 BBS_Cate.BBS_Cate_Manager_Name FROM BBS_Cate INNER JOIN bbstitle ON BBS_Cate.BBS_Cate_ID = bbstitle.BoardID_2 AND bbstitle.id="+id;
Statement stmt3=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs3=stmt3.executeQuery(sql);
if(rs3.next()){
       myname=rs3.getString("BBS_Cate_Manager_Name");
	   admintobz=0;
	   if(myname.indexOf(username)!=-1)
	   {
		 admintobz=1;  
	   }
}
if((String)session.getAttribute("bz")=="1"||(String)session.getAttribute("bbsadmin")=="1"||postuser.equals(bbsname)||admintobz==1){
   sql="update bbstitle set deleted=1 where id="+id;
   stmt.executeUpdate(sql);
   response.sendRedirect("main.jsp");
   }
else{
           out.print("<script language='javascript'>");
           out.print("alert('你的权限太低，无法使用此功能！');");
           out.print("history.go(-1);");
           out.print("</script>");
           out.close();
}
stmt.close(); 
conn.close();
%>