%
if CheckUserLogined()=False then
response.Redirect "User_Login.asp"
end if
dim PhotoID,Action,sqlDel,rsDel,FoundErr,ErrMsg,PurviewChecked,ObjInstalled
PhotoID=trim(request("PhotoID"))
Action=Trim(Request("Action"))
ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")
FoundErr=False
if Action="" or Action<>"Del" then
FoundErr=True
ErrMsg=ErrMsg & "
参数不足!"
end if
if FoundErr=False then
if instr(PhotoID,",")>0 then
dim idarr,i
idArr=split(PhotoID)
for i = 0 to ubound(idArr)
call DelPhoto(clng(idarr(i)))
next
else
call DelPhoto(clng(PhotoID))
end if
end if
call CloseConn()
if FoundErr=False then
response.Redirect "User_PhotoManage.asp"
else
call WriteErrMsg()
end if
sub DelPhoto(ID)
PurviewChecked=False
sqlDel="select * from Photo where PhotoID=" & CLng(ID)
Set rsDel= Server.CreateObject("ADODB.Recordset")
rsDel.open sqlDel,conn,1,3
if rsDel.bof and rsDel.eof then
FoundErr=True
ErrMsg=ErrMsg & "
找不到要删除的图片!"
else
if rsDel("Editor")=Trim(Request.Cookies("asp163")("UserName")) then
if rsDel("Passed")=True then
FoundErr=True
ErrMsg=ErrMsg & "
删除图片“" & rsDel("PhotoName") & "”失败。原因:此图片已经被审核通过,你不能再删除!"
end if
else
FoundErr=True
ErrMsg=ErrMsg & "
删除图片“" & rsDel("PhotoName") & "”失败。原因:此图片是其他网友添加的,你不能删除其他人添加的图片!"
end if
end if
if FoundErr=False then
rsDel("Deleted")=True
rsDel.update
end if
rsDel.close
set rsDel=nothing
end sub
%>