<!--#include file="../Include/Conno.asp" -->
<!--#include file="../Include/const.asp" -->
<!--#include file="../Include/char.asp" -->
<!--#include file="IsLogin.asp" -->
<%
dim idarr,i
user_flag=0
 m_ID = Session("CurUserID")
 m_username= Session("CurUserName")
 m_Sql = "SELECT F_LoginCount,F_Integral,F_MyImage,F_Grade FROM T_Member WHERE F_ID=" & m_ID
 set rs=server.createobject("adodb.recordset")
 rs.open m_sql,conn
 'Set rs = conn.Execute(m_Sql)
 if rs.Eof then
    Call Msgbox("对不起，无此会员！",1)
    Response.end
 end if
'/////////////////////////////////////////////////////

%>
<%
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 "photomanagelist.asp"
else
	call CloseConn()
	call WriteErrMsg()
end if
  
  


sub DelArticle(ID,flag)
	'PurviewChecked=False	
	sqlDel1="select f_id,f_photo from t_member_photo where f_username='"&m_username&"' and f_ischeck=1 and f_ID=" & CLng(ID)
	
	Set rsDel1= Server.CreateObject("ADODB.Recordset")
	rsDel1.open sqlDel1,conn,1,3
	if not rsdel1.eof then
	    
	   strUploadFiles=rsdel1("f_photo")
	     if strUploadFiles<>"" then
				Set fso = CreateObject("Scripting.FileSystemObject")				
					if fso.FileExists(server.MapPath("../Member/Photo/" & strUploadfiles)) then
						fso.DeleteFile(server.MapPath("../Member/Photo/" & strUploadfiles))
					end if				
				Set fso = nothing
			end if
	'更新相关相对应的信息		
   '  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
%>