文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ASP限制某段IP地址- ASP教程-

ASP限制某段IP地址- ASP教程-

时间:2010-08-28  来源:深圳的天空

 

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)
  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


相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载