📄 cls_main.asp
字号:
Dim FobWords, i
On Error Resume Next
FobWords = Array(91, 92, 304, 305, 430, 431, 437, 438, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12485, 12486, 12487, 12488, 12489, 12490, 12496, 12497, 12498, 12499, 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12521, 12532, 12533, 65339, 65340)
For i = 1 To UBound(FobWords, 1)
If InStr(keyword, ChrW(FobWords(i))) > 0 Then
keyword = Replace(keyword, ChrW(FobWords(i)), "")
End If
Next
keyword = Left(keyword, 100)
FobWords = Array("~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "=", "`", "[", "]", "{", "}", ";", ":", """", "'", ",", "<", ">", ".", "/", "\", "?", "_")
For i = 0 To UBound(FobWords, 1)
If InStr(keyword, FobWords(i)) > 0 Then
keyword = Replace(keyword, FobWords(i), "")
End If
Next
ChkKeyWord = keyword
End Function
'================================================
'函数名:JAPEncode
'作 用:日文片假名编码
'参 数:str ----原字符
'================================================
Public Function JAPEncode(ByVal str)
Dim FobWords, i
On Error Resume Next
If IsNull(str) Or Trim(str) = "" Then
JAPEncode = ""
Exit Function
End If
FobWords = Array(92, 304, 305, 430, 431, 437, 438, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12485, 12486, 12487, 12488, 12489, 12490, 12496, 12497, 12498, 12499, 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12521, 12532, 12533, 65340)
For i = 1 To UBound(FobWords, 1)
If InStr(str, ChrW(FobWords(i))) > 0 Then
str = Replace(str, ChrW(FobWords(i)), "&#" & FobWords(i) & ";")
End If
Next
JAPEncode = str
End Function
'================================================
'函数名:JAPUncode
'作 用:日文片假名解码
'参 数:str ----原字符
'================================================
Public Function JAPUncode(ByVal str)
Dim FobWords, i
On Error Resume Next
If IsNull(str) Or Trim(str) = "" Then
JAPUncode = ""
Exit Function
End If
FobWords = Array(92, 304, 305, 430, 431, 437, 438, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12485, 12486, 12487, 12488, 12489, 12490, 12496, 12497, 12498, 12499, 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12521, 12532, 12533, 65340)
For i = 1 To UBound(FobWords, 1)
If InStr(str, "&#" & FobWords(i) & ";") > 0 Then
str = Replace(str, "&#" & FobWords(i) & ";", ChrW(FobWords(i)))
End If
Next
str = Replace(str, Chr(0), "")
str = Replace(str, "'", "''")
JAPUncode = str
End Function
'=============================================================
'函数作用:带脏话过滤
'=============================================================
Public Function ChkBadWords(ByVal str)
If IsNull(str) Then Exit Function
Dim i, Bwords, Bwordr
Bwords = Split(Badwords, "|")
Bwordr = Split(Badwordr, "|")
For i = 0 To UBound(Bwords)
If i > UBound(Bwordr) Then
str = Replace(str, Bwords(i), "*")
Else
str = Replace(str, Bwords(i), Bwordr(i))
End If
Next
ChkBadWords = str
End Function
'=============================================================
'函数作用:过滤HTML代码,带脏话过滤
'=============================================================
Public Function HTMLEncode(ByVal fString)
If Not IsNull(fString) Then
fString = Replace(fString, ">", ">")
fString = Replace(fString, "<", "<")
fString = Replace(fString, Chr(32), " ")
fString = Replace(fString, Chr(9), " ")
fString = Replace(fString, Chr(34), """)
fString = Replace(fString, Chr(39), "'")
fString = Replace(fString, Chr(13), "")
fString = Replace(fString, " ", " ")
fString = Replace(fString, Chr(10), "<br /> ")
fString = ChkBadWords(fString)
HTMLEncode = fString
End If
End Function
'=============================================================
'函数作用:反过滤HTML代码,用于修改文本
'=============================================================
Public Function fHTMLEncode(ByVal fString)
If Not IsNull(fString) Then
fString = Replace(fString, ">", ">")
fString = Replace(fString, "<", "<")
fString = Replace(fString, """, Chr(34))
fString = Replace(fString, "'", Chr(39))
fString = Replace(fString, "", Chr(13))
fString = Replace(fString, "<br>", Chr(13))
fString = Replace(fString ," ", " ")
fString = Replace(fString, "<br /> ", Chr(13))
fString = Replace(fString, "<br> ", Chr(13))
fString = ChkBadWords(fString)
fHTMLEncode = fString
End If
End Function
'=============================================================
'函数作用:过滤HTML代码,不带脏话过滤
'=============================================================
Public Function HTMLEncodes(ByVal fString)
If Not IsNull(fString) Then
fString = Replace(fString, "'", "'")
fString = Replace(fString, ">", ">")
fString = Replace(fString, "<", "<")
fString = Replace(fString, Chr(32), " ")
fString = Replace(fString, Chr(9), " ")
fString = Replace(fString, Chr(34), """)
fString = Replace(fString, Chr(39), "'")
fString = Replace(Replace(Server.HTMLEncode(fString),VbNewLine,"<br>")," ", " ")
fString = Replace(fString, chr(10) & chr(13), "<br>")
fString = Replace(fString, chr(13) & chr(10), "<br>")
fString = Replace(fString, chr(10) , "<br>")
fString = Replace(fString, chr(13) , "<br>")
fString = Replace(fString, "&#9642;", "▪")
fString = Replace(fString, " ", " ")
HTMLEncodes = fString
End If
End Function
'=============================================================
'函数作用:判断发言是否来自外部
'=============================================================
Public Function CheckPost()
On Error Resume Next
Dim server_v1, server_v2
CheckPost = False
server_v1 = CStr(Request.ServerVariables("HTTP_REFERER"))
server_v2 = CStr(Request.ServerVariables("SERVER_NAME"))
If Mid(server_v1, 8, Len(server_v2)) = server_v2 Then
CheckPost = True
End If
End Function
'=============================================================
'函数作用:判断来源URL是否来自外部
'=============================================================
Public Function CheckOuterUrl()
On Error Resume Next
Dim server_v1, server_v2
server_v1 = Replace(LCase(Trim(Request.ServerVariables("HTTP_REFERER"))), "http://", "")
server_v2 = LCase(Trim(Request.ServerVariables("SERVER_NAME")))
If server_v1 <> "" And Left(server_v1, Len(server_v2)) <> server_v2 Then
CheckOuterUrl = False
Else
CheckOuterUrl = True
End If
End Function
'================================================
'函数名:GotTopic
'作 用:显示字符串长度
'参 数:str ----原字符串
' strlen ----显示字符长度
'================================================
Public Function GotTopic(ByVal str, ByVal strLen)
Dim l, t, c, i
Dim strTemp
On Error Resume Next
str = Trim(str)
str = Replace(str, " ", " ")
str = Replace(str, ">", ">")
str = Replace(str, "<", "<")
str = Replace(str, ">", ">")
str = Replace(str, "<", "<")
str = Replace(str, "'", "'")
str = Replace(str, """, Chr(34))
str = Replace(str, vbNewLine, "")
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
strTemp = Left(str, i) & ".."
Exit For
Else
strTemp = str & ""
End If
Next
GotTopic = CheckTopic(strTemp)
End Function
Public Function CheckTopic(ByVal strContent)
Dim re
On Error Resume Next
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
re.Pattern = "(<s+cript(.+?)<\/s+cript>)"
strContent = re.Replace(strContent, "")
re.Pattern = "(<iframe(.+?)<\/iframe>)"
strContent = re.Replace(strContent, "")
re.Pattern = "(>)"
strContent = re.Replace(strContent, ">")
re.Pattern = "(<)"
strContent = re.Replace(strContent, "<")
Set re = Nothing
strContent = Replace(strContent, ">", ">")
strContent = Replace(strContent, "<", "<")
strContent = Replace(strContent, "'", "'")
strContent = Replace(strContent, Chr(34), """)
strContent = Replace(strContent, "%", "%")
strContent = Replace(strContent, vbNewLine, "")
CheckTopic = Trim(strContent)
End Function
'================================================
'函数名:ReadTopic
'作 用:显示字符串长度
'参 数:str ----原字符串
' strlen ----显示字符长度
'================================================
Public Function ReadTopic(ByVal str, ByVal strLen)
Dim l, t, c, i
On Error Resume Next
str = Replace(str, " ", " ")
If Len(str) < strLen Then
str = str '& String(strLen - Len(str), ".")
Else
str = str
End If
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
ReadTopic = Left(str, i) & "..."
Exit For
Else
ReadTopic = str '& "..."
End If
Next
End Function
'================================================
'函数名:strLength
'作 用:计字符串长度
'参 数:str ----字符串
'================================================
Public Function strLength(ByVal str)
On Error Resume Next
If IsNull(str) Or str = "" Then
strLength = 0
Exit Function
End If
Dim WINNT_CHINESE
WINNT_CHINESE = (Len("例子") = 2)
If WINNT_CHINESE Then
Dim l, t
Dim i, c
l = Len(str)
t = l
For i = 1 To l
c = Asc(Mid(str, i, 1))
If c < 0 Then c = c + 65536
If c > 255 Then t = t + 1
Next
strLength = t
Else
strLength = Len(str)
End If
End Function
'=================================================
'函数名:isInteger
'作 用:判断数字是否整型
'参 数:para ----参数
'=================================================
Public Function isInteger(ByVal para)
On Error Resume Next
Dim str
Dim l, i
If IsNull(para) Then
isInteger = False
Exit Function
End If
str = CStr(para)
If Trim(str) = "" Then
isInteger = False
Exit Function
End If
l = Len(str)
For i = 1 To l
If Mid(str, i, 1) > "9" Or Mid(str, i, 1) < "0" Then
isInteger = False
Exit Function
End If
Next
isInteger = True
If Err.Number <> 0 Then Err.Clear
End Function
Public Function CutString(ByVal str, ByVal strLen)
'On Error Resume Next
Dim HtmlStr, l, re, strContent
HtmlStr = str
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
re.Pattern = "\[br\]"
HtmlStr = re.Replace(HtmlStr, "")
re.Pattern = "\[align=right\](.*)\[\/align\]"
HtmlStr = re.Replace(HtmlStr, "")
re.Pattern = "([\f\n\r\t\v])"
HtmlStr = re.Replace(HtmlStr, "")
re.Pattern = "<(.[^>]*)>"
HtmlStr = re.Replace(HtmlStr, "")
Set re = Nothing
HtmlStr = Replace(HtmlStr, " ", "")
HtmlStr = Replace(HtmlStr, """, Chr(34))
HtmlStr = Replace(HtmlStr, "'", Chr(39))
HtmlStr = Replace(HtmlStr, "{", Chr(123))
HtmlStr = Replace(HtmlStr, "}", Chr(125))
HtmlStr = Replace(HtmlStr, "$", Chr(36))
HtmlStr = Replace(HtmlStr, vbCrLf, "")
HtmlStr = Replace(HtmlStr, "====", "")
HtmlStr = Replace(HtmlStr, "----", "")
HtmlStr = Replace(HtmlStr, "////", "")
HtmlStr = Replace(HtmlStr, "\\\\", "")
HtmlStr = Replace(HtmlStr, "####", "")
HtmlStr = Replace(HtmlStr, "@@@@", "")
HtmlStr = Replace(HtmlStr, "****", "")
HtmlStr = Replace(HtmlStr, "~~~~", "")
HtmlStr = Replace(HtmlStr, "≡≡≡", "")
HtmlStr = Replace(HtmlStr, "++++", "")
HtmlStr = Replace(HtmlStr, "::::", "")
HtmlStr = Replace(HtmlStr, " ", "")
HtmlStr = Replace(HtmlStr, ">", ">")
HtmlStr = Replace(HtmlStr, "<", "<")
l = Len(HtmlStr)
If l >= strLen Then
strContent = Left(HtmlStr, strLen) & "..."
Else
strContent = HtmlStr & " "
End If
strContent = Replace(strContent, Chr(34), """)
strContent = Replace(strContent, Chr(39), "'")
strContent = Replace(strContent, Chr(36), "$")
strContent = Replace(strContent, Chr(123), "{")
strContent = Replace(strContent, Chr(125), "}")
strContent = Replace(strContent, ">", ">")
strContent = Replace(strContent, "<", "<")
CutString = strContent
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -