473,387 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Smilies filter with swear filter

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
Expand|Select|Wrap|Line Numbers
  1. <%
  2. sub smilify(chatText) 
  3. dim smileys(10) 
  4. dim smileyGraphics(10) 
  5. smileys(0) = ":)" 
  6. smileys(1) = ":S" 
  7. smileys(2) = ";)"
  8. smileys(3) = [z(edited out profanity)]  
  9. smileyGraphics(0) = "<img src='smiley0.gif'>" 
  10. smileyGraphics(1) = "<img src='smiley1.gif'>" 
  11. smileyGraphics(2) = "<img src='smiley2.gif'>" 
  12. smileyGraphics(2) = "Word Blocked" 
  13. dim fixedText 
  14. fixedText = chatText
  15. for x = 0 to 9 
  16. fixedText = replace(fixedText, smileys(x), smileyGraphics(x)) 
  17. response.write "<!--  -->" & vbNewLine
  18. next 
  19. response.write fixedText & "<br>" & vbnewline
  20. end sub 
  21. %>
  22. </head>
  23.  
  24. <body>
  25. <% 
  26. While ((Repeat1__numRows <> 0) AND (NOT RSm.EOF)) 
  27. %>
  28.     <span class="style1"><strong><%=(RSm.Fields.Item("RSuser").Value)%></strong>:&nbsp;</span>
  29.     <%
  30.     dim chatMsg
  31. chatmsg=(RSm.Fields.Item("RSmessage").Value)
  32.  smilify(chatMsg)%>
  33.   <% 
  34.   Repeat1__index=Repeat1__index+1
  35.   Repeat1__numRows=Repeat1__numRows-1
  36.   RSm.MoveNext()
  37. Wend
  38. %>
Nov 11 '12 #1
5 1555
Rabbit
12,516 Expert Mod 8TB
Line 12, you should use index 3, not 2.
Nov 12 '12 #2
I had to redo the code but this is how its looking at the moment. its not totally working well.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. sub smilify(chatText) 
  3. dim smileys(10) 
  4. dim smileyGraphics(10)
  5. smileys(0) = ":)" 
  6. smileys(1) = ":S" 
  7. smileys(2) = ";)"
  8. smileys(3) = "8)"
  9. smileys(4) = ":D"
  10. smileys(5) = ":I"
  11. smileys(6) = ":'("
  12. smileys(7) = ":("
  13. smileys(8) = ":O"
  14. smileys(9) = ":P"
  15. smileys(10) = ":8"
  16. smileyGraphics(0) = "<img src='0.png'>" 
  17. smileyGraphics(1) = "<img src='1.png'>" 
  18. smileyGraphics(2) = "<img src='2.png'>" 
  19. smileyGraphics(3) = "<img src='3.png'>"
  20. smileyGraphics(4) = "<img src='4.png'>"
  21. smileyGraphics(5) = "<img src='5.png'>" 
  22. smileyGraphics(6) = "<img src='6.png'>"
  23. smileyGraphics(7) = "<img src='7.png'>" 
  24. smileyGraphics(8) = "<img src='8.png'>"
  25. smileyGraphics(9) = "<img src='9.png'>"
  26. smileyGraphics(10) = "<img src='10.png'>"
  27. dim fixedText 
  28. fixedText = chatText
  29. for x = 0 to 10 
  30. fixedText = replace(fixedText, smileys(x),smileyGraphics(x)) 
  31. response.write "<!--  -->" & vbNewLine
  32. next 
  33. response.write fixedText & "<br>" & vbnewline
  34. end sub 
  35. %>
  36. </head>
  37.  
  38. <body>
  39. <% 
  40. While ((Repeat1__numRows <> 0) AND (NOT RSm.EOF)) 
  41. %>
  42.     <span class="style1"><strong><img src="<%=(RSm.Fields.Item("RSlevel").Value)%>.png" width="20" height="20" /><%=(RSm.Fields.Item("RSuser").Value)%></strong>:</span><%
  43.  
  44.  Function ReplaceBadWords(InputComments) 
  45. Dim badChars, newChars, i
  46.  badChars = array("rubbish", "useless", "Poo") 
  47. newChars = InputComments
  48.  for i = 0 to uBound(badChars) 
  49. newChars = Replace(newChars, badChars(i), "") 
  50. Next 
  51. ReplaceBadWords = newChars 
  52. End function 
  53.  Dim chatMsg
  54.      chatMsg = ReplaceBadWords(RSm.Fields.Item("RSmessage").Value)
  55.  smilify(chatMsg)%>
  56.   <% 
  57.   Repeat1__index=Repeat1__index+1
  58.   Repeat1__numRows=Repeat1__numRows-1
  59.   RSm.MoveNext()
  60. Wend
  61. %>
Nov 12 '12 #3
Rabbit
12,516 Expert Mod 8TB
It's not working well in what sense? Just saying it doesn't work is not very informative.
Nov 13 '12 #4
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.
Nov 13 '12 #5
Rabbit
12,516 Expert Mod 8TB
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.
Nov 13 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
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...
1
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...
4
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...
3
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...
1
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...
1
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...
4
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...
5
dsatino
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...
7
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
Oralloy
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,...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.