• 文件名命名相关函数,自动生成HTML


    '文件名命名相关函数,自动生成HTML

    <%
    '**************************************************************
    '文件名检测函数
    '
    '**************************************************************

    '判断文件名windows下的文件名是否合法
    Function isValidWindowsFilename(aFilename)
    Dim sErrorStr,iNameLength,i
    isFilename=TRUE
    sErrorStr=Array("/","/",":","*","?","""","<",">","|")
    iNameLength=Len(aFilename)
    If iNameLength<1 or iNameLength=null or iNameLength>255 Then
    isValidWindowsFilename=FALSE
    Else
    if instr(aFilename,".htm")>0 or instr(aFilename,".html")>0 or instr(aFilename,".asp")>0 or instr(aFilename,".shtml")>0 then
    For i=0 To 8
    If instr(aFilename,sErrorStr(i)) Then
    isValidWindowsFilename=FALSE
    End If
    Next
    else
    isValidWindowsFilename=FALSE
    end if

    End If

    End Function
    'windows 文件名定义标准
    '“ 主文件名 . 扩展名 ”
    '命名规则:
    'a. 文件名最多达 255 个字符;
    'b. 可使用多间隔符的扩展名,例如: a.b.c. 作文件名;
    'c. 可以包括空格,但不能使用::?*"<>//| ;
    'd. 不区分大小写字符,不区分中英文;
    'e. 显示或查询时可用 通配符 :?和 *
    '?:任意一个字符; * :任意个字符,(可以是一个,也可是多个)

    '********************************************
    '判断文件名DOS下的文件名是否合法8.3格式
    '
    '********************************************
    Function isValidDosFilename(aFilename)

    Dim sErrorStr,iNameLength,i
    isValidDosFilename=TRUE
    sErrorStr=Array("/","/",":","*","?","""","<",">","|")
    iNameLength=Len(aFilename)

    If iNameLength<1 or iNameLength=null or iNameLength>8 Then
    isValidDosFilename=FALSE
    Else
    For i=0 To 8
    If instr(aFilename,sErrorStr(i)) Then
    isValidDosFilename=FALSE
    End If
    Next
    End If

    End Function


    '*******************************************
    '函数作用:取得当前文件的外部访问地址URL,
    '
    '*******************************************
    Function FileUrl(url,D)
     Dim PageUrl,PUrl,ServerPort,ServerURL
     PageUrl="http://"& Request.ServerVariables("SERVER_NAME")
     ServerPort=Request.ServerVariables("SERVER_PORT")
     if ServerPort<>80 then
     PageUrl=PageUrl&":"&ServerPort
     else
     PageUrl=PageUrl
     end if  
     ServerURL=Replace(D,"/","/")
     PageUrl=PageUrl & "/" & Mid(D,2,Len(D)) & "/" & url
     FileUrl=PageUrl
    End Function

    '去掉字符串头尾的连续的回车和空格
    function trimVBcrlf(str)
    trimVBcrlf=rtrimVBcrlf(ltrimVBcrlf(str))
    end function

    '去掉字符串开头的连续的回车和空格
    function ltrimVBcrlf(str)
    dim pos,isBlankChar
    pos=1
    isBlankChar=true
    while isBlankChar
    if mid(str,pos,1)=" " then
    pos=pos+1
    elseif mid(str,pos,2)=VBcrlf then
    pos=pos+2
    else
    isBlankChar=false
    end if
    wend
    ltrimVBcrlf=right(str,len(str)-pos+1)
    end function

    '去掉字符串末尾的连续的回车和空格
    function rtrimVBcrlf(str)
    dim pos,isBlankChar
    pos=len(str)
    isBlankChar=true
    while isBlankChar and pos>=2
    if mid(str,pos,1)=" " then
    pos=pos-1
    elseif mid(str,pos-1,2)=VBcrlf then
    pos=pos-2
    else
    isBlankChar=false
    end if
    wend
    rtrimVBcrlf=rtrim(left(str,pos))
    end function
    '检测特殊字符
    Function IsSafeStr(str)
     Dim s_BadStr,n,i
     s_BadStr = "'  &<>?%,;:()`~!@#$^*{}[]|+-=" & Chr(34) & Chr(9) & Chr(32)
     n = Len(s_BadStr)
     IsSafeStr = True
     For i = 1 To n
      If Instr(str,Mid(s_BadStr,i,1)) > 0 Then
       IsSafeStr = False
       Exit Function
      End If
     Next
    End Function


    '********************************
    '生成随机字符,n为字符的个数
    'Response.write RandChar(5)
    '********************************
    function RandCharacter(n)
     dim thechr
     thechr = ""
     for i=1 to n
      dim zNum,zNum2
      Randomize
      zNum = cint(25*Rnd)
      zNum2 = cint(10*Rnd)
      if zNum2 mod 2 = 0 then
       zNum = zNum + 97
      else
       zNum = zNum + 65
      end if
      thechr = thechr & chr(zNum)
     next
    RandCharacter = thechr
    end function
    '********************************
    '生成大写随机字符,n为字符的个数
    'Response.write RandUCaseCharacter(5)
    '********************************
    function RandUCaseCharacter(n)
     dim thechr
     thechr = ""
     for i=1 to n
      dim zNum,zNum2
      Randomize
      zNum = cint(25*Rnd)
      zNum2 = cint(10*Rnd) 
      zNum = zNum + 65
      thechr = thechr & chr(zNum)
     next
     RandUCaseCharacter = thechr
    end function
    '********************************
    '生成小写随机字符,n为字符的个数
    'Response.write RandLCaseCharacter(5)
    '********************************
    function RandLCaseCharacter(n)
     dim thechr
     thechr = ""
     for i=1 to n
      dim zNum,zNum2
      Randomize
      zNum = cint(25*Rnd)
      zNum2 = cint(10*Rnd) 
      zNum = zNum + 97
      thechr = thechr & chr(zNum)
     next
     RandLCaseCharacter = thechr
    end function
    '********************************
    '生成随机字符,n为字符的个数
    'Response.write RandCharCase(5,"L")
    '********************************
    function RandCharacterWithCase(n,strCase)
     dim thechr
     thechr = ""
     for i=1 to n
      dim zNum,zNum2
      Randomize
      zNum = cint(25*Rnd)
      zNum2 = cint(10*Rnd) 
      if Ucase(strCase)="L" then
      zNum = zNum + 97 
      else
      zNum = zNum + 65
      end if
      thechr = thechr & chr(zNum)
     next
     RandCharacterWithCase = thechr
    end function

    '********************************
    '生成随机数字
    'digits数字位数
    'Response.write RandNumeric(5)
    '********************************
    function RandNumeric(digits)
    dim rndnum,num
    Randomize
    Do while Len(rndnum)<digits
    num = Cstr(Chr((57-48)*rnd+48))
    rndnum = rndnum & num
    Loop
    RandNumeric = rndnum
    End function
    '********************************
    '生成限定范围内的随机数字
    'startNum开始数字,endNum结束数字
    'Response.write MyRand(100,1000)
    '********************************
    function  RandNumericArea(startNum,endNum)  
      randomize  
      RandNumericArea =Int((endNum-startNum+1)*Rnd+startNum)  
    end Function

    '************************
    'MyRandn(n) 生成随机数字,n为数字的个数
    'response.Write(RandNumericLen(9))
    '************************
    function RandNumericLen(n)
     dim thechr
     thechr = ""
     for i=1 to n
      dim zNum,zNum2
      Randomize
      zNum = cint(9*Rnd)
      zNum = zNum + 48
      thechr = thechr & chr(zNum)
     next
    RandNumericLen = thechr
    end function


    '********************************
    '生成不重复随机数字1
    'response.write RandArray(1,100,5)
    '********************************

    function RandNumericArray(istart,iend,sum)
    dim arrayid(),i,j,blnre,temp,iloop,eloop
    redim arrayid(sum-1)
    i=0
    iloop=0
    eloop=0
    blnre=false
    randomize
    do while i<sum
    temp=int(rnd*(iend-istart+1)+istart)
    if i=0 then
    arrayid(0)=temp
    i=i+1
    iloop=iloop+1
    else

    for j=0 to i-1
    if arrayid(j)=temp then
    blnre=true
    iloop=iloop+1
    exit for'这一句很重要,防止多余的循环
    else
    iloop=iloop+1
    end if
    next

     if blnre=false then
     arrayid(i)=temp
     i=i+1
     else
     blnre=false
     end if

    end if
    eloop=eloop+iloop
    iloop=0
    loop
    RandNumericArray=join(arrayid)
    '循环次数:"&eloop
    end function

    '********************************
    '生成不重复随机数字2
    'response.write"<br>"&RandCharacterArray(1,5,3)
    '********************************
    function RandCharacterArray(istart,iend,isum)
    dim i,j,vntarray()
    redim vntarray(iend-istart)
    j=istart
    for i=0 to iend-istart
    vntarray(i)=j
    j=j+1
    next

    dim vntarray2(),temp,x,y
    redim vntarray2(isum-1)
    y=iend-istart+1
    x=0
    temp=vntarray
    do while x<isum
    dim a
    randomize
    vntarray2(x)=temp(int(rnd*y))
    a=" "&vntarray2(x)&" "
    temp=split(trim(replace(chr(32)&join(temp)&chr(32),a," ")))
    x=x+1
    y=y-1
    loop
    RandCharacterArray=join(vntarray2)
    end function

    '*****************************************************
    '生成随机文件名函数
    'Response.Write RandMaxedString(8)
    'sErrorStr=Array("/","/",":","*","?","""","<",">","|")
    '*****************************************************
    Function RandMaxedFileName(Length)
    dim i,tempS,v
    dim c(39)
    tempS = ""
    c(1) = "a": c(2) = "b": c(3) = "c": c(4) = "d": c(5) = "e": c(6) = "f": c(7) = "g"
    c(8) = "h": c(9) = "i": c(10) = "j": c(11) = "k": c(12) = "l": c(13) = "m": c(14) = "n"
    c(15) = "o": c(16) = "p": c(17) = "q": c(18) = "r": c(19) = "s": c(20) = "t": c(21) = "u"
    c(22) = "v": c(23) = "w": c(24) = "x": c(25) = "y": c(26) = "z": c(27) = "1": c(28) = "2"
    c(29) = "3": c(30) = "4": c(31) = "5": c(32) = "6": c(33) = "7": c(34) = "8": c(35) = "9"
    c(36) = "-": c(37) = "_": c(38) = "@": c(39) = "!"

    If isNumeric(Length) = False Then
    response.Write("<script language=javascript>alert('函数参数错误.不接受非数字字符');history.back();</script>")
    response.end
    Exit Function
    End If

    For i = 1 to Length
    Randomize
    v = Int((39 * Rnd) + 1)
    tempS = tempS & c(v)
    Next
    RandMaxedFileName = tempS
    End Function

    '*******************************************
    '生成N位数字跟大写字母混合的字符串函数
    'response.Write(RandCharacterNumeric(4))
    '*******************************************
    function RandMaxed(maxLen)
    Dim strNewPass
    Dim whatsNext,upper,lower,intCounter
    Randomize
    For intCounter = 1 To maxLen
    whatsNext = Int((1 - 0 + 1) * Rnd + 0)
    If whatsNext = 0 Then
    'Character
    upper = 90
    lower = 65
    Else
    'Numeric
    upper = 57
    lower = 48
    End If
    strNewPass = strNewPass & Chr(Int((upper - lower + 1) * Rnd + lower))
    Next
    RandMaxed= strNewPass
    end function

    '*******************************************
    '随机生成数字大小写字母混合的字符串函数
    'response.Write(RandMaxedKey(4))
    '*******************************************
    Function RandMaxedKey(digits)
    dim char_array(61)
    char_array(0) = "0"
    char_array(1) = "1"
    char_array(2) = "2"
    char_array(3) = "3"
    char_array(4) = "4"
    char_array(5) = "5"
    char_array(6) = "6"
    char_array(7) = "7"
    char_array(8) = "8"
    char_array(9) = "9"
    char_array(10) = "a"
    char_array(11) = "b"
    char_array(12) = "c"
    char_array(13) = "d"
    char_array(14) = "e"
    char_array(15) = "f"
    char_array(16) = "g"
    char_array(17) = "h"
    char_array(18) = "i"
    char_array(19) = "j"
    char_array(20) = "k"
    char_array(21) = "l"
    char_array(22) = "m"
    char_array(23) = "n"
    char_array(24) = "o"
    char_array(25) = "p"
    char_array(26) = "q"
    char_array(27) = "r"
    char_array(28) = "s"
    char_array(29) = "t"
    char_array(30) = "u"
    char_array(31) = "v"
    char_array(32) = "w"
    char_array(33) = "x"
    char_array(34) = "y"
    char_array(35) = "z"
    char_array(36) = "A"
    char_array(37) = "B"
    char_array(38) = "C"
    char_array(39) = "D"
    char_array(40) = "E"
    char_array(41) = "F"
    char_array(42) = "G"
    char_array(43) = "H"
    char_array(44) = "I"
    char_array(45) = "J"
    char_array(46) = "K"
    char_array(47) = "L"
    char_array(48) = "M"
    char_array(49) = "N"
    char_array(50) = "O"
    char_array(51) = "P"
    char_array(52) = "Q"
    char_array(53) = "R"
    char_array(54) = "S"
    char_array(55) = "T"
    char_array(56) = "U"
    char_array(57) = "V"
    char_array(58) = "W"
    char_array(59) = "X"
    char_array(60) = "Y"
    char_array(61) = "Z"
    randomize
    do while len(output) < digits
    num = char_array(Int(61 * Rnd + 0))
    output = output + num
    loop
    RandMaxedKey = output
    End Function
    '*********************************
    '获取文件名中的后缀名函数
    '
    '*********************************
    function GenerateExtendName(filename)
    dim tmp
    if filename<>"" then
    tmp=mid(filename,instrrev(filename,".")+1,len(filename)-instrrev(filename,"."))
    tmp=LCase(tmp)
    GenerateExtendName=tmp
    else
    GenerateExtendName=""
    end if
    end function

    function GenerateExtendID(strNumber)

       select case len(strNumber)
       case 1
           GenerateExtendID="0000"&strNumber
       case 2
           GenerateExtendID="000"&strNumber
       case 3
           GenerateExtendID="00"&strNumber
       case 4
           GenerateExtendID="0"&strNumber
       case else
           GenerateExtendID=strNumber
       end select
    end function


    '***************************************
    '文件内容检测函数
    '
    '***************************************

    '检测空格
    ' * 函数:HTMLDecode
    ' * 描述:过滤HTML代码
    ' *----------------------------------------------------------------------------
    function HTMLDecode(fString)
    if not isnull(fString) then
    fString = replace(fString, ">", ">")
    fString = replace(fString, "<", "<")

    fString = Replace(fString, CHR(32), " ")
    fString = Replace(fString, CHR(9), " ")
    fString = Replace(fString, CHR(34), """")
    fString = Replace(fString, CHR(39), "'")
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
    fString = Replace(fString, CHR(10), "<BR> ")

    HTMLDecode = fString
    end if
    end function

    Function RepBadChar(strChar)
      If strChar="" Then
       RepBadChar=""
     Else
       RepBadChar=Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(strChar,"'",""),"*",""),"?",""),"(","&#40;"),")","&#41;"),"<",""),".","&#46;")," ","")
      End if
    End function
    '**********************************
    '检查提交数据合法性
    Function CheckInput()
     '--------定义部份------------------
     Dim Fy_Post,Fy_Get,Fy_In,Fy_Inf,Fy_Xh,Fy_db,Fy_dbstr,Kill_IP,WriteSql
     '自定义需要过滤的字串,用 "|" 分隔
     Fy_In = "'|;|and|(|)|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
     
     Fy_Inf = split(Fy_In,"|")
     '--------POST部份------------------
     If Request.Form <> "" Then
      For Each Fy_Post In Request.Form
       For Fy_Xh = 0 To Ubound(Fy_Inf)
        If Instr(LCase(Request.Form(Fy_Post)),Fy_Inf(Fy_Xh)) <> 0 Then
         Echo "<Script Language=JavaScript>alert('请不要在参数中包含非法字符!');history.go(-1);</Script>"
         Response.End
        End If
       Next
      Next
     End If
     '--------GET部份-------------------
     If Request.QueryString <> "" Then
      For Each Fy_Get In Request.QueryString
       For Fy_Xh = 0 To Ubound(Fy_Inf)
        If Instr(LCase(Request.QueryString(Fy_Get)),Fy_Inf(Fy_Xh)) <> 0 Then
         Echo "<Script Language=JavaScript>alert('请不要在参数中包含非法字符!');history.go(-1);</Script>"
         Response.End
        End If
       Next
      Next
     End If
    End Function

    '********************************************
    '过滤危险脚本
    '
    '**********************************************
    Function ReadContent(strContent)
            On Error Resume Next
            Dim re, i
            Dim sContentKeyword, strKeyword
            Set re = New RegExp
            re.IgnoreCase = True
            re.Global = True
            '过滤危险脚本
            re.Pattern = "(<s+cript(.[^>]*)>)"
            strContent = re.Replace(strContent, "<Script$2>")
            re.Pattern = "(<//s+cript>)"
            strContent = re.Replace(strContent, "</Script>")
            re.Pattern = "(<body(.[^>]*)>)"
            strContent = re.Replace(strContent, "<body>")
            re.Pattern = "(</!(.[^>]*)>)"
            strContent = re.Replace(strContent, "<$2>")
            re.Pattern = "(</!)"
            strContent = re.Replace(strContent, "<!")
            re.Pattern = "(-->)"
            strContent = re.Replace(strContent, "-->")
            re.Pattern = "(javascript:)"
            strContent = re.Replace(strContent, "<i>javascript</i>:")
            If Trim(ContentKeyword) <> "" Then
                sContentKeyword = Split(ContentKeyword, "@@@")
                For i = 0 To UBound(sContentKeyword) - 1
                    strKeyword = Split(sContentKeyword(i), "$$$")
                    re.Pattern = "(" & strKeyword(0) & ")"
                    strContent = re.Replace(strContent, "<a target=""_blank"" href=""" & strKeyword(1) & """ class=""wordstyle"">$1</a>")
                Next
            End If
            re.Pattern = "(/[i/])(.[^/[]*)(/[//i/])"
            strContent = re.Replace(strContent, "<i>$2</i>")
            re.Pattern = "(/[u/])(.[^/[]*)(/[//u/])"
            strContent = re.Replace(strContent, "<u>$2</u>")
            re.Pattern = "(/[b/])(.[^/[]*)(/[//b/])"
            strContent = re.Replace(strContent, "<b>$2</b>")
            re.Pattern = "(/[fly/])(.*)(/[//fly/])"
            strContent = re.Replace(strContent, "<marquee>$2</marquee>")
            re.Pattern = "/[size=([1-9])/](.[^/[]*)/[//size/]"
            strContent = re.Replace(strContent, "<font size=$1>$2</font>")
            re.Pattern = "(/[center/])(.[^/[]*)(/[//center/])"
            strContent = re.Replace(strContent, "<center>$2</center>")
            're.Pattern = "<IMG.[^>]*SRC(=| )(.[^>]*)>"
            'strContent = re.Replace(strContent, "<IMG SRC=$2 border=""0"">")
            re.Pattern = "<img(.[^>]*)>"
            strContent = re.Replace(strContent, "<img$1 onload=""return imgzoom(this,550)"">")
            re.Pattern = "/[DIR=*([0-9]*),*([0-9]*)/](.[^/[]*)/[//DIR]"
            strContent = re.Replace(strContent, "<embed src=$3 pluginspage=http://www.macromedia.com/shockwave/download/ width=$1 height=$2></embed>")
            re.Pattern = "/[QT=*([0-9]*),*([0-9]*)/](.[^/[]*)/[//QT]"
            strContent = re.Replace(strContent, "<embed src=$3 width=$1 height=$2 autoplay=true loop=false controller=true playeveryframe=false cache=false scale=TOFIT bgcolor=#000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/quicktime/>")
            re.Pattern = "/[MP=*([0-9]*),*([0-9]*)/](.[^/[]*)/[//MP]"
            strContent = re.Replace(strContent, "<embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src=$3  width=$1 height=$2></embed>")
            re.Pattern = "/[RM=*([0-9]*),*([0-9]*)/](.[^/[]*)/[//RM]"
            strContent = re.Replace(strContent, "<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width=$1 height=$2><PARAM NAME=SRC VALUE=$3><PARAM NAME=CONSOLE VALUE=Clip1><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=true></OBJECT><br><OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=32 id=video2 width=$1><PARAM NAME=SRC VALUE=$3><PARAM NAME=AUTOSTART VALUE=-1><PARAM NAME=CONTROLS VALUE=controlpanel><PARAM NAME=CONSOLE VALUE=Clip1></OBJECT>")
            re.Pattern = "(/[FLASH/])(.[^/[]*)(/[//FLASH/])"
            strContent = re.Replace(strContent, "<embed src=""$2"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=500 height=400>$2</embed>")
            re.Pattern = "(/[FLASH=*([0-9]*),*([0-9]*)/])(.[^/[]*)(/[//FLASH/])"
            strContent = re.Replace(strContent, "<embed src=""$4"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=$2 height=$3>$4</embed>")
            re.Pattern = "/[UPLOAD=(gif|jpg|jpeg|bmp|png)/](.[^/[]*)(gif|jpg|jpeg|bmp|png)/[//UPLOAD/]"
            strContent = re.Replace(strContent, "<br><A HREF=""$2$1"" TARGET=_blank><IMG SRC=""$2$1"" border=0 alt=按此在新窗口浏览图片 onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></A>")
            re.Pattern = "(/[UPLOAD=(.[^/[]*)/])(.[^/[]*)(/[//UPLOAD/])"
            strContent = re.Replace(strContent, "<br><a href=""$3"">点击浏览该文件</a>")
            re.Pattern = "(/[URL/])(.[^/[]*)(/[//URL/])"
            strContent = re.Replace(strContent, "<A HREF=""$2"" TARGET=_blank>$2</A>")
            re.Pattern = "(/[URL=(.[^/[]*)/])(.[^/[]*)(/[//URL/])"
            strContent = re.Replace(strContent, "<A HREF=""$2"" TARGET=_blank>$3</A>")
            re.Pattern = "(/[EMAIL/])(.[^/[]*)(/[//EMAIL/])"
            strContent = re.Replace(strContent, "<A HREF=""mailto:$2"">$2</A>")
            re.Pattern = "(/[EMAIL=(.[^/[]*)/])(.[^/[]*)(/[//EMAIL/])"
            strContent = re.Replace(strContent, "<A HREF=""mailto:$2"" TARGET=_blank>$3</A>")
            re.Pattern = "(/[HTML/])(.[^/[]*)(/[//HTML/])"
            strContent = re.Replace(strContent, "<table width='100%' border='0' cellspacing='0' cellpadding='6' bgcolor='#F6F6F6'><td><b>以下内容为程序代码:</b><br>$2</td></table>")
            re.Pattern = "(/[code/])(.[^/[]*)(/[//code/])"
            strContent = re.Replace(strContent, "<table width='100%' border='0' cellspacing='0' cellpadding='6' bgcolor='#F6F6F6'><td><b>以下内容为程序代码:</b><br>$2</td></table>")
            re.Pattern = "(/[color=(.[^/[]*)/])(.[^/[]*)(/[//color/])"
            strContent = re.Replace(strContent, "<font color=$2>$3</font>")
            re.Pattern = "(/[face=(.[^/[]*)/])(.[^/[]*)(/[//face/])"
            strContent = re.Replace(strContent, "<font face=$2>$3</font>")
            re.Pattern = "/[align=(center|left|right)/](.*)/[//align/]"
            strContent = re.Replace(strContent, "<div align=$1>$2</div>")
            re.Pattern = "(/[QUOTE/])(.*)(/[//QUOTE/])"
            strContent = re.Replace(strContent, "<table cellpadding=0 cellspacing=0 border=1 WIDTH=94% bordercolor=#000000 bgcolor=#F2F8FF align=center  ><tr><td  ><table width=100% cellpadding=5 cellspacing=1 border=0><TR><TD BGCOLOR='#F6F6F6'>$2</table></table><br>")
            re.Pattern = "(/[move/])(.*)(/[//move/])"
            strContent = re.Replace(strContent, "<MARQUEE scrollamount=3>$2</marquee>")
            re.Pattern = "/[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)/](.[^/[]*)/[//GLOW]"
            strContent = re.Replace(strContent, "<table width=$1 style=""filter:glow(color=$2, strength=$3)"">$4</table>")
            re.Pattern = "/[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)/](.[^/[]*)/[//SHADOW]"
            strContent = re.Replace(strContent, "<table width=$1 style=""filter:shadow(color=$2, strength=$3)"">$4</table>")
            Set re = Nothing
            strContent = Replace(strContent, "[InstallDir_ChannelDir]", InstallDir & "/" & ChannelDir)
            strContent = Replace(strContent, "{", "{")
            strContent = Replace(strContent, "}", "}")
            strContent = Replace(strContent, "$", "$")
            ReadContent = strContent
        End Function
    ' * 函数:HTMLcode
    ' * 描述:过滤表单字符
    ' *----------------------------------------------------------------------------
    function HTMLcode(fString)
    if not isnull(fString) then
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
    fString = Replace(fString, CHR(34), "")
    fString = Replace(fString, CHR(10), "<BR>")
    HTMLcode = fString
    end if
    end function


    %> 

  • 相关阅读:
    google浏览器切换成中文
    Python 进阶篇
    Linux 命令
    Linux
    Linux
    Linux
    Linux--shell脚本之文本处理工具
    Linux--shell脚本之正则表达式
    Linux
    Linux
  • 原文地址:https://www.cnblogs.com/xqf222/p/3306753.html
Copyright © 2020-2023  润新知