ASP的自定义实用函数表1.docx

上传人:b****6 文档编号:2991834 上传时间:2022-11-16 格式:DOCX 页数:26 大小:25.54KB
下载 相关 举报
ASP的自定义实用函数表1.docx_第1页
第1页 / 共26页
ASP的自定义实用函数表1.docx_第2页
第2页 / 共26页
ASP的自定义实用函数表1.docx_第3页
第3页 / 共26页
ASP的自定义实用函数表1.docx_第4页
第4页 / 共26页
ASP的自定义实用函数表1.docx_第5页
第5页 / 共26页
点击查看更多>>
下载资源
资源描述

ASP的自定义实用函数表1.docx

《ASP的自定义实用函数表1.docx》由会员分享,可在线阅读,更多相关《ASP的自定义实用函数表1.docx(26页珍藏版)》请在冰豆网上搜索。

ASP的自定义实用函数表1.docx

ASP的自定义实用函数表1

ASP的自定义实用函数表

(1)

2004-9-206:

55:

00  作者:

模板天下收集整理  来源:

未知 网友评论0条 论坛

  '汉字判断

functionisChinese(para)

    onerrorresumenext

      ifisNUll(para)then

          isChinese=false

          exitfunction

      endif

      iftrim(para)=""then

          isChinese=false

          exitfunction

      endif

      dimc

      fori=1tolen(para)

    c=asc(mid(para,i,1))

            ifc>=0then

    isChinese=false

              exitfunction

          endif

      next

      isChinese=true

      iferr.number<>0thenerr.clear

endfunction

%>

如:

ifnotisChinese(request("name"))then

errmsg=errmsg+"

"+"

  • 用户名应为汉字"

    founderr=true

    else

    username=trim(request("name"))

    endif

    ----------------------------------------------

    '替换指定文件内字符串的函数

    <%

    functionFSOlineedit(filename,Target,String)

    DimobjFSO,objCountFile,FiletempData

    SetobjFSO=Server.CreateObject("Scripting.FileSystemObject")

    SetobjCountFile=objFSO.OpenTextFile(Server.MapPath(filename),1,True)

    FiletempData=objCountFile.ReadAll

    objCountFile.Close

    FiletempData=Replace(FiletempData,Target,String)

        SetobjCountFile=objFSO.CreateTextFile(Server.MapPath(filename),True)

    objCountFile.WriteFiletempData

    objCountFile.Close

    SetobjCountFile=Nothing

    SetobjFSO=Nothing

    EndFunction

    response.writeFSOlineedit("test.txt","世界","明天是一个好天去")

    %>

    ----------------------------------------------

    '获取中文字符串拼音首字母串的函数

    <%

    response.write""

    ifrequest.form("content")=""then

    response.write"

    __"

    else

    functiongetpychar(char)

    tmp=65536+asc(char)

    if(tmp>=45217andtmp<=45252)then

    getpychar="A"

    elseif(tmp>=45253andtmp<=45760)then

    getpychar="B"

    elseif(tmp>=45761andtmp<=46317)then

    getpychar="C"

    elseif(tmp>=46318andtmp<=46825)then

    getpychar="D"

    elseif(tmp>=46826andtmp<=47009)then

    getpychar="E"

    elseif(tmp>=47010andtmp<=47296)then

    getpychar="F"

    elseif(tmp>=47297andtmp<=47613)then

    getpychar="G"

    elseif(tmp>=47614andtmp<=48118)then

    getpychar="H"

    elseif(tmp>=48119andtmp<=49061)then

    getpychar="J"

    elseif(tmp>=49062andtmp<=49323)then

    getpychar="K"

    elseif(tmp>=49324andtmp<=49895)then

    getpychar="L"

    elseif(tmp>=49896andtmp<=50370)then

    getpychar="M"

    elseif(tmp>=50371andtmp<=50613)then

    getpychar="N"

    elseif(tmp>=50614andtmp<=50621)then

    getpychar="O"

    elseif(tmp>=50622andtmp<=50905)then

    getpychar="P"

    elseif(tmp>=50906andtmp<=51386)then

    getpychar="Q"

    elseif(tmp>=51387andtmp<=51445)then

    getpychar="R"

    elseif(tmp>=51446andtmp<=52217)then

    getpychar="S"

    elseif(tmp>=52218andtmp<=52697)then

    getpychar="T"

    elseif(tmp>=52698andtmp<=52979)then

    getpychar="W"

    elseif(tmp>=52980andtmp<=53640)then

    getpychar="X"

    elseif(tmp>=53689andtmp<=54480)then

    getpychar="Y"

    elseif(tmp>=54481andtmp<=62289)then

    getpychar="Z"

    else'如果不是中文,则不处理

    getpychar=char

    endif

    endfunction

    functiongetpy(str)

    fori=1tolen(str)

    getpy=getpy&getpychar(mid(str,i,1))

    next

    endfunction

    content=request.form("content")

    response.write"

    "&getpy(content)&chr(10)

    response.write"


    history.go(-1)>返回"

    endif

    %>

    --------------------------------------------

    ip限制函数

    '******************************

    'FunctionCheckIp(cInput_Ip,cBound_Ip)

    'Createdbyqqdao,qqdao@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支持’*‘,不想对?

    支持,因为和*差不多

    '******************************

    functionCheckIp(cInput_Ip,cBound_Ip)

    dimcSingle_Ip,cTemp_IP,cStart_IP,cEnd_Ip

    CheckIp=false

    cSingle_Ip=split(cBound_Ip,";")

            fori=0toubound(cSingle_Ip)

                ifInstr(cSingle_Ip(i),"REFUSE")<>0then    '就是拒绝了

                    cTemp_IP=left(cSingle_Ip(i),instr(cSingle_Ip(i),":

    ")-1)

              

          ifInstr(cTemp_IP,"*")<>0then  '是宽范围

              cStart_IP=left(cTemp_IP,instr(cTemp_IP,"*")-1)

              ifleft(cInput_Ip,len(cStart_IP))=cStart_IPthen

              CheckIp=false

              exitfunction

              endif

                endif

          ifInstr(cTemp_IP,"-")=0then

      cStart_IP=cTemp_IP

      cEnd_Ip  =cTemp_IP

          else

      cStart_IP=left(cTemp_IP,instr(cTemp_IP,"-")-1)

      cEnd_Ip  =left(cStart_IP,InStrRev(cStart_IP,".")-1)+"."+mid(cTemp_IP,instr(cTemp_IP,"-")+1)

          endif

          if  Ip2Str(cInput_Ip)>=Ip2Str(cStart_IP)andIp2Str(cInput_Ip)<=Ip2Str(cEnd_Ip)then

              CheckIp=false

              exitfunction

          endif

        elseifInstr(cSingle_Ip(i),"ALLOW")<>0then    '允

  • 展开阅读全文
    相关资源
    猜你喜欢
    相关搜索

    当前位置:首页 > 幼儿教育 > 幼儿读物

    copyright@ 2008-2022 冰豆网网站版权所有

    经营许可证编号:鄂ICP备2022015515号-1