'脏字过滤
Function CkBadWords(fString)
IF not(isnull(BadWords) or isnull(fString)) then
BadWords = split(BadWords, "|")
dim i
For i = 0 to ubound(BadWords)
fString = Replace(fString, BadWords(i), string(len(BadWords(i)),"*"))
Next
CkBadWords = fString
End IF
End Function
'检查年龄
Function CkAge(LngAge)
IF LngAge="" Then Error("您忘了填写年龄")
Dim RE
Set RE = New RegExp
RE.Pattern = "[0-9]{"&Len(LngAge)&"}"
RE.IgnoreCase = False
RE.Global = False
CkAge = RE.Test(LngAge)
Set RE = Nothing
IF CkAge = True Then
IF LngAge < 2 Then Error("您的年龄太小了PS:孩子 您这么小就能上网啊 真厉害! 将来肯定比我强! 来哥哥(SLIGHTBOY)赏你个棒棒糖 ^*^")
IF LngAge > 100 Then Error("您的年龄太大了PS:不会吧? 老爷爷 精力充沛啊 还上网啊 活这么久能告诉我方法吗? 我帮你宣传宣传 ^*^")
Else
Error("年龄栏只能输入数字")
End IF
End Function
'邮件检查
Function IsValidEmail(email)
dim names, name, i, c
'Check for valid syntax in an email address.
IsValidEmail = true
names = Split(email, "@")
if UBound(names) 1 then
IsValidEmail = false
exit function
end if
for each name in names
if Len(name) IsValidEmail = false
exit function
end if
for i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) IsValidEmail = false
exit function
end if
next
if Left(name, 1) = "." or Right(name, 1) = "." then
IsValidEmail = false
exit function
end if
next
if InStr(names(1), ".") IsValidEmail = false
exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i 2 and i 3 then
IsValidEmail = false
exit function
end if
if InStr(email, "..") > 0 then
IsValidEmail = false
end if
End Function
'HTML 编码 (不支持)
Function HTMLEncode(fString)
IF not isnull(fString) then
fString = Replace(fString, ">", ">")
fString = Replace(fString, " fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), " ")
fString = Replace(fString, CHR(10), " ")
HTMLEncode = fString
End IF
End Function
'HTML 支持
Function HTMLcode(fString)
IF not isnull(fString) then
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "")
fString = Replace(fString, CHR(10), "")
HTMLcode = fString
End IF
End Function
%>