#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
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时保持格式inHTML
<%
''===============================================================
''去除Html格式,用于从数据库中取出值填入输入框时
''注意:value="?"这边一定要用双引号
''===============================================================
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, "<", "<")
sTemp = Replace(sTemp, ">", ">")
sTemp = Replace(sTemp, """, Chr(34))
inHTML = sTemp
End Function
%>
#T= 正则表表达式验证函数
<%
''正则表表达式验证函数 patrn-正则表达式 strng-需要验证的字符串
''===============================================================
Function RegExpTest(patrn, strng)
Dim regEx, retVal '' 建立变量。
SET regEx = New RegExp '' 建立正则表达式。
regEx.Pattern = patrn '' 设置模式。
regEx.IgnoreCase = False '' 设置是否区分大小写。
retVal = regEx.Test(strng) '' 执行搜索测试。
RegExpTest = retVal ''返回值,不符合就返回false,符合为true
SET regEx = NOTHING
End Function
%>
#T= 生成随机字符串
<%
''生成随机字符串
Function RndCode()
Dim CodeSet,AmountSet
CodeSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
AmountSet = 62 '' 文字数量
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相关操作
#T= 判断目录是否存在
<%
Function IsFloderExist(strFolderName)
SET FSO=Server.CreateObject("Scripting.FileSystemObject")
IF(FSO.FolderExists(strFolderName))THEN
IsFlod