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

📄 admin-administrators.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">
	<%
	if request.querystring("Action") = "Remove" 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-administrators.asp"
		
		if lcase(strReferedBy) <> lcase(strCurrentURL) then
			response.redirect(Site_Forum_URL & "/default.asp")
		end if
		
		'Remove the chosen admin
		if int(request.form("ID")) <> 1 and int(request.form("ID")) <> session("userid") then 
			set rsRemove = server.createobject("adodb.recordset")
			sqlRemove = "SELECT * FROM Forum_Admin WHERE Admin_User_ID = "& request.form("ID") &""
			rsRemove.cursortype = 2
			rsRemove.locktype = 3
			rsRemove.open sqlRemove, adoConn
			if not (rsRemove.eof or rsRemove.bof) then
				'Admin found remove and generate confirmation message
				rsRemove.delete
				strHeader = "Success"
				strMessage = "The chosen Administrator has been successfully removed from the database and has had all privelages removed. Click <a href='"& Site_Forum_URL &"/Admin'>here</a> to return to the Admin homepage."
			else
				'Admin not found generate error message
				strHeader = "Error"
				strMessage = "There has been an error removing the chosen administrator. Please click <a href='"& Site_Forum_URL &"/Admin/admin-administrators.asp'>here</a> to try again."	
			end if
			rsRemove.close
			set rsRemove = nothing
		else
			if int(request.form("ID")) = 1 then
				strHeader = "Error"
				strMessage = "You cannot remove this user from the administrators list as they are the boards creator. Please click <a href='"& Site_Forum_URL &"/Admin/admin-administrators.asp'>here</a> to try again."	
			else
				strHeader = "Error"
				strMessage = "You cannot remove yourself from the administrators list if you are desperate to hang up your spurs you must ask one of the other Administrators . Please click <a href='"& Site_Forum_URL &"/Admin/admin-administrators.asp'>here</a> to try again."	
			end if
		end if
	end if
	
	if request.querystring("Action") = "Update" 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-administrators.asp"
		
		if lcase(strReferedBy) <> lcase(strCurrentURL) then
			response.redirect(Site_Forum_URL & "/default.asp")
		end if
		
		'Check a valid User_ID has been entered
		if isnumeric(request.form("ID")) = true then
			if  request.form("ID") <> "" 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_Admin"
					rsUpdate.cursortype = 2
					rsUpdate.locktype = 3
					rsUpdate.open sqlUpdate, adoConn
					rsUpdate.addnew
					rsUpdate("Admin_User_ID") = request.form("ID")
					rsUpdate.update
					rsUpdate.close
					set rsUpdate = nothing
					strHeader = "Success"
					strMessage = "Congratulations "& strUser &" has been successfully added to the administrator roster with full administrator priveledges. Click <a href='"& Site_Forum_URL &"/Admin'>here</a> to return to the Admin homepage."
				else
					strHeader = "Error"
					strMessage = "There was an error adding your chosen user to the administrators group as the entered User ID did not tally up with any users currently registered with this forum or the chosen user has not yet activated their account. Please click <a href='"& Site_Forum_URL &"/Admin/admin-administrators.asp'>here</a> to re-configure the board admins."
				end if
			else
				strHeader = "Error"
				strMessage = "There was an error adding your chosen user to the administrators group as the entered User ID did not tally up with any users currently registered with this forum or the chosen user has not yet activated their account. Please click <a href='"& Site_Forum_URL &"/Admin/admin-administrators.asp'>here</a> to re-configure the board admins."
			end if
		else
			strHeader = "Error"
			strMessage = "There was an error adding your chosen user to the administrators group as you did not enter a valid user ID, please make sure to enter a numeric user ID. Please click <a href='"& Site_Forum_URL &"/Admin/admin-administrators.asp'>here</a> to re-configure the board admins."
		end if
	end if
	
	if strMessage <> "" then
	%>
		<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="middle" class="title">
			<td align="center" colspan="2"><%=Site_Name%> // 现有管理员名称:</td>
			</tr>
			<%
			set rsAdmins = server.createobject("adodb.recordset")
			sqlAdmins = "SELECT U.User_Name, U.User_ID FROM Forum_Users U, Forum_Admin A WHERE U.User_ID = A.Admin_User_ID"
			rsAdmins.open sqlAdmins, adoConn, CMDtext
			if not (rsAdmins.eof or rsAdmins.bof) then
				AdminCnt = rsAdmins.recordcount
				AdminData = rsAdmins.getrows()
			else
				AdminCnt = 0
			end if
			rsAdmins.close
			set rsAdmin = nothing
			
			tempCnt = 0
			
			do until tempCnt = AdminCnt
			%>
			<form action="admin-administrators.asp?Action=Remove" method="post" onSubmit="this.button.disabled = true;">
				<tr valign="middle" class="body">
				<td align="left">			
				<b><%=AdminData(0,tempCnt)%></b>				
				</td>
				<td width="200" align="center">
				<input name="ID" type="hidden" value="<%=AdminData(1,tempCnt)%>">
				<input name="button" type="submit" value="Remove" style="width: 75px">
				</td>
				</tr>
				</form>
				<%
				tempCnt = tempCnt + 1
			loop	
			%>
		</table>
		<table width="600" border="0" align="center" cellpadding="2" cellspacing="1" class="main">
			<tr valign="middle" class="title">
			<td align="center" colspan="2"><%=Site_Name%> // 添加管理员名称:</td>
			</tr>
			<tr valign="top" class="body">
			<td align="left" colspan="2">			
			Add a new forum administrator by typing the User <b>ID</b> in the box provided below.		
			</td>
			</tr>
			<form action="admin-administrators.asp?Action=Update" method="post" onSubmit="this.button.disabled = true;">
			<tr valign="middle" class="body">
			<td align="left"><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>
		</table>
	<%
	end if
	%>
	</td>
  	</tr>
</table>

</body>
</html>

⌨️ 快捷键说明

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