整理了一个editplus的剪辑文件(ASP方面的内容)(4)


        IF(t>strlen)THEN
            StrLeft = left(str,i) & "..."
            Exit For
        ELSE
            StrLeft = str
        END IF
    Next
    StrLeft = Replace(Replace(Replace(Replace(StrLeft," "," "),chr(34),"""),">",">"),"<","<")
End Function
%>

#T= 获取安全的提交参数
<%
'===============================================================
'SQL Injection Check
'函数功能:过滤字符参数中的单引号,对于数字参数进行判断,如果不是数值类型,则赋值0
'参数意义:str ---- 要过滤的参数
'strType ---- 参数类型,分为字符型和数字型,字符型为"s",数字型为"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 = "我操|操你|操他|你妈的|他妈的|狗|杂种|屄|屌|王八|强奸|做爱|处女|泽民|法轮|法伦|洪志|法輪"
    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= 生成随机自定义长度密码
<%
'生成随机自定义长度密码
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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3456.html