⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pop_delete.asp

📁 此程序是一个个人主页创造程序,该程序无插件,无任何恶意程序.
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
'#############################################################
'#      中国在线--极酷论坛 ver.2001 3.0
'#
'#  版权所有: 中国在线 (ChinaXP.Net)
'#
'#  制作人  : 周周 (SeeYa!)
'#
'#
'#  主页地址: http://www.ChinaXP.net/    中国在线
'#	      http://www.ChinaXP.Net/bbs/    中国在线--极酷论坛
'#
'#############################################################
%>
<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_functions.asp" -->
<!--#INCLUDE FILE="inc_top_short.asp" -->
<%
if strAuthType = "db" then
	STRdbntUserName = Request.Form("User")
end if

'################### File Attachments ############################
function DeleteUploads(msgType,ID)
	select case msgType
		case "Topic"
			strSql = "SELECT USERFILES.MEMBER_ID,USERFILES.F_FILENAME FROM " & strTablePrefix & "USERFILES "
			strSql = strSql & " WHERE " & strTablePrefix & "USERFILES.F_TOPIC_ID = " & ID
			set rs2 = my_Conn.Execute (strSql)
			on error resume next
			if not(rs2.eof or rs2.bof) then
				Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
				do while not rs2.eof
				     FilePath = replace(strCookieURL,"/mods/","/",1,-1,1) & "uploaded"
					 FilePath = Server.MapPath(FilePath) & "\" & getMemberName(rs2("MEMBER_ID")) & "\"
					if ScriptObject.FileExists(FilePath & rs2("F_FILENAME")) then
					ScriptObject.DeleteFile(FilePath & rs2("F_FILENAME"))
					end if
					rs2.MoveNext
				loop
				DeleteUploads = 1
			else
				DeleteUploads = 0
			end if
			rs2.Close
		case "Reply"
			strSql = "SELECT MEMBER_ID,F_FILENAME FROM " & strTablePrefix & "USERFILES "
			strSql = strSql & " WHERE F_REPLY_ID = " & ID
			set rs2 = my_Conn.Execute (strSql)
			if not(rs2.eof or rs2.bof) then
				Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
				on error resume next
				do while not rs2.eof
				     FilePath = replace(strCookieURL,"/mods/","/",1,-1,1) & "uploaded"
					 FilePath = Server.MapPath(FilePath) & "\" & getMemberName(rs2("MEMBER_ID")) & "\"
					 if ScriptObject.FileExists(FilePath & rs2("F_FILENAME")) then
						ScriptObject.DeleteFile(FilePath & rs2("F_FILENAME"))
					end if
					rs2.MoveNext
				loop
				DeleteUploads = 1
			else
				DeleteUploads = 0
			end if
			rs2.Close
	end Select
end function
'################### File Attachment end ############################

if Request.QueryString("mode") = "DeleteReply" then
	mLev = cint(ChkUser3(strDBNTUserName, Request.Form("Pass"), Request.Form("REPLY_ID")))
	if mLev > 0 then  '## is Member
	  if (chkForumModerator(Request.Form("FORUM_ID"), strDBNTUserName) = "1") or (mLev = 1) or (mLev = 4) then '## is Allowed
			'## Forum_SQL - Delete reply
			strSql = "DELETE FROM " & strTablePrefix & "REPLY "
			strSql = strSql & " WHERE " & strTablePrefix & "REPLY.REPLY_ID = " & Request.Form("REPLY_ID")
			my_Conn.Execute strSql

'################### File Attachments ############################
			if DeleteUploads("Reply",Request.Form("REPLY_ID")) = 1 then
			strSql = "DELETE FROM " & strTablePrefix & "USERFILES "
			strSql = strSql & " WHERE " & strTablePrefix & "USERFILES.F_REPLY_ID = " & Request.Form("REPLY_ID")
			my_Conn.Execute strSql
			end if
'################### File Attachments end ########################
			
			set rs = Server.CreateObject("ADODB.Recordset")

			'## Forum_SQL - Get last_post and last_post_author for Topic
			strSql = "SELECT R_DATE, R_AUTHOR"
			strSql = strSql & " FROM " & strTablePrefix & "REPLY "
			strSql = strSql & " WHERE TOPIC_ID = " & Request.Form("TOPIC_ID") & " "
			strSql = strSql & " ORDER BY R_DATE DESC"

			set rs = my_Conn.Execute (strSql)
			
			if not(rs.eof or rs.bof) then
				strLast_Post = rs("R_DATE")
				strLast_Post_Author = rs("R_AUTHOR")
			end if			
			if (rs.eof or rs.bof) or IsNull(strLast_Post) or IsNull(strLast_Post_Author) then  'topic has no replies
				set rs2 = Server.CreateObject("ADODB.Recordset")

				'## Forum_SQL - Get post_date and author from Topic
				strSql = "SELECT T_AUTHOR, T_DATE "
				strSql = strSql & " FROM " & strTablePrefix & "TOPICS "
				strSql = strSql & " WHERE TOPIC_ID = " & Request.Form("TOPIC_ID") & " "
				
				set rs2 = my_Conn.Execute (strSql)
			
				strLast_Post = rs2("T_DATE")
				strLast_Post_Author = rs2("T_AUTHOR")
				
				rs2.Close
				set rs2 = nothing
				
			end if
			
			rs.Close
			set rs = nothing
			
			'## FORUM_SQL - Decrease count of replies to individual topic by 1
			strSql = "UPDATE " & strTablePrefix & "TOPICS "
			strSql = strSql & " SET " & strTablePrefix & "TOPICS.T_REPLIES = " & strTablePrefix & "TOPICS.T_REPLIES - " & 1 & " "
			if strLast_Post <> "" then
				strSql = strSql & ", T_LAST_POST = '" & strLast_Post & "'"
				if strLast_Post_Author <> "" then
					strSql = strSql & ", T_LAST_POST_AUTHOR = " & strLast_Post_Author & ""
				end if
			end if
			strSql = strSql & " WHERE " & strTablePrefix & "TOPICS.TOPIC_ID = " & Request.Form("TOPIC_ID")

			my_Conn.Execute strSql

			'## Forum_SQL - Get last_post and last_post_author for Forum
			strSql = "SELECT T_LAST_POST, T_LAST_POST_AUTHOR "
			strSql = strSql & " FROM " & strTablePrefix & "TOPICS "
			strSql = strSql & " WHERE FORUM_ID = " & Request.Form("FORUM_ID") & " "
			strSql = strSql & " ORDER BY T_LAST_POST DESC"

			set rs = my_Conn.Execute (strSql)
			
			if not rs.eof then
				strLast_Post = rs("T_LAST_POST")
				strLast_Post_Author = rs("T_LAST_POST_AUTHOR")
			else
				strLast_Post = ""
				strLast_Post_Author = ""
			end if
			
			rs.Close
			set rs = nothing

			'## Forum_SQL - Decrease count of total replies in Forum by 1
			strSql =  "UPDATE " & strTablePrefix & "FORUM "
			strSql = strSql & " SET " & strTablePrefix & "FORUM.F_COUNT = " & strTablePrefix & "FORUM.F_COUNT - " & 1 & " "
			if strLast_Post <> "" then
				strSql = strSql & ", F_LAST_POST = '" & strLast_Post & "'"
				if strLast_Post_Author <> "" then

					strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author

				end if
			end if
			strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & Request.Form("FORUM_ID")

			my_Conn.Execute strSql

			'## FORUM_SQL - Decrease count of total replies in Totals table by 1
			strSql = "UPDATE " & strTablePrefix & "TOTALS "
			strSql = strSql & " SET " & strTablePrefix & "TOTALS.P_COUNT = " & strTablePrefix & "TOTALS.P_COUNT - " & 1 & " "

			my_Conn.Execute strSql
