asp验证Ip格式的函数_应用技巧

验证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
%>

时间: 2024-07-31 16:37:26

asp验证Ip格式的函数_应用技巧的相关文章

asp 下用正则表达式检测邮箱格式的函数_应用技巧

'********************************************************* '函数:IsValidEmail[str] '参数:str,待处理的字符串 '作者:木木 '日期:2007/7/12 '描述:检测邮箱格式是否为xxxx@xxx.com或者xxxx@xxx.com.cn等格式 '示例:<%=IsValidEmail(ali@alixixi.com)%> '*********************************************

asp.net ToString()格式设置大全_实用技巧

C 货币 2.5.ToString("C") ¥2.50 D 十进制数 25.ToString("D5") 00025 E 科学型 25000.ToString("E") 2.500000E+005 F 固定点 25.ToString("F2") 25.00 G 常规 2.5.ToString("G") 2.5 N 数字 2500000.ToString("N") 2,500,000.0

收集整理的ASP的常用内置函数_应用技巧

函数,就是该语言封装了的一个功能块,以方便用户的调用.比如"now()"在VBScript中就是一个能显示出当前日期和时间的函数.至于具体为什么能显示,则是该语言内核所定的,用户只需明白"now()"就是用来能显示日期时间的.那么,我们当前接触的VBScript还有其他什么功能的函数么? 1,日期/时间函数 这些函数包括对"年"."月"."日"."时"."分".&qu

asp实现过滤关键字的函数_应用技巧

过滤关键字<% '****************************** '函数:ChkKeyWord(ByVal keyword) '参数:keyword,关键字 '作者:阿里西西 '日期:2007/7/15 '描述:过滤关键字 '示例:ChkKeyWord("sfsdfdf'8&5ddd") '****************************** Function ChkKeyWord(ByVal keyword)   Dim FobWords, i  

asp 实现视频显示的效果函数_应用技巧

<% '****************************** '函数:SelPlay(strUrl,strWidth,StrHeight) '参数:strUrl,动画视频路径:strWidth,视频高度:StrHeight,视频高度 '作者:阿里西西 '日期:2007/7/13 '描述:取得用户真实IP,对代理地址仍然有效:返回值:文本类型的IP地址 '示例:<%=SelPlay("mov.swf","120","90")%&

ASP实现强制图片下载函数_应用技巧

图片不进行处理,图片默认是用浏览器打开显示,如果希望图片变为下载可以使用以下代码 function downloadFile(strFile) strFilename = server.MapPath(strFile) Response.Buffer = True Response.Clear Set s = Server.CreateObject("ADODB.Stream") s.Open s.Type = 1 on error resume next Set fso = Serv

asp生成三维饼图的函数_应用技巧

为方便生成三维饼图函数,我收集了asp下的生成三维饼图的函数的代码,方便大家特殊情况下的使用 复制代码 代码如下: <% '参数含义(数组,横坐标,纵坐标,图表的宽度,图表的高度,图表标题,单位) function table2(stat_array,table_left,table_top,all_width,all_height,table_title,unit)        dim bg_color(10),pie(10)        bg_color(1)="#ff1919&q

asp最常用的分页函数_应用技巧

复制代码 代码如下:     rs.open sql,conn,1,1     if rs.eof and rs.bof then      response.write "<p align='center'>还没找到文章</p>"   else    totalPut=rs.recordcount    maxperpage=18    if currentpage<1 then     currentpage=1     end if    if (c

改进一下asp自带的formatNumber函数_应用技巧

asp的formatNumber再处理类似 25/5的值时,结果是 5.00  处理类似 28/8的值时,结果是3.50  改进一下,去掉没用的0  让结果分别是 5和3.5 复制代码 代码如下: Function fm(nb) If IsNumeric(nb) Then Dim a a=FormatNumber(nb,2,-1) If Right((a+""),2)=00 Then fm=CLng(a) Else fm=FormatNumber(nb,1,-1) End if Els