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

📄 pop_delete.asp

📁 代码名称: Snitz Forums 2000 代码语言: 英文 代码类型: 国外代码 运行环境: ASP 授权方式: 免费代码 代码大小: 530kb 代码等级: 3 整
💻 ASP
📖 第 1 页 / 共 3 页
字号:
						if not rs.eof then
							intPostcount = rs("POSTCOUNT")
						else
							intPostcount = 0
						end if
						rs.close
						set rs = nothing

						'## Forum_SQL - Select postcount
						strSql = "SELECT COUNT(R_AUTHOR) AS REPLYCOUNT "
						strSql = strSql & " FROM " & strTablePrefix & "REPLY "
						strSql = strSql & " WHERE R_AUTHOR = " & cLng(delAr(i))

						set rs = my_Conn.Execute (strSql)
						if not rs.eof then
							intReplycount = rs("REPLYCOUNT")
						else
							intReplycount = 0
						end if

						rs.close
						set rs = nothing							

						'## Forum_SQL - Select Archived postcount
						strSql = "SELECT COUNT(T_AUTHOR) AS POSTCOUNT "
						strSql = strSql & " FROM " & strTablePrefix & "A_TOPICS "
						strSql = strSql & " WHERE T_AUTHOR = " & cLng(delAr(i))

						set rs = my_Conn.Execute (strSql)
						if not rs.eof then
							intA_Postcount = rs("POSTCOUNT")
						else
							intA_Postcount = 0
						end if

						rs.close
						set rs = nothing

						'## Forum_SQL - Select postcount
						strSql = "SELECT COUNT(R_AUTHOR) AS REPLYCOUNT "
						strSql = strSql & " FROM " & strTablePrefix & "A_REPLY "
						strSql = strSql & " WHERE R_AUTHOR = " & cLng(delAr(i))

						set rs = my_Conn.Execute (strSql)
						if not rs.eof then
							intA_Replycount = rs("REPLYCOUNT")
						else
							intA_Replycount = 0
						end if

						rs.close
						set rs = nothing

						if ((intReplycount + intPostCount + intA_Replycount + intA_PostCount) = 0) then
							'## Forum_SQL - Delete the Member - Member has no posts
							strSql = "DELETE FROM " & strMemberTablePrefix & "MEMBERS "
							strSql = strSql & " WHERE MEMBER_ID = " & cLng(delAr(i))

							my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
						else
							'## Forum_SQL - disable account - Member has posts, cannot delete just disable account
							strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS "
							strSql = strSql & " SET M_STATUS = " & 0
							strSql = strSql & ",    M_EMAIL = ' '"
							strSql = strSql & ",    M_LEVEL = " & 1
							strSql = strSql & ",    M_NAME = 'n/a'"
							strSql = strSql & ",    M_COUNTRY = ' '"
							strSql = strSql & ",    M_TITLE = 'deleted'"
							strSql = strSql & ",    M_HOMEPAGE = ' '"
							strSql = strSql & ",    M_AIM = ' '"
							strSql = strSql & ",    M_ICQ = ' '"
							strSql = strSql & ",    M_MSN = ' '"
							strSql = strSql & ",    M_YAHOO = ' '"
							strSql = strSql & " WHERE MEMBER_ID = " & cLng(delAr(i))

							my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
						end if

						'## Forum_SQL - Update total of Members in Totals table
						strSql = "UPDATE " & strTablePrefix & "TOTALS "
						strSql = strSql & " SET U_COUNT = U_COUNT - " & 1

						my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
						intDeleted = intDeleted + 1
					end if
				next
				Response.Write	"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>"
				if intDeleted > 0 then
					Response.Write("<b>Member Deleted!</b>")
				else
					Response.Write("<b>No Members Deleted!</b>")
				end if
				Response.Write	"</font></p>" & vbNewLine & _
						"      <script language=""javascript1.2"">self.opener.location.reload();</script>" & vbNewLine
			else
				Response.Write	"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """><b>No Permissions to Delete a Member</b></font><br />" & vbNewLine & _
						"<br /><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:onClick=history.go(-1)"">Go Back to Re-Authenticate</a></font></p>" & vbNewLine
			end if
		else
			Response.Write	"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """><b>No Permissions to Delete a Member</b></font><br />" & vbNewLine & _
					"<br /><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:onClick=history.go(-1)"">Go Back to Re-Authenticate</a></font></p>" & vbNewLine
		end if 
	case else
		Response.Write	"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>Delete "
		select case Mode_Type
			case "Member"
				Response.Write("Member")
			case "Category"
				Response.Write("Category")
			case "Forum"
				Response.Write("Forum")
			case "Topic"
				Response.Write("Topic")
			case "Reply"
				Response.Write("Reply")
		end select
		Response.Write	"</font></p>" & vbNewLine & _
				"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b><font color=""" & strHiLiteFontColor & """>NOTE:&nbsp;</font></b>"
		select case Mode_Type
			case "Member"
				Response.Write("Only Administrators can delete a Member.")
			case "Category"
				Response.Write("Only Administrators can delete a Category.")
			case "Forum"
				Response.Write("Only Administrators can delete Forums.")
			case "Topic"
				Response.Write("Only Moderators and Administrators, or the Author of a Topic (if no Replies have been made to it) can delete Topics.")
			case "Reply"
				Response.Write("Only the Author, Moderators and Administrators can delete Replies.")
		end select
		Response.Write	"</font></p>" & vbNewLine & _
				"      <form action=""pop_delete.asp?mode="
		select case Mode_Type
			case "Member"
				Response.Write("DeleteMember")
			case "Category"
				Response.Write("DeleteCategory")
			case "Forum"
				Response.Write("DeleteForum")
			case "Topic"
				Response.Write("DeleteTopic")
			case "Reply"
				Response.Write("DeleteReply")
		end select
		Response.Write	""" method=""post"" id=""Form1"" name=""Form1"">" & vbNewLine & _
				"      <input type=""hidden"" name=""ARCHIVE"" value=""" & ArchiveView & """>" & vbNewLine & _
				"      <input type=""hidden"" name=""REPLY_ID"" value=""" & Reply_ID & """>" & vbNewLine & _
				"      <input type=""hidden"" name=""TOPIC_ID"" value=""" & Topic_ID & """>" & vbNewLine & _
				"      <input type=""hidden"" name=""FORUM_ID"" value=""" & Forum_ID & """>" & vbNewLine & _
				"      <input type=""hidden"" name=""CAT_ID"" value=""" & Cat_ID & """>" & vbNewLine & _
				"      <input type=""hidden"" name=""MEMBER_ID"" value=""" & Member_ID & """>" & vbNewLine & _
				"      <table border=""0"" cellspacing=""0"" cellpadding=""0"">" & vbNewLine & _
				"        <tr>" & vbNewLine & _
				"          <td bgcolor=""" & strPopUpBorderColor & """>" & vbNewLine & _
				"            <table border=""0"" width=""100%"" cellspacing=""1"" cellpadding=""1"">" & vbNewLine
		if strAuthType = "db" then
			Response.Write	"              <tr>" & vbNewLine & _
					"                <td bgColor=""" & strPopUpTableColor & """ align=""right"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>User Name:</font></b></td>" & vbNewLine & _
					"                <td bgColor=""" & strPopUpTableColor & """><input type=""text"" maxLength=""25"" name=""User"" value=""" & chkString(strDBNTUserName,"display") & """ style=""width:150px;""></td>" & vbNewLine & _
					"              </tr>" & vbNewLine & _
					"              <tr>" & vbNewLine & _
					"                <td bgColor=""" & strPopUpTableColor & """ align=""right"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>Password:</font></b></td>" & vbNewLine & _
					"                <td bgColor=""" & strPopUpTableColor & """><input type=""Password"" maxLength=""25"" name=""Pass"" value="""" style=""width:150px;""></td>" & vbNewLine & _
					"              </tr>" & vbNewLine
		else
			if strAuthType = "nt" then
				Response.Write	"              <tr>" & vbNewLine & _
      						"                <td bgColor=""" & strPopUpTableColor & """ align=""right"" nowrap><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>NT Account:</font></b></td>" & vbNewLine & _
						"                <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & strDBNTUserName & "</font></td>" & vbNewLine & _
						"              </tr>" & vbNewLine
			end if
		end if
		Response.Write	"              <tr>" & vbNewLine & _
				"                <td bgColor=""" & strPopUpTableColor & """ colspan=""2"" align=""center""><input type=""Submit"" value=""Send"" id=""Submit1"" name=""Submit1""></td>" & vbNewLine & _
				"              </tr>" & vbNewLine & _
				"            </table>" & vbNewLine & _
				"          </td>" & vbNewLine & _
				"        </tr>" & vbNewLine & _
				"      </table>" & vbNewLine & _
				"      </form>" & vbNewLine
end select
WriteFooterShort
Response.End

function chkUser5(fName, fPassword, fTopic)
	'## Forum_SQL
	strSql = "SELECT M.MEMBER_ID, M.M_LEVEL, M.M_NAME, M.M_PASSWORD, T.T_AUTHOR, T.T_REPLIES "
	strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS M, " & strActivePrefix & "TOPICS T "
	StrSql = strSql & " WHERE M." & strDBNTSQLName & " = '" & fName & "' "
	if strAuthType="db" then
		strSql = strSql & " AND M.M_PASSWORD = '" & fPassword &"' "
	End If
	strSql = strSql & " AND T.TOPIC_ID = " & fTopic
	strSql = strSql & " AND M.M_STATUS = " & 1
 
	set rsCheck = my_Conn.Execute (strSql)
 
	if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then
		chkUser5 = 0 '## Invalid Password
	else
		if cLng(rsCheck("MEMBER_ID")) = cLng(rsCheck("T_AUTHOR")) and cLng(rsCheck("T_REPLIES")) < 1 then 
			chkUser5 = 1 '## Author
		else
			Select case cLng(rsCheck("M_LEVEL"))
				case 1
					chkUser5 = 2 '## Normal User
				case 2
					chkUser5 = 3 '## Moderator
				case 3
					chkUser5 = 4 '## Admin
				case else
					chkUser5 = cLng(rsCheck("M_LEVEL"))
			End Select
		end if	
	end if
 
	rsCheck.close	
	set rsCheck = nothing
end function

function chkUser3(fName, fPassword, fReply)
	'## Forum_SQL
	strSql = "SELECT M.MEMBER_ID, M.M_LEVEL, M.M_NAME, M.M_PASSWORD, R.R_AUTHOR "
	strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS M, " & strActivePrefix & "REPLY R "
	StrSql = strSql & " WHERE M." & strDBNTSQLName & " = '" & fName & "' "
	if strAuthType="db" then	
		strSql = strSql & " AND M.M_PASSWORD = '" & fPassword &"' "
	End If
	strSql = strSql & " AND R.REPLY_ID = " & fReply
	strSql = strSql & " AND M.M_STATUS = " & 1

	set rsCheck = my_Conn.Execute (strSql)

	if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then
		chkUser3 = 0 '## Invalid Password
	else
		if cLng(rsCheck("MEMBER_ID")) = cLng(rsCheck("R_AUTHOR")) then 
			chkUser3 = 1 '## Author
		else
			Select case cLng(rsCheck("M_LEVEL"))
				case 1
					chkUser3 = 2 '## Normal User
				case 2
					chkUser3 = 3 '## Moderator
				case 3
					chkUser3 = 4 '## Admin
				case else
					chkUser3 = cLng(rsCheck("M_LEVEL"))
			End Select
		end if	
	end if

	rsCheck.close	
	set rsCheck = nothing
end function

function chkCanDelete(fAM_ID, fM_ID)
	'## Forum_SQL
	strSql = "SELECT MEMBER_ID, M_LEVEL "
	strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
	StrSql = strSql & " WHERE MEMBER_ID = " & fM_ID

	set rsCheck = my_Conn.Execute (strSql)

	if rsCheck.BOF or rsCheck.EOF then
		chkCanDelete = 0 '## No Members Found
	else
		if cLng(rsCheck("MEMBER_ID")) = cLng(fAM_ID) then 
			chkCanDelete = 0 '## Can't delete self
		else
			Select case cLng(rsCheck("M_LEVEL"))
				case 1
					chkCanDelete = 1 '## Can delete Normal User
				case 2
					chkCanDelete = 1 '## Can delete Moderator
				case 3
					if fAM_ID <> intAdminMemberID then
						chkCanDelete = 0 '## Only the Forum Admin can delete other Administrators
					else
						chkCanDelete = 1 '## Forum Admin is ok to delete other Administrators
					end if
				case else
					chkCanDelete = 0 '## Member doesn't have a Member Level?
			End Select
		end if	
	end if

	rsCheck.close	
	set rsCheck = nothing
end function
%>

⌨️ 快捷键说明

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