主頁(yè) > 知識(shí)庫(kù) > 整理了一個(gè)editplus的剪輯文件(ASP方面的內(nèi)容)

整理了一個(gè)editplus的剪輯文件(ASP方面的內(nèi)容)

熱門標(biāo)簽:vue 地圖標(biāo)注拖拽 客服外呼系統(tǒng)呼叫中心 保定電銷機(jī)器人軟件 自動(dòng)外呼系統(tǒng)怎么防止封卡 土地證宗地圖標(biāo)注符號(hào) 鎮(zhèn)江云外呼系統(tǒng)怎么樣 電話機(jī)器人銷售公司嗎 成都銷售外呼系統(tǒng)公司 電話機(jī)器人案例

#TITLE=ASP常用語法及函數(shù)
#INFO
ASP常用的一些語法及自定義函數(shù)
#SORT=n

#T= ===ASP常用語法===
#T=============================
#T=數(shù)據(jù)庫(kù)相關(guān)
#T= 連接ACCESS數(shù)據(jù)庫(kù)
%
Dim DBName,Conn
DBName"^!"    '定義數(shù)據(jù)庫(kù)路徑及名稱
SET Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" Server.MapPath(DBName)
%>

#T= 連接MS SQL數(shù)據(jù)庫(kù)
%
Dim Conn
SET Conn=Server.CreateObject("ADODB.connection")
Conn.Open "PROVIDER=SQLOLEDB;DATA SOURCE=SQL服務(wù)器名稱或IP地址;UID=數(shù)據(jù)庫(kù)登錄帳號(hào);PWD=數(shù)據(jù)庫(kù)密碼;DATABASE=數(shù)據(jù)庫(kù)名稱"
%>

#T= 建立記錄集
SET ^!=Server.CreateObject("ADODB.recordset")

#T= 執(zhí)行SQL命令
RS.Open SQL,conn,1,1

#T= 執(zhí)行SQL命令
Conn.Execute("^!")

#T= RS直接執(zhí)行SQL命令
SET RS = Conn.Execute("^!")

#T= 關(guān)閉記錄集
RS.CLOSE
SET RS=NOTHING

#T= 關(guān)閉數(shù)據(jù)庫(kù)
Conn.Close
SET Conn=Nothing

#T=============================
#T=ServerVariables相關(guān)
#T= 取上一頁(yè)地址
Request.ServerVariables("HTTP_REFERER")

#T= 取服務(wù)器的名稱1
Request.ServerVariables("SERVER_NAME")

#T= 取服務(wù)器的名稱2
Request.ServerVariables("HTTP_HOST")

#T= 取服務(wù)器IP
Request.ServerVariables("LOCAL_ADDR")

#T= 取用戶IP
Request.ServerVariables("Remote_Host")

#T= 取用戶真實(shí)IP1
Request.serverVariables("REMOTE_ADDR")

#T= 取用戶真實(shí)IP函數(shù)
Function GetRealIP()
    GetRealIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    IF(GetRealIP = "")THEN GetRealIP = Request.ServerVariables("REMOTE_ADDR")
End Function

#T= 取服務(wù)器端口
Request.ServerVariables("SERVER_PORT")

#T= 取服務(wù)器操作系統(tǒng)
Request.ServerVariables("OS")

#T= 取服務(wù)器的絕對(duì)路徑
Request.ServerVariables("APPL_PHYSICAL_PATH")

#T= 取本文件的絕對(duì)路徑1
Requet.ServerVariables("PATH_TRANSLATED")

#T= 取本文件的絕對(duì)路徑2
Server.mappath(Request.ServerVariables("SCRIPT_NAME"))

#T= 取本文件的相對(duì)路徑1
Request.ServerVariables("URL")

#T= 取本文件的相對(duì)路徑2
Request.ServerVariables("SCRIPT_NAME")

#T= 取本文件的相對(duì)路徑3
Request.ServerVariables("PATH_INFO")

#T= 取地址欄后的參數(shù)
Request.ServerVariables("QUERY_STRING")

#T= 取服務(wù)器系統(tǒng)信息
Request.ServerVariables("HTTP_USER_AGENT")

