<!--#include file="../Include/Conn.jsp" -->
<!--#include file="../Include/const.jsp" -->
<!--#include file="../Include/char.jsp" -->
<!--#include file="IsLogin.jsp" -->
<%
dim idarr,i
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,f_name,f_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
if rs_a("f_manage_username")<>m_username and m_username<>rs_a("f_username") then
 Call Msgbox("对不起,您不是本俱乐部[主席]或[创始人]暂无成员管理权限！",1)
 Response.end
end if
m_club_name=rs_a("f_name")
m_create_username=rs_a("f_username")
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 Action="pull" then  '类型判别
if FoundErr=False then
	if instr(ArticleID,",")>0 then
		'dim idarr,i
		idArr=split(ArticleID)
		for i = 0 to ubound(idArr)
			call pullArticle(clng(idarr(i)))
		next
	else
		call pullArticle(clng(ArticleID))
	end if
end if
if FoundErr=False then
	call CloseConn()
	response.Redirect "club_usermanage.jsp?id="&f_id
else
	call CloseConn()
	call WriteErrMsg()
end if

end if  '审核结束

   if Action="del" then  '类型删除
  
  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)))
		next
	else
		call DelArticle(clng(ArticleID))
	end if
end if
if FoundErr=False then
	call CloseConn()
	response.Redirect "club_usermanage.jsp?id="&f_id
else
	call CloseConn()
	call WriteErrMsg()
end if
  
  
  end if   '结束删除

sub DelArticle(ID)
	'PurviewChecked=False
	sqlDel1="select * from t_club_member where f_ID=" & CLng(ID)
	Set rsDel1= Server.CreateObject("ADODB.Recordset")
	rsDel1.open sqlDel1,conn,1,3
	if not rsDel1.eof then
	'保护创建人的权利
	   if m_create_username=rsdel1("f_username") then
	    Call Msgbox("对不起,本俱乐部[创始人]具有永久保护权利！",1)
         Response.end
	   end if
	 if rsDel1("f_ischeck")=true then		
     conn.execute "update T_club set F_usercount=f_usercount-1 where F_ID=" &f_id
	 end if
	  m_logcontent="您已经被踢出了[<a href=club_viewsub.jsp?id="&f_id&" target=_blank>"&m_club_name&"</a>]子俱乐部"
       if syslog_function(rsdel1("f_username"),m_logcontent) <> "OK" then
       response.write "系统有错误！"	
       end if
	 rsDel1.delete
	 rsDel1.update
	 end if
	' rsdel1.close
	'set rsDel1=nothing
		'conn.execute "delete from Comment where ArticleID=" & CLng(ID)	
end sub
sub pullArticle(ID)
	'PurviewChecked=False
	sqlDel="select f_ischeck,f_username from t_club_member where f_ID=" & CLng(ID)
	Set rsDel= Server.CreateObject("ADODB.Recordset")
	rsDel.open sqlDel,conn,1,3
	if not rsdel.eof then	
		if rsdel("f_ischeck")=false then
		rsdel("f_ischeck")=true
		 m_logcontent="您已经成功的加入了[<a href=club_viewsub.jsp?id="&f_id&" target=_blank>"&m_club_name&"</a>]子俱乐部[初级会员]"
          if syslog_function(rsdel("f_username"),m_logcontent) <> "OK" then
          response.write "系统有错误！"	
          end if
		rsDel.update 
		conn.execute "update T_club set F_usercount=f_usercount+1 where F_ID=" &f_id
		end if
	end if	
  
	' rsdel.close
	'set rsDel=nothing
		'conn.execute "delete from Comment where ArticleID=" & CLng(ID)	
end sub
%>
