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

📄 admin-moderators.asp

📁 简介:一个程序小巧而功能强大
💻 ASP
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--#include file="../Includes/site-dataconn.asp" -->
<!--#include file="../Includes/func-common.asp" -->
<!--#include file="../Includes/site-config.asp" -->
<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
<html>

<head>
<title>// <%=Site_Name%> //</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK REL=stylesheet TYPE="text/css" HREF="../Includes/Site-Style.css">
</head>

<body>
	
<%
'Admin Check
if session("admin") <> true then
	response.redirect(Site_Forum_URL & "/default.asp")
end if
%>
<table width="100%" height="10" border="0" cellspacing="0" cellpadding="1">
  	<tr valign="top">
    <td width="150">
	<!--#include file="inc-navigation.asp" -->
	</td>
    <td align="center">
	<%
	Action = request.querystring("Action")
	if Action = "Submit" then
		'check that the form was submitted from here
		if instr(1, request.servervariables("HTTP_REFERER"), "?", 1) > 0 then
			strReferedBy = left(request.servervariables("HTTP_REFERER"), (instr(1, request.servervariables("HTTP_REFERER"), "?", 1)-1))
		else
			strReferedBy = request.servervariables("HTTP_REFERER")
		end if
		strCurrentURL = Site_Forum_URL &"/Admin/admin-moderators.asp"
		
		if lcase(strReferedBy) <> lcase(strCurrentURL) then
			response.redirect(Site_Forum_URL & "/default.asp")
		end if
		
		if request.querystring("Method") = "Remove" then
			set rsRemove = server.createobject("adodb.recordset")
			sqlRemove = "SELECT * FROM Forum_Moderator WHERE Mod_User_ID = "& request.form("ID") &" AND Mod_Forum_ID = "& request.form("Forum") &""
			rsRemove.cursortype = 2
			rsRemove.locktype = 3
			rsRemove.open sqlRemove, adoConn
			if not (rsRemove.eof or rsRemove.bof) then
				rsRemove.delete
				strHeader = "Success"
				strMessage = "The chosen user has been sucessfully removed as a moderator from the seleced forum. Please click <a href='"& Site_Forum_URL &"/Admin'>here</a> to return to the admin homepage."
			else
				strheader = "Error"
				strMessage = "Unfortunately there was an error and the selected user could not be found. Please click <a href='"& Site_Forum_URL &"/Admin/admin-administrators.asp'>here</a> to try again."
			end if
			rsRemove.close
			set rsRemove = nothing
		end if
		
		if request.querystring("Method") = "Update" then
			if isnumeric(request.form("ID")) = true then
				set rsCheck = server.createobject("adodb.recordset")
				sqlCheck = "SELECT * FROM Forum_Users WHERE User_ID = "& clng(request.form("ID")) &" AND User_Status = 1;"
				rsCheck.open sqlCheck, adoConn
				if not (rsCheck.eof or rsCheck.bof) then
					strUser = rsCheck("User_Name")
					set rsUpdate = server.createobject("adodb.recordset")
					sqlUpdate = "SELECT * FROM Forum_Moderator WHERE Mod_User_ID = '"& int(request.form("ID")) &"'"
					rsUpdate.cursortype = 2
					rsUpdate.locktype = 3
					rsUpdate.open sqlUpdate, adoConn
					if rsUpdate.eof or rsUpdate.bof then
						rsUpdate.addnew
						rsUpdate("Mod_User_ID") = int(request.form("ID"))
						rsUpdate("Mod_Forum_ID") = int(request.form("Forum"))
						rsUpdate.update
						strHeader = "Success"
						strMessage = "Congratulations "& strUser &" has been succesfully added as a moderator for the selected forum. Please click <a href='"& Site_Forum_URL &"/Admin'>here</a> to return to the admin section."
					else
						strHeader = "Error"
						strMessage = "The selected user is already a moderator of this forum. Please click <a href='"& Site_Forum_URL &"/Admin'>here</a> to return to the admin section."
					end if
					rsUpdate.close
					set rsUpdate = nothing
				else
					strHeader = "Error"
					strMessage = "There was an error and the selected user could not be found. Please click <a href='"& Site_Forum_URL &"/Admin/admin-administrators.asp'>here</a> to try again."
				end if
			else
				strHeader = "Error"
				strMessage = "You did not enter avalid User ID, all user ID's must be numeric. Please click <a href='"& Site_Forum_URL &"/Admin/admin-administrators.asp'>here</a> to try again."
			end if
		end if
		%>
		<table border="0"cellpadding="2" cellspacing="1" align="center" class="main">
			<tr valign="top" class="title">
			<td align="center"><%=Site_Name%> // <%=strHeader%></td>
			</tr>
			<tr valign="top" class="body">
			<td align="center"><%=strMessage%></td>
			</tr>
		</table>		
		<%
	else
	%>
		<table width="600" border="0" cellspacing="1" cellpadding="2" class="main" align="center">
			<tr valign="top" class="title">
			<td align="center" colspan="2"><%=Site_Name%> //版主添加·删除</td>
			</tr>
			<tr valign="top" class="body">
			<td align="left" colspan="2">		
			To view, and alter, the moderators of a forum please click on the forums name in the section below to expand it. You may view the moderators details by clicking on their name.<br>		
			</td>
			</tr>
			<%
			set rsModerator = server.createobject("adodb.recordset")
			sqlModerator = "SELECT Forum_ID, Forum_Name, Category_Title FROM Forum_Forums, Forum_Categories WHERE Forum_Category_ID <> 10 AND Forum_Category_ID = Category_ID ORDER BY Forum_Category_ID ASC, Forum_Order ASC"
			rsModerator.open sqlModerator, adoConn, CMDtext
			if not (rsModerator.eof or rsModerator.bof) then
				ModCnt = rsModerator.recordcount
				ModData = rsModerator.getrows()
			else
				ModCnt = 0
			end if
			rsModerator.close
			set rsModerator = nothing
			
			tmpForumCnt = 0
			tempCategory = ""
			do until tmpForumCnt = ModCnt
				if tempCategory <> ModData(2, tmpForumCnt) then
					tempCategory = ModData(2, tmpForumCnt)
					%>
					<tr valign="top" class="title">
					<td align="left" colspan="2">				
					<%=ModData(2, tmpForumCnt)%>				
					</td>
					</tr>
					<%
				end if
				%>
				<tr valign="top" class="sub-title">
				<td align="left" colspan="2">			
				<a href="admin-moderators.asp?Forum=<%=ModData(0, tmpForumCnt)%>"><%=ModData(1, tmpForumCnt)%></a>		
				</td>
				</tr>
				<%
				if ModData(0, tmpForumCnt) = int(request.querystring("Forum")) then
					'grab moderator details and list them here
					set rsUser = server.createobject("adodb.recordset")
					sqlUser = "SELECT User_ID, User_Name FROM Forum_Users, Forum_Moderator WHERE User_ID = Forum_Moderator.Mod_User_ID AND Mod_Forum_ID = "& ModData(0, tmpForumCnt) &""
					rsUser.open sqlUser, adoConn, CMDtext
					if not (rsUser.eof or rsUser.bof) then
						UserCnt = rsUser.recordcount
						UserData = rsUser.getrows()
						rsUser.close
						set rsUser = nothing
	
						tmpUserCnt = 0
						
						do until tmpUserCnt = UserCnt
							%>
							<form action="admin-moderators.asp?Action=Submit&Method=Remove" method="post" onSubmit="this.button.disabled = true;">
							<tr valign="top" class="body">
							<td width="400" align="left" valign="middle">						
							<input name="ID" type="hidden" value="<%=UserData(0, tmpUserCnt)%>"><a href="user-users-edit.asp?action=edit&uid=<%=UserData(0, tmpUserCnt)%>"><%=UserData(1, tmpUserCnt)%></a>						
							</td>
							<td align="center"><input name="Forum" type="hidden" value="<%=ModData(0, tmpForumCnt)%>"><input name="button" type="submit" value="Remove" style="width: 75px;"></td>
							</tr>
							</form>
							<%
							tmpUserCnt = tmpUserCnt + 1
						loop
	
					else
						rsUser.close
						set rsUser = nothing
						%>
						<tr valign="top" class="body">
						<td align="left" colspan="2">					
						No Moderator					
						</td>
						</tr>
					<%
					end if
					%>
					<tr valign="top" class="body">
					<td align="left" colspan="2">				
					Add a new moderator to this forum by entering the user <b>ID</b> in the box below.
					</td>
					</tr>
					<form action="admin-moderators.asp?Action=Submit&Method=Update" method="post" onSubmit="this.button.disabled = true;">
					<tr valign="middle" class="body">
					<td align="left"><input name="Forum" type="hidden" value="<%=ModData(0, tmpForumCnt)%>"><input name="ID" type="text" id="ID" style="border: 1px solid black;" value="" size="60"></td>
					<td width="200" align="center"><input type="submit" name="button" value="Submit" style="width: 75px;"></td>
					</tr>
					</form>
					<%
				end if
				tmpForumCnt = tmpForumCnt + 1
			loop	
			%>
		</table>
	<%
	end if
	%>
	</td>
  	</tr>
</table>

</body>
</html>

⌨️ 快捷键说明

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