#T= 服務(wù)器組件檢測(cè)
%
Function IsObjInstalled(strClassString)
    On Error Resume Next
    IsObjInstalled = False
    Err = 0
    Dim xTestObj
    SET xTestObj = Server.CreateObject(strClassString)
    IF(0 = Err)THEN IsObjInstalled = True
    SET xTestObj = Nothing
    Err = 0
End Function
'IF(IsObjInstalled("Persits.Upload")=True)THEN
'    Response.Write "支持AspUpload組件"
'ELSE
'    Response.Write "不支持AspUpload組件"
'END IF
%>

#T= 取客戶端語言環(huán)境
^!Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")

#T= 取客戶端信息:HTTP_USER_AGENT
^!Request.ServerVariables("HTTP_USER_AGENT")

#T= 取表單(Form)值元素值
Request.Form("^!")

#T= 取URL傳遞的值
Request.QueryString("^!")

#T= 取完整URL地址
Function GetUrl()
    GetUrl="http://"Request.ServerVariables("SERVER_N ... .ServerVariables("URL")
    IF(Request.ServerVariables("QUERY_STRING")>"")THEN GetURL=GetUrl"?" Request.ServerVariables("QUERY_STRING")
End Function

#T=============================
#T=自定義函數(shù)
#T= 過濾HTML字符
%
'過濾HTML字符函數(shù)
Function HTMLEncode(str)
    IF(str > "")THEN
        str = Replace(str, "", "")
        str = Replace(str, ">", "gt;")
        str = Replace(str, "", "lt;")
        str = Replace(str, Chr(32), "nbsp;")
        str = Replace(str, Chr(9), "nbsp;nbsp;nbsp;nbsp;")
        str = Replace(str, Chr(34), "quot;")
        str = Replace(str, Chr(39), "#39;")
        str = Replace(str, Chr(13), "")
        str = Replace(str, Chr(10) Chr(10), "/P>P>")
        str = Replace(str, Chr(10), "BR>")
        str = Replace(str, Chr(255), "nbsp;")
    END IF
    HTMLEncode = str
End Function
%>

#T= 檢測(cè)上頁(yè)是否從本站提交
%
'檢測(cè)上頁(yè)是否從本站提交
'返回:True,False
'===============================================================
Function IsSelfRefer()
    Dim sHttp_Referer, sServer_Name
    sHttp_Referer = CStr(Request.ServerVariables("HTTP_REFERER"))
    sServer_Name = CStr(Request.ServerVariables("SERVER_NAME"))
    IF(Mid(sHttp_Referer, 8, Len(sServer_Name)) = sServer_Name)THEN
        IsSelfRefer = True
    ELSE
        IsSelfRefer = False
    END IF
End Function
%>

#T= 清除所有HTML標(biāo)記
%
'清除HTML標(biāo)記
Function stripHTML(htmlStr)
    Dim regEx
    SET regEx = New Regexp
    regEx.IgnoreCase = True
    regEx.Global = True
    regEx.Pattern = ".+?>"
    htmlStr = regEx.Replace(htmlStr,"")
    htmlStr = Replace(htmlStr, "","lt;")
    htmlStr = Replace(htmlStr, ">","gt;")
    htmlStr = Replace(htmlStr,chr(10),"")
    htmlStr = Replace(htmlStr,chr(13),"")
    stripHTML = htmlStr
    SET regEx = Nothing
End Function

%>

#T= 取字符串長(zhǎng)度
%
'求字符串長(zhǎng)度函數(shù)
Function GetLength(str)
    Dim Length
    For i=1 to Len(str)
        IF(Asc(Mid(str,i,1))0 or Asc(Mid(str,i,1))>256)THEN
            Length=Length+2
        ELSE
            Length=Length+1
        END IF
    Next
    GetLength=Length
End Function
%>

#T= 截取指定長(zhǎng)度字符串
%
'截取指定長(zhǎng)度的字符串,多余的用...代替
Function StrLeft(str,strlen)
    IF(str = "")THEN
        StrLeft = ""
        Exit Function
    END IF
    Dim l,t,c,i
    str = Replace(Replace(Replace(Replace(str,"nbsp;"," "),"quot;",chr(34)),"gt;",">"),"lt;","")
    l=len(str)
    t=0
    For i=1 to l
        c=Abs(Asc(Mid(str,i,1)))
        IF(c>255)THEN
            t=t+2
        ELSE
            t=t+1
        END IF
        IF(t>strlen)THEN
            StrLeft = left(str,i) "..."
            Exit For
        ELSE
            StrLeft = str
        END IF
    Next
    StrLeft = Replace(Replace(Replace(Replace(StrLeft," ","nbsp;"),chr(34),"quot;"),">","gt;"),"","lt;")
End Function
%>

#T= 獲取安全的提交參數(shù)
%
'===============================================================
'SQL Injection Check
'函數(shù)功能:過濾字符參數(shù)中的單引號(hào),對(duì)于數(shù)字參數(shù)進(jìn)行判斷,如果不是數(shù)值類型,則賦值0
'參數(shù)意義:str ---- 要過濾的參數(shù)
'strType ---- 參數(shù)類型,分為字符型和數(shù)字型,字符型為"s",數(shù)字型為"i"
'===============================================================
Function CheckStr(str,strType)
    Dim strTmp 
    strTmp = "" 
    IF(strType ="s")THEN 
        strTmp = Replace(Trim(str),"'","''") 
    ELSEIF(strType="i")THEN 
        IF(IsNumeric(str)=False)THEN str=False 
        strTmp = str 
    ELSE 
        strTmp = str 
    End IF
    CheckStr= strTmp 
End Function
%>

#T= 過濾不良字符(BadWord)
%
'過濾不良字符(BadWords)
Function ChkBadWords(fString)
    Dim BadWords,bwords,i
    BadWords = "我操|(zhì)操你|操他|你媽的|他媽的|狗|雜種|屄|屌|王八|強(qiáng)奸|做愛|處女|澤民|法輪|法倫|洪志|法輪"
    IF(Not(IsNull(BadWords) or IsNull(fString)))THEN
    bwords = Split(BadWords, "|")
    For i = 0 to UBound(bwords)
        fString = Replace(fString, bwords(i), string(Len(bwords(i)),"*"))
    Next
    ChkBadWords = fString
    END IF
End Function
%>

#T= 生成隨機(jī)自定義長(zhǎng)度密碼
%
'生成隨機(jī)自定義長(zhǎng)度密碼
Function makePassword(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
            upper = 57
            lower = 48
        END IF
        strNewPass = strNewPass Chr(Int((upper - lower + 1) * Rnd + lower))
    Next
    makePassword = strNewPass
End Function
'Response.Write makepassword(8)
%>

#T= 填入Textarea時(shí)保持格式inHTML
%
'===============================================================
'去除Html格式,用于從數(shù)據(jù)庫(kù)中取出值填入輸入框時(shí)
'注意:value="?"這邊一定要用雙引號(hào)
'===============================================================
Function inHTML(str)
     Dim sTemp
     sTemp = str
     inHTML = ""
     If IsNull(sTemp) = True Then
        Exit Function
     End If
     sTemp = Replace(sTemp, "", "")
     sTemp = Replace(sTemp, "br>",chr(13))
     sTemp = Replace(sTemp, "lt;", "")
     sTemp = Replace(sTemp, "gt;", ">")
     sTemp = Replace(sTemp, "quot;", Chr(34))
     inHTML = sTemp
End Function
%>

#T= 正則表表達(dá)式驗(yàn)證函數(shù)
%
'正則表表達(dá)式驗(yàn)證函數(shù) patrn-正則表達(dá)式 strng-需要驗(yàn)證的字符串
'===============================================================
Function RegExpTest(patrn, strng)
    Dim regEx, retVal ' 建立變量。
    SET regEx = New RegExp ' 建立正則表達(dá)式。
    regEx.Pattern = patrn ' 設(shè)置模式。
    regEx.IgnoreCase = False ' 設(shè)置是否區(qū)分大小寫。
    retVal = regEx.Test(strng) ' 執(zhí)行搜索測(cè)試。
    RegExpTest = retVal '返回值,不符合就返回false,符合為true
    SET regEx = NOTHING
End Function
%>


#T= 生成隨機(jī)字符串
%
'生成隨機(jī)字符串
Function RndCode()
    Dim CodeSet,AmountSet
    CodeSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    AmountSet = 62 ' 文字?jǐn)?shù)量
    Randomize

    Dim vCode(10), vCodes,i
    For i = 0 To 9
      vCode(i) = Int(Rnd * AmountSet)
      vCodes = vCodes Mid(CodeSet, vCode(i) + 1, 1)
    Next
    RndCode=vCodes
End Function
%>


#T=============================
#T=FSO相關(guān)操作
#T= 判斷目錄是否存在
%
Function IsFloderExist(strFolderName)
    SET FSO=Server.CreateObject("Scripting.FileSystemObject")
    IF(FSO.FolderExists(strFolderName))THEN
        IsFloderExist = True
    ELSE
        IsFloderExist = False
    END IF
    SET FSO=NOTHING
End Function
%>

#T= 創(chuàng)建目錄
%
Function CreateFolder(strFolderName)
    SET FSO=Server.CreateObject("Scripting.FileSystemObject")
    IF(FSO.FolderExists(strFolderName) = False)THEN
        FSO.CreateFolder(strFolderName)
    END IF
    SET FSO=NOTHING
END Function
%>

#T= 刪除目錄
%
Function DeleteFolder(strFolderName)
    SET FSO=Server.CreateObject("Scripting.FileSystemObject")
    IF(FSO.FolderExists(strFolderName))THEN
        FSO.DeleteFolder(strFolderName)
    END IF
    SET FSO=NOTHING
END Function
%>

#T= 判斷文件是否存在
%
Function IsFileExist(strFileName)
    SET FSO=Server.CreateObject("Scripting.FileSystemObject")
    IF(FSO.FileExists(strFileName))THEN
        IsFileExist = True
    ELSE
        IsFileExist = False
    END IF
    SET FSO=NOTHING
End Function
%>

#T= 刪除文件
%
Function DeleteFile(strFileName)
    SET FSO=Server.CreateObject("Scripting.FileSystemObject")
    IF(FSO.FileExists(strFileName))THEN
        FSO.DeleteFile(strFileName)
    END IF
    SET FSO=NOTHING
END Function
%>

#T=============================
#T= ASP小偷常用的幾個(gè)函數(shù)
%
Function ByteToStr(vIn)
    Dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,NextCharCode
    strReturn = ""
    For i = 1 To LenB(vIn)
        ThisCharCode = AscB(MidB(vIn,i,1))
        IF(ThisCharCode H80)THEN
            strReturn = strReturn Chr(ThisCharCode)
        ELSE
            NextCharCode = AscB(MidB(vIn,i+1,1))
            strReturn = strReturn Chr(CLng(ThisCharCode) * H100 + CInt(NextCharCode))
            i = i + 1
        END IF
    Next
    ByteToStr = strReturn
End Function

Function GetHttpPageContent(url,Method,SendStr)
    Dim Retrieval
    SET Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
    With Retrieval
        .Open Method, url, False ,"" ,""
        .setRequestHeader "Content-Type","application/x-www-form-urlencoded"
        .Send(SendStr)
        GetHttpPageContent = .ResponseBody
    End With
    SET Retrieval = Nothing
    GetHttpPageContent=ByteToStr(GetHttpPageContent)
End Function

Function RegExpText(strng,regStr)
    Dim regEx,Match,Matches,RetStr
    SET regEx = New RegExp
    regEx.Pattern = regStr
    regEx.IgnoreCase = True
    regEx.Global = True
    SET Matches = regEx.Execute(strng)
    For Each Match in Matches
        RetStr = RetStr regEx.Replace(Match.Value,"$1") ","
    Next
    RegExpText = RetStr
    set regEx=nothing
End Function

Function StreamBytesToBstr(strBody, CodeBase)
Dim objStream
SET objStream = Server.CreateObject("Adodb.Stream")
With objStream
    .Type = 1
    .Mode = 3
    .Open
    .Write strBody
    .Position = 0
    .Type = 2
    .Charset = CodeBase
    StreamBytesToBstr = .ReadText
    .Close
End With
SET objStream = Nothing
End Function
%>

標(biāo)簽:內(nèi)江 重慶 成都 懷化 天津 臺(tái)灣 公主嶺 麗江

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《整理了一個(gè)editplus的剪輯文件(ASP方面的內(nèi)容)》,本文關(guān)鍵詞  整理,了,一個(gè),editplus,的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《整理了一個(gè)editplus的剪輯文件(ASP方面的內(nèi)容)》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于整理了一個(gè)editplus的剪輯文件(ASP方面的內(nèi)容)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章