473,563 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help implimenting bad words filter

Hi there... im on with my shoutbox again only now i want to add a bad
words filter. ive got the following code off a website and would
appreciate someone showing me how to integrate it into my code...

the bad words filter code is:
<%
Dim sMyString
sMyString = ReplaceBadWords ("this is a rubbish crap bad word filter")
response.write sMyString
Function ReplaceBadWords (InputComments)
Dim badChars, newChars, sLength, sAttachtoEnd, x, i
'create an array of bad words that should be filtered
badChars = array("rubbish" , "crap", "shit")
newChars = InputComments
'loop through our array of bad words
For i = 0 to uBound(badChars )
'get the length of the bad word
sLength=Len(bad Chars(i))
'we are going to keep the first letter of the bad word and replace all
the other
'letters with *, so we need to find out how many * to use
For x=1 to sLength-1
sAttachtoEnd=sA ttachtoEnd & "*"
Next
'replace any occurences of the bad word with the first letter of it
and the
'rest of the letters replace with *
newChars = Replace(newChar s, badChars(i), Left(badChars(i ),1) &
sAttachtoEnd)
sAttachtoEnd=""
Next
ReplaceBadWords = newChars
End function
%>
and my shoutbox code is:

<%
'Dimension variables
Dim amanda_adocon
Dim amanda_strcon
Dim amanda_strSql
Dim amanda_rsShow
Dim amanda_rsAdd

'Create an ADO connection object
Set amanda_adocon = Server.CreateOb ject("ADODB.Con nection")
amanda_strCon = "Provider=Micro soft.Jet.OLEDB. 4.0; Data Source=" &
Server.MapPath( "amanda.mdb ")
%>

<%
Set amanda_rsShow = Server.CreateOb ject("ADODB.Rec ordset")
amanda_strSQL = "SELECT TOP 15 * FROM tblShoutbox ORDER BY ID DESC;"
amanda_rsShow.O pen amanda_strSQL, amanda_strcon
%>

<div id="scrollingbo x">
<%
Do while not amanda_rsShow.E OF
%>
<p><strong><% Response.Write Server.HTMLEnco de(amanda_rsSho w("Name"))
%:</strong>
<% Response.Write Server.HTMLEnco de(amanda_rsSho w("Msg")) %></p>
<%
amanda_rsShow.M oveNext
loop
%>
</div>

<%
'Reset server objects
amanda_rsShow.c lose
Set amanda_rsShow = Nothing
Set amanda_adocon = Nothing
%>

thanks guys

Jun 3 '07 #1
0 1961

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3869
by: Case Nelson | last post by:
Hi there I've just been playing around with some python code and I've got a fun little optimization problem I could use some help with. Basically, the program needs to take in a random list of no more than 10 letters, and find all possible mutations that match a word in my dictionary (80k words). However a wildcard letter '?' is also an...
4
2068
by: Throw | last post by:
G'day everyone! I would like to design typing tutor exercises for Afrikaans (and other languages possibly). This is for a GPL project. For this, I need a script that can extract words from a long list of words, based on which letters those words contain, and write then write output to a file. Does anyone know of an existing script for...
0
5542
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
7
336
by: gheissenberger | last post by:
HELP! Guy who was here before me wrote a script to parse files in Python. Includes line: print u where u is a line from a file we are parsing. However, we have started recieving data from Brazil. If I open file to parse in VI, looks like: <Utt id="3" transcribe="yes" audioRoot="A1"
0
7659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7634
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.