asp判断IP地址是否合法
发布:liao | 发布时间: 2008年2月28日如果你想做一个IP查询那么你就要先判断这个IP地址是否合法,下法写一个这样的函数来判断是否合法.
<%
function chk_ip(strIP)
dim boolIsIP
dim arrIP
boolIsIP=true '函数初始值为true
arrIP=split(strIP,".") '将输入的IP用"."分割为数组,数组下标从0开始,所以有效IP分割后的数组上界必须为3
if ubound(arrIP)<>3 then
boolIsIP=false
else
for intLoop=0 to Ubound(arrIP)
if not isnumeric(arrIP(intLoop)) then '检查数组元素中各项是否为数字,如果不是则不是有效IP
boolIsIP=false
else
if arrIP(intLoop)>255 or arrIP(intLoop)<0 then '检查IP数字是否满足IP的取值范围
boolIsIP=false
end if
end if
next
end if
chk_ip=boolIsIp
end function
%>
- 相关文章:
AJAX实现4级联动菜单 (2008-2-26 17:18:29)
加密ASP原码 (2008-2-26 16:30:55)
asp过漏HTML标记 (2008-2-26 16:27:35)
asp小偷程序原理示例 (2008-1-17 23:20:45)
asp采集程序 (2008-1-15 22:52:46)
什么是asp技术 (2008-1-10 8:20:16)
发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。





