%
Dim messageID:messageID = request("m")
Dim objRS
Dim forumID, mem
Dim appid, arrUpfiles,i,upfile
set objRS = server.createobject("adodb.recordset")
with objRS
.open "SELECT forumID, mem FROM pgd_messages WHERE messageID="&Clng(messageID), datastore, , , adCmdText
If not (.EOF or .BOF) then
forumid = .fields(0)
mem = .fields(1)
End if
.close
.open "SELECT upfile FROM pgd_upfile WHERE mem="&mem&" AND messageID = "&Clng(messageID), datastore, , , adCmdText
If not (.EOF or .BOF) then
upfile = .fields(0)
End if
.close
end with
set objRS=nothing
Dim allforum:allforum = Application(dbName&"foruminfo")
if not isEmpty(forumID) and not isEmpty(mem) then
appid = forumidtoappid(forumID)
else
response.end
end if
Dim objPermission,mode
Set objPermission = new PermissionSetting
With objPermission
.memID = memID
.appid = appid
mode = .Moderator()
End With
Set objPermission = nothing
If memID = mem&"" or (isAdmin or mode) then
if request.form<>"" then
Dim strSQL
Dim delFileCount:delFileCount = request.form("deleteupfile").count
Dim arrDelUpfiles()
Redim arrDelUpfiles(delFileCount-1)
i=0
Dim item, remFile
Dim objFSO
set objFSO = Server.CreateObject("Scripting.FileSystemObject")
with objFSO
for each item in request.form("deleteupfile")
remFile = Server.Mappath("upfiles/"&mem&"/"&item)
if .fileexists(remFile) then .DeleteFile remFile, true
arrDelUpfiles(i) = item
i = i+1
response.write remFile&"
"
next
end with
Set objFSO = nothing
for i = 0 to ubound(arrDelUpfiles)
upfile = replace(upfile,arrDelUpfiles(i),"")
next
upfile = CheckDelimitedFormat(upfile,"|")
Dim objCon
SET objCon = server.createObject("ADODB.connection")
with objCon
.open datastore
.execute "Update pgd_upfile Set upfile = '"&upfile&"' WHERE messageID="&Clng(messageID)&" AND mem="&mem, , adExecuteNoRecords + adCmdtext 'adCmdStoredProc
.close
end with
Set objCon = nothing
response.write ("