<!-- #include file=../inc/BBSsetup.asp -->
<!-- #include file=../inc/Upload_Setup.asp -->
<!-- #include file=../inc/Board_Popfun.asp -->
<%
DEF_BBS_HomeUrl = "../"
InitDatabase
UpdateOnlineUserAtInfo GBL_board_ID,"删除收件信息"
Dim GBL_ID,Form_ID

Dim FileID
FileID = Left(Request("FileID"),14)
If isNumeric(FileID) = 0 or FileID = "" or InStr(FileID,",") > 0 Then FileID = 0
FileID = Clng(FileID)

If FileID < 0 Then FileID = 0

GBL_CHK_TempStr=""
GBL_ID = GBL_UserID
Form_ID = GBL_ID
Form_ID = cCur(Form_ID)
If Form_ID < 0 Then Form_ID = 0
If Form_ID=0 Then
	GBL_CHK_TempStr = GBL_CHK_TempStr & "你没有登录<br>" & VbCrLf
Else
	If DEF_FSOString = "" Then GBL_CHK_TempStr = "服务器不支持删除附件功能．<br>" & VbCrLf
End If
siteHead("   删除附件")
%>
<script language=javascript>
	window.moveTo(window.screen.width/2-225,window.screen.height/2-18);
</script>
<table align=center border=0 cellpadding=0 cellspacing=0>
<tbody>
<tr> 
	<td height=21 width="650">
	<%
	Dim Rs,SQL,SQLendString,ClearFlag
	If GBL_CHK_TempStr = "" Then
			If CheckSupervisorUserName = 1 or (GetBinarybit(GBL_CHK_UserLimit,11) = 1 and (GetBinarybit(GBL_CHK_UserLimit,10) = 1 or GetBinarybit(GBL_CHK_UserLimit,8) = 1)) Then
				SQL = "Select top 1 ID,PhotoDir,SPhotoDir,UserID from LeadBBS_Upload where id=" & FileID
			Else
				SQL = "Select top 1 ID,PhotoDir,SPhotoDir,UserID from LeadBBS_Upload where UserID=" & GBL_UserID & " and id=" & FileID
			End If
			Set Rs = Con.ExeCute(SQL)
			GBL_DBNum = GBL_DBNum + 1
			If Rs.Eof Then
				Rs.Close
				Set Rs = Nothing
				Response.Write "找不到记录！<br>" & VbCrLf
			Else
					If Request.Form("DeleteSureFlag")="dk9@dl9s92lw_SWxl" Then
						Dim UploadUserID
						UploadUserID = Rs("UserID")
						%>
						成功删除编号为<font color=ff0000 class=RedFont><%=rs("ID")%></font>的上传附件!
						<%
						If Rs("PhotoDir") <> "" Then DeleteFiles(Server.Mappath(Replace(Replace(DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & Rs("PhotoDir"),"/","\"),"\\","\")))
						If Rs("SPhotoDir") <> "" Then DeleteFiles(Server.Mappath(Replace(Replace(DEF_BBS_HomeUrl & DEF_BBS_UploadPhotoUrl & Rs("SPhotoDir"),"/","\"),"\\","\")))
						Rs.Close
						Set Rs = Nothing
						Con.ExeCute("Delete from LeadBBS_Upload where id=" & FileID)
						Con.ExeCute("Update LeadBBS_User Set UploadNum=UploadNum-1 where id=" & UploadUserID)
						con.Execute("update LeadBBS_SiteInfo set UploadNum=UploadNum-1")
						UpdateStatisticDataInfo -1,5,1
						GBL_DBNum = GBL_DBNum + 3
					Else
						%>
						<form name=DellClientForm action=DeleteUpload.asp method=post>
							<input type=hidden name=DeleteSureFlag value="dk9@dl9s92lw_SWxl">
							<input type=hidden name=ClearFlag value="<%=htmlencode(ClearFlag)%>">
							<input type=hidden name=FileID value="<%=htmlencode(FileID)%>">
							<b>确认要删除编号为<font color=ff0000 class=RedFont><%=htmlencode(rs("ID"))%></font>的附件吗？</b>
							<p><input type=submit value=确定 class=fmbtn>
							<input type=button value=不删 onclick="javascript:window.close();" class=fmbtn>
						</form>
						<%
						Rs.Close
						Set Rs = Nothing
					End If
			End If			
	Else%>
		<table width=96%>
		<tr>
		<td>
		<%Response.Write "<p align=left><font color=ff0000 class=RedFont><b>" & GBL_CHK_TempStr & "</b>"
		Response.Write "</p>"%>
		</td>
		</tr>
		</table>
	<%End If%></td>
</tr>
</tbody>
</table>
<html>
<head>
	<title>
		<%=DEF_SiteNameString%>
	</title>
	<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
	<link rel="stylesheet" type="text/css" href="<%=DEF_BBS_homeurl%>/inc/style.css">
</head>
<%

closeDataBase

Function DeleteFiles(path)

	If DEF_FSOString = "" Then Exit Function
    on error resume next
    Dim fs
    Set fs = Server.CreateObject(DEF_FSOString)
	If err <> 0 Then
		Err.Clear
		Response.Write "<br>服务器不支持FSO，硬盘文件未删除．"
		Exit Function
	End If
    If fs.FileExists(path) Then
      fs.DeleteFile path,True
      DeleteFiles = 1
    Else
      DeleteFiles = 0
    End If
    Set fs = Nothing
         
End Function
%>