Hey all. I have a filter for my website that control the smilies. That part works lovely but i cant get a swear filter in to it. How do i do this. Here is my code - <%
-
sub smilify(chatText)
-
dim smileys(10)
-
dim smileyGraphics(10)
-
smileys(0) = ":)"
-
smileys(1) = ":S"
-
smileys(2) = ";)"
-
smileys(3) = [z(edited out profanity)]
-
smileyGraphics(0) = "<img src='smiley0.gif'>"
-
smileyGraphics(1) = "<img src='smiley1.gif'>"
-
smileyGraphics(2) = "<img src='smiley2.gif'>"
-
smileyGraphics(2) = "Word Blocked"
-
dim fixedText
-
fixedText = chatText
-
for x = 0 to 9
-
fixedText = replace(fixedText, smileys(x), smileyGraphics(x))
-
response.write "<!-- -->" & vbNewLine
-
next
-
response.write fixedText & "<br>" & vbnewline
-
end sub
-
%>
-
</head>
-
-
<body>
-
<%
-
While ((Repeat1__numRows <> 0) AND (NOT RSm.EOF))
-
%>
-
<span class="style1"><strong><%=(RSm.Fields.Item("RSuser").Value)%></strong>: </span>
-
<%
-
dim chatMsg
-
chatmsg=(RSm.Fields.Item("RSmessage").Value)
-
smilify(chatMsg)%>
-
<%
-
Repeat1__index=Repeat1__index+1
-
Repeat1__numRows=Repeat1__numRows-1
-
RSm.MoveNext()
-
Wend
-
%>
5 1555
Line 12, you should use index 3, not 2.
I had to redo the code but this is how its looking at the moment. its not totally working well. - <%
-
sub smilify(chatText)
-
dim smileys(10)
-
dim smileyGraphics(10)
-
smileys(0) = ":)"
-
smileys(1) = ":S"
-
smileys(2) = ";)"
-
smileys(3) = "8)"
-
smileys(4) = ":D"
-
smileys(5) = ":I"
-
smileys(6) = ":'("
-
smileys(7) = ":("
-
smileys(8) = ":O"
-
smileys(9) = ":P"
-
smileys(10) = ":8"
-
smileyGraphics(0) = "<img src='0.png'>"
-
smileyGraphics(1) = "<img src='1.png'>"
-
smileyGraphics(2) = "<img src='2.png'>"
-
smileyGraphics(3) = "<img src='3.png'>"
-
smileyGraphics(4) = "<img src='4.png'>"
-
smileyGraphics(5) = "<img src='5.png'>"
-
smileyGraphics(6) = "<img src='6.png'>"
-
smileyGraphics(7) = "<img src='7.png'>"
-
smileyGraphics(8) = "<img src='8.png'>"
-
smileyGraphics(9) = "<img src='9.png'>"
-
smileyGraphics(10) = "<img src='10.png'>"
-
dim fixedText
-
fixedText = chatText
-
for x = 0 to 10
-
fixedText = replace(fixedText, smileys(x),smileyGraphics(x))
-
response.write "<!-- -->" & vbNewLine
-
next
-
response.write fixedText & "<br>" & vbnewline
-
end sub
-
%>
-
</head>
-
-
<body>
-
<%
-
While ((Repeat1__numRows <> 0) AND (NOT RSm.EOF))
-
%>
-
<span class="style1"><strong><img src="<%=(RSm.Fields.Item("RSlevel").Value)%>.png" width="20" height="20" /><%=(RSm.Fields.Item("RSuser").Value)%></strong>:</span><%
-
-
Function ReplaceBadWords(InputComments)
-
Dim badChars, newChars, i
-
badChars = array("rubbish", "useless", "Poo")
-
newChars = InputComments
-
for i = 0 to uBound(badChars)
-
newChars = Replace(newChars, badChars(i), "")
-
Next
-
ReplaceBadWords = newChars
-
End function
-
Dim chatMsg
-
chatMsg = ReplaceBadWords(RSm.Fields.Item("RSmessage").Value)
-
smilify(chatMsg)%>
-
<%
-
Repeat1__index=Repeat1__index+1
-
Repeat1__numRows=Repeat1__numRows-1
-
RSm.MoveNext()
-
Wend
-
%>
It's not working well in what sense? Just saying it doesn't work is not very informative.
As if some one puts like the 3 letter word that would appear in "Essex" It would block it mid word. I trying to get it so it dont block the word if its part of a word.
Then, you should check that the left character and right character, if there are any, are not letters themselves. One way, of many, to do this is to use a regular expression.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Lord Merlin |
last post by:
Can someone please help me with a good swearword filter, or assist me with
my current one?
This is the code I have currently, but it doesn't always work. I can do the
same test, with the same...
|
by: Chris Simmons |
last post by:
Hello:
I am trying to better understand the HttpResponse.Filter property and,
although I think I "get it," I am wondering what is going on behind
the scenes.
I was initially stumped with the...
|
by: bgreer5050 |
last post by:
I have a form with various fields with a double click event to bring
up a filter via a query. Is it possible to goto another field and
apply another filter only to the records that were found...
|
by: mattscho |
last post by:
Hi All, Trying to create a set of 3 buttons in a form that have the same effect as the "Filter by Form", "Apply Filter" and "Remove Filter" Buttons on the access toolbar. Help would be muchly...
|
by: mattscho |
last post by:
Re: Filter By From, Apply Filter, Remove Filter Buttons in a Form.
--------------------------------------------------------------------------------
Hi All, Trying to create a set of 3 buttons in...
|
by: Cara Murphy |
last post by:
Hi There!
Hoping you are able to help me with a filtering scenario:
I have created a pop up form (Filter) to filter a report (Open Issues), which currently has a number of combo boxes which...
|
by: xhe |
last post by:
I need to create a website and I want to filter out filthy words or
swear words. To my surprise, it is difficult to find such a list from
google.
So if you have that list, can you please share...
|
by: dsatino |
last post by:
I have an Access query whose results are filtered by a custom VBA function. This works perfectly as long as the function returns a result. If the function doesn't return a result, neither does the...
|
by: munkee |
last post by:
Hi all,
I am using Allen's excellent form filter script to filter the results from a query.
I would now like to add some further functionality. How do I go about displaying say the top N costs...
|
by: Ian Anderson |
last post by:
Hello there,
SO i have the followign VB code in my continuous form...
'Purpose: This module illustrates how to create a search form, _
where the user can enter as many or few...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |