<!--#include file="../Include/Conn.jsp" -->
<!--#include file="../Include/const.jsp" -->
<!--#include file="../Include/char.jsp" -->
<!--#include file="IsLogin.jsp" -->
<%
dim idarr,i
user_flag=0
f_id=request("id")
 if f_id="" or IsNumeric(f_id)=false then
 Call Msgbox("对不起，ID号错误！",1)
 Response.end
 end if
 m_ID = Request.Cookies("aspxnet")("CurUserID")
 m_username= Request.Cookies("aspxnet")("CurUsername")
set rs_a=server.createobject("adodb.recordset")
sql_a="select f_id,f_manage_username from t_club where F_id="&f_id
rs_a.open sql_a,conn,1,3

if rs_a.eof then
 Call Msgbox("对不起，该小圈子已经不存在！",1)
 Response.end
end if
'判别身份，是否有权限上传照片
set rs_user=server.createobject("adodb.recordset")
sql_user="select f_ischeck,f_identity from t_club_member where F_club_id="&f_id&" and f_username='"&m_username&"'"
rs_user.open sql_user,conn
if rs_user.eof and rs_user.bof then
 Call Msgbox("对不起,您还未加入本小圈子！",1)
 Response.end
 else
 if rs_user("f_ischeck")=false then
 Call Msgbox("对不起,您还未通过审核加入本小圈子，请耐心等待！",1)
 Response.end
 end if
end if
if rs_user("f_identity")="初级会员" then    '初级会员无权上传照片
 Call Msgbox("对不起,您是本小圈子[初级会员]暂无权使用公告信息！",1)
 Response.end
end if
rs_user.close
set rs_user=nothing
'/////////////////////////////////////////////////////
if rs_a("f_manage_username")=m_username then
user_flag=1
end if
rs_a.close
set rs_a=nothing
%>
<%
sub CloseConn()
	conn.close
	set conn=nothing
end sub
ArticleID=trim(request("ArticleID"))
'Action=Trim(Request("Action"))
'response.Write(articleid)
FoundErr=False

if ArticleId="" then
	FoundErr=True
   Call Msgbox("对不起,请选择删除活动！",1)
    Response.end
end if
  
  if FoundErr=False then
	if instr(ArticleID,",")>0 then
	'	dim idarr,i
		idArr=split(ArticleID)
		for i = 0 to ubound(idArr)
			call DelArticle(clng(idarr(i)),user_flag)
		next
	else
		call DelArticle(clng(ArticleID),user_flag)
	end if
end if
if FoundErr=False then
	call CloseConn()
	response.Redirect "club_boardmanage.jsp?id="&f_id
else
	call CloseConn()
	call WriteErrMsg()
end if
  
  


sub DelArticle(ID,flag)
	'PurviewChecked=False
	if flag=1 then
	sqlDel1="select f_id from t_club_board where f_ID=" & CLng(ID)
	else
	sqlDel1="select f_id from t_club_board where f_username='"&m_username&"' and f_ID=" & CLng(ID)
	end if
	Set rsDel1= Server.CreateObject("ADODB.Recordset")
	rsDel1.open sqlDel1,conn,1,3
	if not rsdel1.eof then
	    
	   
	'更新相关相对应的信息		
   '  conn.execute "update T_club set F_clubactive=f_clubactive-1 where F_ID=" &f_id
	' conn.execute "delete from T_club_meetmember where F_meet_id=" &rsdel1("f_id")
	' conn.execute "delete from T_club_meetbook where F_meet_id=" &rsdel1("f_id")
	 rsdel1.delete
	 rsdel1.update
	 end if

	 rsdel1.close
	set rsDel1=nothing
		'conn.execute "delete from Comment where ArticleID=" & CLng(ID)	
end sub
%>
