asp验证Ip格式的函数
程序员文章站
2023-08-24 11:27:07
验证ip格式<% '****************************** '函数:checkip(par_strip) '参数:str 要检测的字符...
验证ip格式<%
'******************************
'函数:checkip(par_strip)
'参数:str 要检测的字符串
'作者:阿里西西
'日期:2007/7/13
'描述:验证ip格式,是返回1,否则返回0
'示例:<%=checkip("219.45.23.11")%>
'******************************
function checkip(par_strip)
checkip =0
dim tmploop, tmpstr
tmpstr =par_strip
if tmpstr ="" or isnull(tmpstr) then exit function
tmpstr =split(tmpstr, ".")
if not isarray(tmpstr) then exit function
for tmploop =0 to ubound(tmpstr)
if tmpstr(tmploop) ="" or isnull(tmpstr(tmploop)) then exit function
if not isnumeric(tmpstr(tmploop)) then exit function
if cint(tmpstr(tmploop)) >255 or cint(tmpstr(tmploop)) <1 then exit function
next
checkip =1
end function
%>
'******************************
'函数:checkip(par_strip)
'参数:str 要检测的字符串
'作者:阿里西西
'日期:2007/7/13
'描述:验证ip格式,是返回1,否则返回0
'示例:<%=checkip("219.45.23.11")%>
'******************************
function checkip(par_strip)
checkip =0
dim tmploop, tmpstr
tmpstr =par_strip
if tmpstr ="" or isnull(tmpstr) then exit function
tmpstr =split(tmpstr, ".")
if not isarray(tmpstr) then exit function
for tmploop =0 to ubound(tmpstr)
if tmpstr(tmploop) ="" or isnull(tmpstr(tmploop)) then exit function
if not isnumeric(tmpstr(tmploop)) then exit function
if cint(tmpstr(tmploop)) >255 or cint(tmpstr(tmploop)) <1 then exit function
next
checkip =1
end function
%>