大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> ASP专区 -> ip范围限制函数

ip范围限制函数

时间: 2021-07-31 作者:daque

大师即使再有好的倡导算法,就接洽我!!:)'******************************'function checkip(cinput_ip,cbound_ip)'created by qqdao, qqdao@263.net 2001/11/28'证明:开始须要按照;号轮回,而后确定能否含有"-",即使有则举行拆分处置,结果确定能否在范畴内'参数: cinput_ip,代查看的ip'cbound_ip,给定的范畴方法为,单个ip,和范畴ip,范畴ip结果运用”-“分隔,即使是“*”则必需放到结果一位'每个范畴后增添":allow"表白承诺登岸,增添":refuse"表白中断登岸。多个范畴用”;“隔绝' 比方192.168.1*.*:allow;192.168.1.1:allow;192.168.1.1-10:refuse"'归来值: true/false'革新:2001/12/05扶助allow,refuse扶助’*‘,不想对?扶助,由于和*差不离'******************************function checkip(cinput_ip,cbound_ip)dim csingle_ip,ctemp_ip,cstart_ip,cend_ipcheckip = falsecsingle_ip=split(cbound_ip,";")for i=0 to ubound(csingle_ip)if instr(csingle_ip(i),"refuse") <> 0 then'即是中断了ctemp_ip = left(csingle_ip(i),instr(csingle_ip(i),":")-1) if instr(ctemp_ip,"*") <> 0 then'是宽范畴cstart_ip = left(ctemp_ip,instr(ctemp_ip,"*")-1)if left(cinput_ip,len(cstart_ip))=cstart_ip thencheckip = falseexit functionend ifend ifif instr(ctemp_ip,"-") = 0 thencstart_ip = ctemp_ipcend_ip = ctemp_ipelsecstart_ip = left(ctemp_ip,instr(ctemp_ip,"-")-1)cend_ip = left(cstart_ip,instrrev(cstart_ip,".")-1)+"."+mid(ctemp_ip,instr(ctemp_ip,"-")+1)end ifif ip2str(cinput_ip)>=ip2str(cstart_ip) and ip2str(cinput_ip)<=ip2str(cend_ip) thencheckip = falseexit functionend ifelseif instr(csingle_ip(i),"allow") <> 0 then '承诺 ctemp_ip = left(csingle_ip(i),instr(csingle_ip(i),":")-1)if instr(ctemp_ip,"*") <> 0 then'是宽范畴cstart_ip = left(ctemp_ip,instr(ctemp_ip,"*")-1)if left(cinput_ip,len(cstart_ip))=cstart_ip thencheckip = trueend ifend ifif instr(ctemp_ip,"-") = 0 thencstart_ip = ctemp_ipcend_ip = ctemp_ipelsecstart_ip = left(ctemp_ip,instr(ctemp_ip,"-")-1)cend_ip = left(cstart_ip,instrrev(cstart_ip,".")-1)+"."+mid(ctemp_ip,instr(ctemp_ip,"-")+1)end ifif ip2str(cinput_ip)>=ip2str(cstart_ip) and ip2str(cinput_ip)<=ip2str(cend_ip) thencheckip =trueelsecheckip =falseend ifend if nextend function'******************************'function ip2str(cip)'created by qqdao, qqdao@263.net 2001/11/28'参考动网ip算法'参数:cip ip地方'归来值: 变换后数值'******************************function ip2str(cip)dim str1,str2,str3,str4dim cip_tempif cip="127.0.0.1" then cip="192.168.0.1"str1=left(cip,instr(cip,".")-1)cip_temp=mid(cip,instr(cip,".")+1)str2=left(cip_temp,instr(cip_temp,".")-1)cip_temp=mid(cip_temp,instr(cip_temp,".")+1)str3=left(cip_temp,instr(cip_temp,".")-1)str4=mid(cip_temp,instr(cip_temp,".")+1)if isnumeric(str1)=0 or isnumeric(str2)=0 or isnumeric(str3)=0 or isnumeric(str4)=0 thenelseip2str=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1end ifend function

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.