📄 user-banned-users.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("Clear") <> "" 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
if lcase(strReferedBy) <> lcase(strCurrentURL) then
response.redirect(Site_Forum_URL & "/default.asp")
end if
'Authorize user
set rsAuth = server.createobject("adodb.recordset")
sqlAuth = "SELECT User_Name, User_Status FROM Forum_Users WHERE User_ID = "& clng(request.querystring("Clear")) &""
rsAuth.cursortype = 2
rsAuth.locktype = 3
rsAuth.open sqlAuth, adoConn
if not (rsAuth.eof or rsAuth.bof) then
strUser = rsAuth("User_Name")
rsAuth("User_Status") = 1
rsAuth.update
end if
rsAuth.close
set rsAuth = nothing
if strUser <> "" then
'Display user authorization message
%>
<table border="0" cellspacing="1" cellpadding="2" align="center" class="main">
<tr valign="middle" class="title">
<td align="center"><%=Site_Name%> // User Athorized</td>
<tr valign="top" class="body">
<td align="center">
The user <b><%=strUser%></b> has been successfully authorized and can now freely access <%=Site_Name%>.
</td>
</tr>
</table>
<%
else
'User not found, display error
%>
<table border="0" cellspacing="1" cellpadding="2" align="center" class="main">
<tr valign="middle" class="title">
<td align="center"><%=Site_Name%> // Error</td>
<tr valign="top" class="body">
<td align="center">
There's been an error and the user that you specified could not be found, please go back and try again.
</td>
</tr>
</table>
<%
end if
end if
if request.querystring("Delete") <> "" 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/user-banned-users.asp"
if lcase(strReferedBy) <> lcase(strCurrentURL) then
response.redirect(Site_Forum_URL & "/default.asp")
end if
'Delete the user from the database (to add: delete any other details relating to the user)
set rsDelete = server.createobject("adodb.recordset")
sqlDelete = "SELECT * FROM Forum_Users WHERE User_ID = "& clng(request.querystring("Delete")) &""
rsDelete.cursortype = 2
rsDelete.locktype = 2
rsDelete.open sqlDelete, adoConn
if not (rsDelete.eof or rsDelete.bof) then
rsDelete.delete
strHeader = "// Deleted"
strMessage = "The selected user has now been deleted from the user base"
else
strHeader = "// Error"
strMessage = "The selecetd user could not be found, please resubmit your search query and try again."
end if
rsDelete.close
set rsDelete = nothing
'Update stats
set rsStats = server.createobject("adodb.recordset")
sqlStats = "SELECT User_ID, User_Name FROM Forum_Users ORDER BY User_Join_Date DESC;"
rsStats.open sqlStats, adoConn
strUserID = rsStats("User_ID")
strUserName = rsStats("User_Name")
rsStats.close
if strUserID <> "" then
sqlStats = "UPDATE Forum_Stats SET Stats_Users = (Stats_Users - 1), Stats_User_ID = "& strUserID &", Stats_User_Name = '"& strUserName &"';"
rsStats.open sqlStats, adoConn
end if
set rsStats = nothing
'Display message
%>
<table border="0" cellspacing="0" cellpadding="0" align="center" class="main">
<tr valign="middle" class="title">
<td align="center"><%=Site_Name%> // <%=strHeader%></td>
<tr valign="top" class="body">
<td align="center">
<%=strMessage%>
</td>
</tr>
</table>
<%
end if
if request.querystring("Delete") = "" and request.querystring("Clear") = "" then
%>
<table border="0" cellspacing="1" cellpadding="0" align="center" class="main">
<tr valign="middle" class="title">
<td align="center" colspan="3"><%=Site_Name%> // Banned Users</td>
<tr valign="top" class="body">
<td colspan="3">
The following list of users are all of the users who have been banned from the <%=Site_Name%> forums. From the list below you can selectively choose whether to remove a users ban or delete the users account from the database. </td>
</tr>
<tr valign="middle" class="sub-title">
<td width="250">
User Name
</td>
<td width="200">
Email
</td>
<td align="center">
Options
</td>
</tr>
<%
'Find all of the users that meet the search criteria, if any
Set rsUser = Server.CreateObject("ADODB.Recordset")
SqlUser = "SELECT User_ID, User_Name, User_Email FROM Forum_Users WHERE User_Status = 2 ORDER BY User_Name"
rsUser.open sqlUser, adoConn, CMDText
if not (rsUser.eof or rsUser.bof) then
UserCnt = rsUser.recordcount
UserData = rsUser.getrows()
else
UserCnt = 0
end if
rsUser.close
set rsUser = nothing
if UserCnt <> 0 then
tempCnt = 0
'Loop through all of the users that match the criteria
do until tempCnt = UserCnt
%>
<tr valign="top" class="body">
<td>
<%=UserData(1, tempCnt)%>
</td>
<td>
<%=UserData(2, tempCnt)%>
</td>
<td align="center">
<a href="user-banned-users.asp?Clear=<%=UserData(0, tempCnt)%>">Clear Ban</a> - <a href="user-banned-users.asp?Delete=<%=UserData(0, tempCnt)%>">Delete User</a>
</td>
</tr>
<%
tempCnt = tempCnt + 1
loop
else
%>
<tr valign="top" class="body">
<td colspan="3">No Users Found. Woohoo, there are no currently banned users of the <%=Site_Name%> forums! Pat yourself on the back.</td>
</tr>
<%
end if
%>
</table>
<%
end if
%>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -