欢迎光临
我们一直在努力

限制某段IP地址-ASP教程,ASP应用

建站超值云服务器,限时71元/月

function ip2num(sip)
 dim str1,str2,str3,str4
 dim num
 ip2num=0
 if isnumeric(left(sip,2)) then
  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=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
  ip2num = num
 end if
end function

function num2ip(nip)
 iip1 = int(nip/256/256/256)
 iip2 = int((nip-iip1*256*256*256)/256/256)
 iip3 = int((nip-iip1*256*256*256-iip2*256*256)/256)
 iip4 = int((nip-iip1*256*256*256-iip2*256*256-iip3*256) mod 256)
 iip0 = iip1 &”.”& iip2 & “.” &iip3 &”.”& iip4
 num2ip = iip0
end function

useripnum = ip2num(request.servervariables(“remote_addr”))

if useripnum > ip2num(“192.168.0.0”) and useripnum < ip2num(“192.168.0.255”) then
 response.write (“<center>您的ip被禁止</center>”)
 response.end
end if

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 限制某段IP地址-ASP教程,ASP应用
分享到: 更多 (0)