📄 functions_filters.asp
字号:
'******************************************
'*** Format user input *****
'******************************************
'Format user input function
Private Function formatInput(ByVal strInputEntry)
'Get rid of malicous code in the message
strInputEntry = Replace(strInputEntry, "</script>", "", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "<script language=""javascript"">", "", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "<script language=javascript>", "", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "script", "script", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "SCRIPT", "SCRIPT", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Script", "Script", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "script", "Script", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "object", "object", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "OBJECT", "OBJECT", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Object", "Object", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "object", "Object", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "applet", "applet", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "APPLET", "APPLET", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Applet", "Applet", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "applet", "Applet", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "embed", "embed", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "EMBED", "EMBED", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Embed", "Embed", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "embed", "Embed", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "event", "event", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "EVENT", "EVENT", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Event", "Event", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "event", "Event", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "document", "document", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "DOCUMENT", "DOCUMENT", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Document", "Document", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "document", "Document", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "cookie", "cookie", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "COOKIE", "COOKIE", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Cookie", "Cookie", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "cookie", "Cookie", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "form", "form", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "FORM", "FORM", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Form", "Form", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "form", "Form", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "iframe", "iframe", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "IFRAME", "IFRAME", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Iframe", "Iframe", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "iframe", "iframe", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "textarea", "textarea", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "TEXTAREA", "TEXTAREA", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Textarea", "Textarea", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "textarea", "Textarea", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "on", "on", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "ON", "ON", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "On", "On", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "on", "on", 1, -1, 1)
'Reformat a few bits
strInputEntry = Replace(strInputEntry, "<STRONG>", "<strong>", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "<strong>", "<strong>", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "</STRONG>", "</strong>", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "</strong>", "</strong>", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "font", "font", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "FONT", "FONT", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Font", "Font", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "fOnt", "font", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "font", "font", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "mono", "mono", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "MONO", "MONO", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "MOno", "Mono", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "mOno", "mono", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "mono", "mono", 1, -1, 1)
'Return
formatInput = strInputEntry
End Function
'********************************************
'*** Format SQL input *****
'********************************************
'Format SQL Query funtion
Private Function formatSQLInput(ByVal strInputEntry)
'Remove malisous charcters from links and images
strInputEntry = Replace(strInputEntry, "<", "<")
strInputEntry = Replace(strInputEntry, ">", ">")
strInputEntry = Replace(strInputEntry, "[", "[")
strInputEntry = Replace(strInputEntry, "]", "]")
strInputEntry = Replace(strInputEntry, """", "", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "=", "=", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "'", "''", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "select", "select", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "join", "join", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "union", "union", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "where", "where", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "insert", "insert", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "delete", "delete", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "update", "update", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "like", "like", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "drop", "drop", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "create", "create", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "modify", "modify", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "rename", "rename", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "alter", "alter", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "cast", "cast", 1, -1, 1)
'Return
formatSQLInput = strInputEntry
End Function
'*********************************************
'*** Strip all tags *****
'*********************************************
'Remove all tags for text only display (mainly for subject lines)
Private Function removeAllTags(ByVal strInputEntry)
'Remove all HTML scripting tags etc. for plain text output
strInputEntry = Replace(strInputEntry, "&", "&", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "<", "<", 1, -1, 1)
strInputEntry = Replace(strInputEntry, ">", ">", 1, -1, 1)
strInputEntry = Replace(strInputEntry, "'", "’", 1, -1, 1)
strInputEntry = Replace(strInputEntry, """", """, 1, -1, 1)
'Return
removeAllTags = strInputEntry
End Function
'******************************************
'*** Non-Alphanumeric Character Strip ****
'******************************************
'Function to strip non alphanumeric characters
Private Function characterStrip(strTextInput)
'Dimension variable
Dim intLoopCounter 'Holds the loop counter
'Loop through the ASCII characters
For intLoopCounter = 0 to 47
strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0)
Next
'Loop through the ASCII characters numeric characters to lower-case characters
For intLoopCounter = 91 to 96
strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0)
Next
'Loop through the extended ASCII characters
For intLoopCounter = 58 to 64
strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0)
Next
'Loop through the extended ASCII characters
For intLoopCounter = 123 to 255
strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0)
Next
'Return the string
characterStrip = strTextInput
End Function
'**********************************************
'*** Strip HTML *****
'**********************************************
'Remove HTML function
Private Function removeHTML(ByVal strMessageInput)
Dim lngMessagePosition 'Holds the message position
Dim intHTMLTagLength 'Holds the length of the HTML tags
Dim strHTMLMessage 'Holds the HTML message
Dim strTempMessageInput 'Temp store for the message input
'Place the message input into a temp store
strTempMessageInput = strMessageInput
'Loop through each character in the post message
For lngMessagePosition = 1 to CLng(Len(strMessageInput))
'If this is the end of the message then save some process time and jump out the loop
If Mid(strMessageInput, lngMessagePosition, 1) = "" Then Exit For
'If an HTML tag is found then jump to the end so we can strip it
If Mid(strMessageInput, lngMessagePosition, 1) = "<" Then
'Get the length of the HTML tag
intHTMLTagLength = (InStr(lngMessagePosition, strMessageInput, ">", 1) - lngMessagePosition)
'If the end of the HTML string is in error then set it to the number of characters being passed
If intHTMLTagLength < 0 Then intHTMLTagLength = CLng(Len(strTempMessageInput))
'Place the HTML tag back into the temporary message store
strHTMLMessage = Mid(strMessageInput, lngMessagePosition, intHTMLTagLength + 1)
'Strip the HTML from the temp message store
strTempMessageInput = Replace(strTempMessageInput, strHTMLMessage, "", 1, -1, 0)
End If
Next
'Replace a few characters in the remaining text
strTempMessageInput = Replace(strTempMessageInput, "<", "<", 1, -1, 1)
strTempMessageInput = Replace(strTempMessageInput, ">", ">", 1, -1, 1)
strTempMessageInput = Replace(strTempMessageInput, "'", "'", 1, -1, 1)
strTempMessageInput = Replace(strTempMessageInput, """", """, 1, -1, 1)
strTempMessageInput = Replace(strTempMessageInput, " ", "", 1, -1, 1)
'Return the function
removeHTML = strTempMessageInput
End Function
'******************************************
'*** Split long text strings ***
'******************************************
'Function to strip out long words, long rows of chars, and long text lines from text
Private Function removeLongText(ByVal strMessageInput)
Dim lngMessagePosition 'Holds the message position
Dim intHTMLTagLength 'Holds the length of the HTML tags
Dim strHTMLMessage 'Holds the HTML message
Dim strTempMessageText 'Temp store for the message input
Dim strTempPlainTextWord 'Holds the plain text word
Dim saryPlainTextWord 'Array holding the plain text words
Dim sarySplitTextWord() 'Array holding the plain text word that has been split
Dim lngSplitPlainTextWordLoop 'Loop counter for looping through the pain text split word
Dim strTempOutputMessage 'Outputted string
Dim intWordSartPos 'Holds the location in the word to start the split
Dim saryHTMLlinks() 'Holds links from the message and thier corrisponding code
Dim strHTMLlinksCode 'Holds the code that is replaced the links with
Dim lngLoopCounter 'loop counter to count the number of HTML links in meesage
Dim blnHTMLlink 'Set to true if there is a link in the message body
Dim strTempFlashMsg 'Temp store for the falsh forum code
Dim lngStartPos
Dim lngEndPos
Const intMaxWordLength = 60 'Holds the max word lentgh (can't be below 22 or will mess up the link code placed into messages)
'Initliase variables
lngLoopCounter = 0
blnHTMLlink = False
'Place the message input into a temp store
strTempMessageText = strMessageInput
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -