lockIP.asp
资源名称:qnmov30.rar [点击查看]
上传用户:qyswxdl
上传日期:2013-06-01
资源大小:1373k
文件大小:7k
源码类别:
家庭/个人应用
开发平台:
ASP/ASPX
- <!--#include file="../checkpost.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">
- <LINK href="inc/Admin_STYLE.CSS" type=text/css rel=stylesheet>
- <style type="text/css">
- <!--
- .样式3 {font-size: 9pt}
- -->
- </style>
- </HEAD>
- <BODY leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
- <!--#include file="top1.asp"-->
- <table width="100%" border="0" cellspacing="0" cellpadding="2">
- <tr>
- <td> </td>
- </tr>
- </table>
- <% const MaxPerPage=25
- if zcn="" or zcv="" then response.end
- if session("admin")="" then
- response.redirect"login.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="border">
- <tr>
- <th width="100%" colspan=2 bgcolor="#429AEF"><span class="样式3"><font color="#FFFFFF">访问IP限制管理—添加 </font> </span> </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=tdbg><div align="center"><font color="#FF0000">添加成功!<a href=lockip.asp>返回</a></font></div></td>
- </tr>
- </table>
- <span class="b1"><%else%></span>
- <table width="100%" border="0" cellpadding="3" cellspacing="1" class="border">
- <form action="LockIP.asp?action=add&reaction=save" method="post">
- <tr>
- <td width="20%" class=tdbg><div align="center">起始I P:</div></td>
- <td width="80%" class=tdbg>
- <span class="tdbg2">
- <input type="text" name="ip1" size="30" value="<%=GetIp1%>">
- </span> 如210..41.240.1</td>
- </tr>
- <tr>
- <td width="20%" height="23" class=tdbg>
- <div align="center">结尾I P:</div></td>
- <td width="80%" class=tdbg>
- <span class="tdbg2">
- <input type="text" name="ip2" size="30" value="<%=GetIp2%>">
- </span> 如210..41.240.255</td>
- </tr>
- <tr>
- <td width="20%" class=tdbg></td>
- <td width="80%" class=tdbg> <div align="left">
- <input type="submit" name="Submit" value="提 交">
- </div></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 "lockip.asp"
- response.end
- else
- %>
- <table width="100%" border="0" cellspacing="1" cellpadding="3" align=center class="border">
- <FORM name="myform" METHOD=POST ACTION="?action=delip">
- <tr background="IMAGES/topBar_bg.gif">
- <th height="21" colspan=4 class="title"><span class="样式3">访问IP限制管理—管理 <a href=lockip.asp?action=add>
- <font color="#FF0000">添加限制的IP地址</font></a> </span></th>
- </tr>
- <tr class="tdbg2">
- <td width="11%" height="20" align="center" bgcolor="#429AEF"><B><font color="#FFFFFF">ID号</font></B></td>
- <td width="27%" align="center" bgcolor="#429AEF"><B><font color="#FFFFFF">起始IP</font></B></td>
- <td width="22%" align="center" bgcolor="#429AEF"><B><font color="#FFFFFF">结尾IP</font></B></td>
- <td width="40%" align="center" bgcolor="#429AEF"><B><font color="#FFFFFF">选择/全选</font></B>
- <font color="#FFFFFF">
- <input type=checkbox value="on" name="chkall" onclick="CheckAll(this.form)">
- </font></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="tdbg">
- <td colspan=4 ><div align="center">还没有任何允许访问限制IP数据!</div></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="tdbg" >
- <td width="11%" height="20" align="center"><%=rs("id")%></td>
- <td width="27%" align="center"><%=rs("sip1")%></td>
- <td width="22%" align="center" ><%=rs("sip2")%></td>
- <td width="40%" align="center">
- <input type=checkbox name="delid" value="<%=cstr(rs("ID"))%>"></td>
- </tr>
- <%
- page_count = page_count + 1
- rs.movenext
- wend
- %>
- <tr class="tdbg">
- <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>
- <span class="b1"><%
- end if
- %></span>
- <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>
- <br>
- </BODY></HTML>