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

📄 admin_lockip.asp

📁 动感系统XP Access版,服务器需要安装Jmail 组件 配置SendMessages.asp 最后部分的参数
💻 ASP
字号:
<!-- #include file="conn.asp" -->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/function.asp" -->
<HTML><HEAD><TITLE>后台管理 </TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="admin.css" type=text/css rel=stylesheet>
</HEAD>
<BODY leftMargin=0 topMargin=0>
<!-- #include file="admin_header.asp" -->
<table width="100%" border="0" cellspacing="2">
  <tr>
    <td width="20%" align="center" valign="top" class="tdbgleft"><!-- #include file="Admin_Left.asp" --></td> 
    <td  class="b1" valign="top"> 
      <%  const MaxPerPage=25
	if cUserName="" then
	   msgtitle="非法操作"
       msginfo="<li>你没有登录系统。<li><a href=""User.Asp"" target=_top>点此登录系统</a></li>"
      call Sysmsg(msgtitle,msginfo)  
	else
		if chkMaster(cUserName) then   
			call main()
		else
			msgtitle="非法操作"
			msginfo="<li>操作错误,你不是系统管理员,没有权限进行此项操作!</li>" 
			call Sysmsg(msgtitle,msginfo) 
		end if
	end if

sub main()
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">访问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

	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from SoftDown_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.update
	rs.close
	set rs=nothing
%>
        <tr> 
          <td width="100%" colspan=2 class=tdbg2>添加成功!</td>
        </tr>
		</table>
<%else%>
      <table width="100%">
        <form action="admin_LockIP.asp?action=add&reaction=save" method="post">
          <tr> 
            <td width="20%" class=tdbg2>起始I&nbsp;P</td>
            <td width="80%" class=tdbg2>
<input type="text" name="ip1" size="30" value="<%=GetIp1%>">
              &nbsp;如202.152.12.1</td>
          </tr>
          <tr> 
            <td width="20%" class=tdbg2>结尾I&nbsp;P</td>
            <td width="80%" class=tdbg2>
<input type="text" name="ip2" size="30" value="<%=GetIp2%>">
              &nbsp;如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 SoftDown_lockip where id in ("&request.form("delid")&")")
	response.write "删除成功!"
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">访问IP限制管理—管理</th>
          </tr>
          <tr class="tdbg2"> 
            <td width="15%" 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 isInteger(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 SoftDown_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"> 
            <td width="15%" 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
end sub
%>
      <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>
<!-- #include file="admin_footer.asp" -->
</BODY></HTML>
<% CloseDatabase %>

⌨️ 快捷键说明

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