📄 user-banned-ips.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/user-banned-ips.asp"
if lcase(strReferedBy) <> lcase(strCurrentURL) then
response.redirect(Site_Forum_URL & "/default.asp")
end if
set rsIP = server.createobject("adodb.recordset")
sqlIP = "SELECT * FROM Forum_BadIP WHERE Bad_IP = '"& request.form("IP") &"'"
rsIP.cursortype = 2
rsIP.locktype = 3
rsIP.open sqlIP, adoConn
if not (rsIP.eof or rsIP.bof) then
rsIP.delete
end if
rsIP.close
set rsIP = nothing
response.redirect(Site_Forum_URL & "user-banned-ips.asp")
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/user-banned-ips.asp"
if lcase(strReferedBy) <> lcase(strCurrentURL) then
response.redirect(Site_Forum_URL & "/default.asp")
end if
'Check for a valid IP Address
strIPString = split(trim(request.form("IP")), ".")
strIPCnt = ubound(strIPString) + 1
tempCnt = 0
if strIPCnt = 4 then
do until tempCnt = strIPCnt
if isnumeric(strIPString(tempCnt)) = false then
strError = "You have entered an invalid IP address. IP Addresses must consist solely of numbers to be valid."
else
if strIPString(tempCnt) < 0 or strIPString(tempCnt) > 255 then
strError = "You have entered an invalid IP Address. IP Address must not contain numbers lower 0 or greater than 255 to be valid."
end if
end if
tempCnt = tempCnt + 1
loop
else
strError = "You have entered an invalid IP Address. IP Address must only consist of four banks of up to three digits ranging between 0 and 255 to be valid."
end if
if strError = "" then
set rsIP = server.createobject("adodb.recordset")
sqlIP = "SELECT * FROM Forum_BadIP"
rsIP.cursortype = 2
rsIP.locktype = 3
rsIP.open sqlIP, adoConn
rsIP.addnew
rsIP("Bad_IP") = request.form("IP")
rsIP.update
rsIP.close
set rsIP = nothing
response.redirect(Site_Forum_URL & "/user-banned-ips.asp")
else
%>
<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="left">
<%=strError%>
</td>
</tr>
</table>
<%
end if
end if
if strError = "" then
%>
<table border="0" cellspacing="1" cellpadding="2" align="center" class="main">
<tr valign="middle" class="title">
<td align="center" colspan="2"><%=Site_Name%> // Banned IP Addresses</td>
</tr>
<%
set rsIPs = server.createobject("adodb.recordset")
sqlIPs = "SELECT Bad_IP FROM Forum_BadIP"
rsIPs.open sqlIPs, adoConn, CMDtext
if not (rsIPs.eof or rsIPs.bof) then
IPCnt = rsIPs.recordcount
IPData = rsIPs.getrows()
else
IPCnt = 0
end if
rsIPs.close
set rsIPs = nothing
tempCnt = 0
if IPCnt = 0 then
%>
<tr valign="top" class="body">
<td align="left" colspan="2">There are no current banned IP Addresses.</td>
</tr>
<%
else
do until tempCnt = IPCnt
%>
<form action="user-banned-ips.asp?Action=Remove" method="post" onSubmit="this.button.disabled = true;">
<tr valign="middle" class="body">
<td align="left"><%=IPData(0,tempCnt)%></td>
<td width="200" align="center">
<input name="IP" type="hidden" value="<%=IPData(0,tempCnt)%>">
<input name="button" type="submit" value="Remove" style="width: 75px;">
</td>
</tr>
</form>
<%
tempCnt = tempCnt + 1
loop
end if
%>
</table>
<table border="0" align="center" cellpadding="2" cellspacing="1" class="main">
<tr valign="top" class="title">
<td align="center" colspan="2"><%=Site_Name%> // Add New IP Address</td>
</tr>
<tr valign="top" class="body">
<td align="left" colspan="2">Add a new IP Address by filling in the complete IP Address in the box below and hitting the ban button.</td>
</tr>
<form action="user-banned-ips.asp?Action=Update" method="post" onSubmit="this.button.disabled=true;">
<tr valign="middle" class="body">
<td align="left"><input name="IP" type="text" id="IP" 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 + -