% if session ("WinMyDNSUserName")="" then response.redirect "index.asp" response.end end if if session("WinMyDNSIsAdmin")<>"Y" then response.redirect "index.asp" response.end end if %>
![]() |
|
<% act=SafeRequest("act") ID= SafeRequest("ID") select case act case "add_pre" call Add_Pre() case "edit_pre" call Edit_Pre() case "add" if SafeRequest("ip")="" then response.write "错误:IP不能为空" else conn.execute ("insert into iptable (ip,mask,netid,remark) values ('"&SafeRequest("ip")&"',"&SafeRequest("mask")&","&SafeRequest("netid")&",'"&SafeRequest("remark")&"')") response.write "操作成功" end if call List() case "addm" ipm = SafeRequest("ipm") sql = "" for each str in split(ipm,vbcrlf) if str<>"" then strA = split(str," ") sql = " delete from iptable where ip='"&strA(0)&"' " conn.execute(sql) sql = " insert into iptable (ip,mask,netid) values ('"&strA(0)&"',"&strA(1)&","&SafeRequest("netid")&") " conn.execute(sql) end if next 'if sql<>"" then conn.execute(sql) call List() case "edit" if SafeRequest("ip")="" then response.write "错误:IP不能为空" else sql = "update iptable set ip='"&SafeRequest("ip")&"',mask="&SafeRequest("mask")&",netid="&SafeRequest("netid")&",remark='"&SafeRequest("remark")&"' where ID="&ID 'response.write sql conn.execute (sql) response.write "操作成功" end if call List() case "del" conn.execute (" delete from iptable where id="&SafeRequest("ID")) response.write "操作成功" call List() case "delm" conn.execute (" delete from iptable where netid="&SafeRequest("netid")) response.write "操作成功" call List() case "masktest" call masktest() case else call List end select sub List() sip = SafeRequest("sip") PageSize = SafeRequest("PageSize") netid = SafeRequest("netid") sql = "select a.*,b.netname from [iptable] a left join net b on a.netid=b.id where 1=1 " if netid<>"" then sql = sql & " and a.netid="&netid&" " if sip<>"" then sql = sql & " and a.ip like '%"&sip&"%' " sql = sql & " order by netname,ip " 'set rs = conn.execute(sql) set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 if not rs.eof then if not isempty(SafeRequest("page")) then if IsNumeric(SafeRequest("page")) = True then pagecount=cint(SafeRequest("page")) else pagecount=1 end if else pagecount=1 end if PageSize = SafeRequest("PageSize") if PageSize="" or not IsNumeric(PageSize) then PageSize = "100" end if rs.pagesize=PageSize if pagecount>rs.pagecount or pagecount<=0 then pagecount=1 end if if not rs.eof then rs.AbsolutePage=pagecount end if %>
<% end sub sub Edit_Pre() ID=SafeRequest("ID") set rs =conn.execute("select * from iptable where ID="&ID) if rs.eof then response.write "IP分配表["&ID&"]不存在" response.end end if %> <% end sub function masktest_fun(ip_b,ip_e) if ip_b="" then exit function if ip_e="" then masktest_fun="子网掩码是[32],表示的IP范围是:"&ip_b&"至"&ip_b exit function end if if ip_b=ip_e then masktest_fun="子网掩码是[32],表示的IP范围是:"&ip_b&"至"&ip_b exit function end if ip_bA = split(ip_b,".") ip_bn = clng(ip_bA(0))*256*256*256+clng(ip_bA(1))*256*256+clng(ip_bA(2))*256+clng(ip_bA(3)) ip_eA = split(ip_e,".") ip_en = clng(ip_eA(0))*256*256*256+clng(ip_eA(1))*256*256+clng(ip_eA(2))*256+clng(ip_eA(3)) end function %> |
||||||||||||||||||