%>
<P><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">回复已删除!</font></p>
<P>(<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">记得重新整理页面。</font>)</p>
<%		Else %>
<P><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">你不是管理员不能删除回复</p>
<p><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="JavaScript: onClick= history.go(-1)">返回重新认证</a></font></p>
<%		end if %>
<%	Else %>
<P><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">你不是管理员不能删除回复</p>
<p><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="JavaScript: onClick= history.go(-1)">返回重新认证</a></font></p>
<%	end if

else
	if Request.QueryString("mode") = "DeleteTopic" then
		mLev = cint(ChkUser2(STRdbntUserName, Request.Form("Pass")))
		if mLev > 0 then  '## is Member
			if (chkForumModerator(Request.Form("FORUM_ID"), STRdbntUserName) = "1") or (mLev = 4) then
				delAr = split(Request.Form("TOPIC_ID"), ",")
				for i = 0 to ubound(delAr)

					'## Forum_SQL - count total number of replies of TOPIC_ID  in Reply table
					'## 统计
					set rs = Server.CreateObject("ADODB.Recordset")
					strSql = "SELECT count(" & strTablePrefix & "REPLY.REPLY_ID) AS cnt "
					strSql = strSql & " FROM " & strTablePrefix & "REPLY "
					strSql = strSql & " WHERE " & strTablePrefix & "REPLY.TOPIC_ID = " & cint(delAr(i))
					rs.Open strSql, my_Conn
					risposte = rs("cnt")
					rs.close
					set rs = nothing

					' #################################
					if Request.Form("FILE_ID") <> "" and Request.Form("FILE_NAME") <> "" then
						'## USERFILES_SQL - 删除主题相关的附加软件
						strSql = "DELETE FROM " & strTablePrefix & "USERFILES "
						strSql = strSql & " WHERE " & strTablePrefix & "USERFILES.F_FILEID = " & cint(Request.Form("FILE_ID"))
						my_Conn.Execute strSql

						if strCookieURL <> "" then
							strFile = Server.MapPath(strCookieURL) & "\" & Replace(usrPath, "/", "\")
						else
							strFile = Server.MapPath(".") & "\" & Replace(usrPath, "/", "\")
						end if
						strFile = strFile & "\"  & Request.Form("FILE_NAME")
						Set fso = Server.CreateObject("Scripting.FileSystemObject")
						if (fso.FileExists(strFile)) then
							fso.deleteFile(strFile)
						end if
					end if
					' #################################

					'## Forum_SQL - Delete the actual topics
					strSql = "DELETE FROM " & strTablePrefix & "TOPICS "
					strSql = strSql & " WHERE " & strTablePrefix & "TOPICS.TOPIC_ID = " & cint(delAr(i))
					my_Conn.Execute strSql

					'## Forum_SQL - Delete all replys related to the topics
					strSql = "DELETE FROM " & strTablePrefix & "REPLY "
					strSql = strSql & " WHERE " & strTablePrefix & "REPLY.TOPIC_ID = " & cint(delAr(i))

					my_Conn.Execute strSql	'## Forum_SQL - Get last_post and last_post_author for Forum
					strSql = "SELECT T_LAST_POST, TOPIC_ID, T_LAST_POST_AUTHOR"
					strSql = strSql & " FROM " & strTablePrefix & "TOPICS "			
					strSql = strSql & " WHERE FORUM_ID = " & Request.Form("FORUM_ID") & " "
					strSql = strSql & " ORDER BY T_LAST_POST DESC"
					
					set rs = my_Conn.Execute (strSql)
			
					if not rs.eof then
						rs.movefirst
						strLast_Post = rs("T_LAST_POST")
						strLast_Reply = rs("TOPIC_ID")
						strLast_Post_Author = rs("T_LAST_POST_AUTHOR")
					else
						strLast_Post = ""
						strLast_Reply = ""
						strLast_Post_Author = ""
					end if
			
					rs.Close
					set rs = nothing

					'## Forum_SQL - Update count of replies to a topic in Forum table
					strSql = "UPDATE " & strTablePrefix & "FORUM "
					strSql = strSql & " SET " & strTablePrefix & "FORUM.F_COUNT = " & strTablePrefix & "FORUM.F_COUNT - " & risposte
					strSql = strSql & " ,   " & strTablePrefix & "FORUM.F_TOPICS = " & strTablePrefix & "FORUM.F_TOPICS - "	& 1				
					if strLast_Post <> "" then 						
						strSql = strSql & ", F_LAST_POST = '" & strLast_Post & "' "
						if strLast_Reply <> "" then
							strSql = strSql & ", F_LAST_REPLY = " & strLast_Reply
						end if
						if strLast_Post_Author <> "" then
							strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author
						end if
					else
						strSql = strSql & ", F_LAST_POST = F_CREATED"
						strSql = strSql & ", F_LAST_REPLY = NULL"
						strSql = strSql & ", F_LAST_POST_AUTHOR = NULL"
					end if

					strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & Request.Form("FORUM_ID")
					my_Conn.Execute strSql
					'## Forum_SQL - Update total TOPICS in Totals table

					strSql = "UPDATE " & strTablePrefix & "TOTALS "
					strSql = strSql & " SET " & strTablePrefix & "TOTALS.T_COUNT = " & strTablePrefix & "TOTALS.T_COUNT - " & 1
					strSql = strSql & ",    " & strTablePrefix & "TOTALS.P_COUNT = " & strTablePrefix & "TOTALS.P_COUNT - " & risposte
					my_Conn.Execute strSql					

				next
%>
<P align=center><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>"><b>主题已删除!</b></font></p>
<%			Else %>
<P align=center><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>"><b>你不是管理员不能删除主题</font><br>
<br>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="JavaScript: onClick= history.go(-1) ">返回重新认证</a></font></p>
<%			end if %>	
<%		Else %>
<P align=center><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>"><b>你不是管理员不能删除主题</font><br>
<br>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="JavaScript: onClick= history.go(-1)">返回重新认证</a></font></p>
<%
		end if
	else
		if Request.QueryString("mode") = "DeleteForum" then
			mLev = cint(ChkUser2(strDBNTUserName, Request.Form("Pass")))
			if mLev > 0 then  '## is Member
				if mLev = 4 then
					delAr = split(Request.Form("FORUM_ID"), ",")
					for i = 0 to ubound(delAr)
						'## Forum_SQL - Delete all replys related to the topics
						strSql = "DELETE FROM " & strTablePrefix & "REPLY "
						strSql = strSql & " WHERE FORUM_ID = " & cint(delAr(i))

						my_Conn.Execute strSql

						'## Forum_SQL - Delete the actual topics
						strSql = "DELETE FROM " & strTablePrefix & "TOPICS "
						strSql = strSql & " WHERE " & strTablePrefix & "TOPICS.FORUM_ID = " & cint(delAr(i))

						my_Conn.Execute strSql

						'## Forum_SQL - Delete the moderators

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -