473,385 Members | 1,465 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,385 software developers and data experts.

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(badChars(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=sAttachtoEnd & "*"
Next
'replace any occurences of the bad word with the first letter of it
and the
'rest of the letters replace with *
newChars = Replace(newChars, 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.CreateObject("ADODB.Connection")
amanda_strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("amanda.mdb")
%>

<%
Set amanda_rsShow = Server.CreateObject("ADODB.Recordset")
amanda_strSQL = "SELECT TOP 15 * FROM tblShoutbox ORDER BY ID DESC;"
amanda_rsShow.Open amanda_strSQL, amanda_strcon
%>

<div id="scrollingbox">
<%
Do while not amanda_rsShow.EOF
%>
<p><strong><% Response.Write Server.HTMLEncode(amanda_rsShow("Name"))
%:</strong>
<% Response.Write Server.HTMLEncode(amanda_rsShow("Msg")) %></p>
<%
amanda_rsShow.MoveNext
loop
%>
</div>

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

thanks guys

Jun 3 '07 #1
0 1955

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

Similar topics

10
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...
4
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...
0
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...
7
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.