推荐下天枫常用ASP函数封装,推荐大家使用

2019-04-02 04:46:55于丽

    '参  数:tstr ----字符串
    '****************************************************
    Public Function Replacehtml(tstr)
        Dim Str,re
        Str=Tstr
        Set re=new RegExp
            re.IgnoreCase =True
            re.Global=True
            re.Pattern="<(p|/p|br)>"
            Str=re.Replace(Str,vbNewLine)
            re.Pattern="<img.[^>]*src(=| )(.[^>]*)>"
            str=re.replace(str,"[img]$2[/img]")
            re.Pattern="<(.[^>]*)>"
            Str=re.Replace(Str,"")
            Set Re=Nothing
            Replacehtml=Str
    End Function


'---------------获取客户端和服务端的一些信息-------------------

    '****************************************************
    '函数名:GetIP
    '作  用:获取客户端IP地址
    '返回值:客户端IP地址
    '****************************************************
    Public Function GetIP()
        Dim Temp
        Temp = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
        If Temp = "" or isnull(Temp) or isEmpty(Temp) Then Temp = Request.ServerVariables("REMOTE_ADDR")
        If Instr(Temp,"'")>0 Then Temp="0.0.0.0"
        GetIP = Temp
    End Function

    '****************************************************
    '函数名:GetBrowser
    '作  用:获取客户端浏览器信息
    '返回值:客户端浏览器信息
    '****************************************************