📄 adminip.asp
字号:
<!--#include file="articleconn.asp"-->
<!--#include file="security.asp"-->
<%
if session("flag")>1 then
response.write "<br><p align=center>您没有操作的权限</p>"
response.end
end if
%>
<HTML><HEAD><TITLE>后台管理 </TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style type=text/css>
body { background:#799AE1; margin:0px; font:9pt 宋体; }
table { border:0px; }
td { font:normal 12px 宋体; }
img { vertical-align:bottom; border:0px; }
a { font:normal 12px 宋体; color:#000000; text-decoration:none; }
a:hover { color:#428EFF;text-decoration:underline; }
.sec_menu { border-left:1px solid white; border-right:1px solid white; border-bottom:1px solid white; overflow:hidden; background:#D6DFF7; }
.menu_title { }
.menu_title span { position:relative; top:2px; left:8px; color:#215DC6; font-weight:bold; }
.menu_title2 { }
.menu_title2 span { position:relative; top:2px; left:8px; color:#428EFF; font-weight:bold; }
</style>
</HEAD>
<BODY leftMargin=0 topMargin=0>
<div align=center>
<table width="620" border="0" cellspacing="2">
<tr>
<td width="2" align="center" valign="top" class="tdbgleft"></td>
<td class="b1" valign="top" width="608">
<% const MaxPerPage=25
if session("admin")="" then
response.redirect"17c.asp"
response.end
end if
dim userip,ips,GetIp1,GetIp2
if request("userip")<>"" then
userip=request("userip")
ips=Split(userIP,".")
GetIp1=ips(0)&"."&ips(1)&"."&ips(2)&".1"
GetIp2=ips(0)&"."&ips(1)&"."&ips(2)&".255"
else
userip=""
GetIp1=""
GetIp2=""
end if
if request("action")="add" then
%>
<table width="100%" border="0" cellspacing="1" cellpadding="3" align=center class="tableBorder">
<tr>
<th width="100%" colspan=2 class="tdbg1"><img src=images/dot_orange.jpg border=0>访问IP限制管理—添加</th>
</tr>
<%
dim sip,str1,str2,str3,str4,num_1,num_2
if request.querystring("reaction")="save" then
sip=cstr(request.form("ip1"))
'dot=instr(ip,".")-1
'response.write dot
str1=left(sip,cint(instr(sip,".")-1))
sip=mid(sip,cint(instr(sip,"."))+1)
str2=left(sip,cint(instr(sip,"."))-1)
sip=mid(sip,cint(instr(sip,"."))+1)
str3=left(sip,cint(instr(sip,"."))-1)
str4=mid(sip,cint(instr(sip,"."))+1)
num_1=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
sip=cstr(request.form("ip2"))
str1=left(sip,instr(sip,".")-1)
sip=mid(sip,instr(sip,".")+1)
str2=left(sip,instr(sip,".")-1)
sip=mid(sip,instr(sip,".")+1)
str3=left(sip,instr(sip,".")-1)
str4=mid(sip,instr(sip,".")+1)
num_2=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
'response.write num_1 &","& num_2
'response.end
conn.execute("insert into lockip (ip1,ip2,sip1,sip2) values ('"&num_1&"','"&num_2&"','"&request.form("ip1")&"','"&request.form("ip2")&"')")
'set rs = server.CreateObject ("adodb.recordset")
'sql="select * from LockIP"
'rs.open sql,conn,1,3
'rs.addnew
'rs("ip1")=num_1
'rs("ip2")=num_2
'rs("sip1")=request.form("ip1")
'rs("sip2")=request.form("ip2")
'rs.updat
'rs.closee
%>
<tr>
<td width="100%" colspan=2 class=tdbg2>添加成功!<a href=adminip.asp>返回</a></td>
</tr>
</table>
<%else%>
<table width="100%">
<form action="adminIP.asp?action=add&reaction=save" method="post">
<tr>
<td width="20%" class=tdbg2><img src=images/dot_orange.jpg border=0>起始I P</td>
<td width="80%" class=tdbg2>
<input type="text" name="ip1" size="30" value="<%=GetIp1%>">
如202.152.12.1</td>
</tr>
<tr>
<td width="20%" class=tdbg2><img src=images/dot_orange.jpg border=0>结尾I P</td>
<td width="80%" class=tdbg2>
<input type="text" name="ip2" size="30" value="<%=GetIp2%>">
如202.152.12.255</td>
</tr>
<tr>
<td width="20%" class=tdbg2></td>
<td width="80%" class=tdbg2>
<input type="submit" name="Submit" value="提 交">
</td>
</tr>
</form>
</table>
<%
end if
elseif request("action")="delip" then
conn.execute("delete from LockIP where id in ("&request.form("delid")&")")
response.write "删除成功!"
response.redirect "adminip.asp"
response.end
else
%>
<table width="100%" border="0" cellspacing="1" cellpadding="3" align=center class="tableBorder">
<FORM name="myform" METHOD=POST ACTION="?action=delip">
<tr>
<th width="100%" colspan=4 class="tdbg1"><img src=images/dot_orange.jpg border=0>访问IP限制管理—管理
<a href="adminip.asp?action=add">
<font color="#FF0000">添加限制的IP地址</font></a></th>
</tr>
<tr class="tdbg2" bgcolor="#CCCCCC">
<td width="5%" align="center" height="20"><B>ID号</B></td>
<td width="35%" align="center"><B>起始IP</B></td>
<td width="35%" align="center"><B>结尾IP</B></td>
<td width="15%" align="center"><B>选择/全选</B><input type=checkbox value="on" name="chkall" onclick="CheckAll(this.form)"></td>
</tr>
<%
dim currentpage,page_count,Pcount
dim totalrec,endpage
currentPage=request("page")
if currentpage="" or not int(currentpage) then
currentpage=1
else
currentpage=clng(currentpage)
if err then
currentpage=1
err.clear
end if
end if
sql="select id,sip1,sip2 from LockIP order by id desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
%>
<tr class="tdbg2">
<td width="100%" colspan=4>还没有任何允许访问IP数据。</td>
</tr>
<%
else
rs.PageSize = MaxPerPage
rs.AbsolutePage=currentpage
page_count=0
totalrec=rs.recordcount
while (not rs.eof) and (not page_count = MaxPerPage)
%>
<tr class="tdbg2" bgcolor="#F3F5F5">
<td width="8%" align="center" height="20"><%=rs("id")%></td>
<td width="35%" align="center"><%=rs("sip1")%></td>
<td width="35%" align="center"><%=rs("sip2")%></td>
<td width="15%" align="center">
<input type=checkbox name="delid" value="<%=cstr(rs("ID"))%>"></td>
</tr>
<%
page_count = page_count + 1
rs.movenext
wend
%>
<tr class="tdbg2">
<td colspan=3 align=center>分页:
<%Pcount=rs.PageCount
if currentpage > 4 then
response.write "<a href=""?page=1"">[1]</a> ..."
end if
if Pcount>currentpage+3 then
endpage=currentpage+3
else
endpage=Pcount
end if
for i=currentpage-3 to endpage
if not i<1 then
if i = clng(currentpage) then
response.write " <font color=red>["&i&"]</font>"
else
response.write " <a href=""?page="&i&""">["&i&"]</a>"
end if
end if
next
if currentpage+3 < Pcount then
response.write "... <a href=""?page="&Pcount&""">["&Pcount&"]</a>"
end if
%>
</td>
<td align=center>
<input type=submit name=submit value="删除">
</td>
</tr>
<%
end if
rs.close
set rs=nothing
%>
</FORM>
</table>
<%
end if
%>
<script language="JavaScript">
<!--
function CheckAll(form) {
for (var i=0;i<form.elements.length;i++) {
var e = form.elements[i];
if (e.name != 'chkall') e.checked = form.chkall.checked;
}
}
//-->
</script></td>
</tr>
</table>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -