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

Dim MessageID
MessageID = Left(Request("MessageID"),14)
If isNumeric(MessageID) = 0 or MessageID = "" or InStr(MessageID,",") > 0 Then MessageID = 0
MessageID = Fix(cCur(MessageID))

If MessageID < 0 Then MessageID = 0

GBL_CHK_TempStr=""
If GBL_UserID < 1 Then
	GBL_CHK_TempStr = 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
		ClearFlag = Request("ClearFlag")
		If ClearFlag = "dkeJje5" or ClearFlag = "dkeJje6" Then
			If GBL_UserID<1 or CheckSupervisorUserName = 0 or ClearFlag = "dkeJje5" Then
				SQL = "delete from LeadBBS_InfoBox where ToUser='" & Replace(GBL_CHK_User,"'","''") & "'"
			Else
				SQL = "delete from LeadBBS_InfoBox"
			End If
					
			If Request.Form("DeleteSureFlag")="dk9@dl9s92lw_SWxl" Then
				%>
				成功删除所有消息!
				<%
				Con.Execute("Update LeadBBS_User Set MessageFlag=0 where ID=" & GBL_UserID)
				Con.Execute(SQL)
				If CheckSupervisorUserName = 1 Then ReloadPubMessageInfo
			Else
				%>
				<form name=DellClientForm action=DeleteMessage.asp method=post>
					<input type=hidden name=DeleteSureFlag value="dk9@dl9s92lw_SWxl">
					<input type=hidden name=ClearFlag value="<%=htmlencode(ClearFlag)%>">
					<input type=hidden name=MessageID value="<%=htmlencode(MessageID)%>">
					<b>确认要删除所有消息吗？删除后将不能恢复！</b>
					<p><input type=submit value=确定 class=fmbtn>
					<input type=button value=不删 onclick="javascript:window.close();" class=fmbtn>
				</form>
				<%
			End If
		Else
			SQL = "Select top 1 ToUser,ReadFlag from LeadBBS_InfoBox where id=" & MessageID
			Set Rs = Con.ExeCute(SQL)
			If Rs.Eof Then
				Rs.Close
				Set Rs = Nothing
				Response.Write "找不到记录！<br>" & VbCrLf
			Else
				If (CheckSupervisorUserName = 0) and Rs(0) <> GBL_CHK_User Then
					Rs.Close
					Set Rs = Nothing
					Response.Write "找不到记录！<br>" & VbCrLf
				Else
					If Request.Form("DeleteSureFlag")="dk9@dl9s92lw_SWxl" Then
						%>
						成功删除编号为<font color=ff0000 class=RedFont><%=MessageID%></font>的消息!
						<%
						Dim ToUser
						ToUser = Rs(0)
						If Rs(1) = 0 Then
							Rs.Close
							Set Rs = Nothing
							Con.ExeCute("Delete from LeadBBS_InfoBox where id=" & MessageID)
							SQL = "Select top 1 ID from LeadBBS_InfoBox where ReadFlag=0 and ToUser='" & Replace(ToUser,"'","''") & "'"
							Set Rs = Con.ExeCute(SQL)
							If Rs.Eof Then
								Con.Execute("Update LeadBBS_User Set MessageFlag=0 where UserName='" & Replace(ToUser,"'","''") & "'")
							End If
							Rs.Close
							Set Rs = Nothing
						Else
							Rs.Close
							Set Rs = Nothing
							Con.ExeCute("Delete from LeadBBS_InfoBox where id=" & MessageID)
						End If
						If ToUser = "" or isNull(ToUser) Then ReloadPubMessageInfo
					Else
						%>
						<form name=DellClientForm action=DeleteMessage.asp method=post>
							<input type=hidden name=DeleteSureFlag value="dk9@dl9s92lw_SWxl">
							<input type=hidden name=ClearFlag value="<%=htmlencode(ClearFlag)%>">
							<input type=hidden name=MessageID value="<%=htmlencode(MessageID)%>"><%
						If cCur(Rs(1)) = 0 and Rs(0) <> "" Then
							Response.Write "<font color=ff0000 class=RedFont><b>注意: 这条消息您未查看过，删除后不能恢复．</b></font><br>"
						End If
						Rs.Close
						Set Rs = Nothing%>
							<b>确认要删除编号为<font color=ff0000 class=RedFont><%=MessageID%></font>的消息吗？</b>
							<br><br><input type=submit value=确定 class=fmbtn>
							<input type=button value=不删 onclick="javascript:window.close();" class=fmbtn>
						</form>
						<%
					End If
				End If
			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>
<%

closeDataBase
SiteBottom_Spend
%>