For Programmers: Free Programming Magazines  


Home > Archive > ASP > June 2007 > help implimenting bad words filter









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author help implimenting bad words filter
mark r

2007-06-03, 6:55 pm

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

Heartbeat

2007-06-06, 12:46 pm

Hilary Duff and Nikki Cox Using Massage Machine!
http://www.theillegalsite.com/watch?movie=1673286

Shania Twain and Catherine Z. Jones Strap On Lesbian XXXXing!
http://www.theillegalsite.com/Media...peg?vid=1673286

Lindsay Lohan and Halle Berry Crazy On High Heels!
http://www.theillegalsite.com/Player.php?q=1673286

Hilary Duff and Jessica Simpson Seducing Waitress!
http://www.theillegalsite.com/Player?movie=1673286

Sarah M. Gellar and Christina Aguilera Wrestling & Showing Ass!
http://www.theillegalsite.com/watch?id=1673286
Erder

2007-06-06, 3:12 pm

Lindsay Lohan , Panties sliding down a perfectly round ass!

http://www.theillegalsite.com/Media...mv?movie=726648
Codepoetica

2007-06-09, 2:20 am

I have uploaded my private videos ;)
http://www.xx-amateur-movies.org/vid/218571/
Aquamarine

2007-06-11, 11:17 am

http://qrioullz.t35.com/adult-sex-t...-sex/index.html
http://ztby1c4l.t35.com/anal-sex/an...an-sex-com.html
http://ztby1c4l.t35.com/anal-sex/an...-sex-movie.html
pictures[/URL]http://slw7pl0p.t35.com/teen-sex/young-teen-sex-pic.htmlhttp://az818p0w.t35.com/lesbian-sex/latina-lesbian-sex.htmlhttp://ss6cnhgd.t35.com/gay-sex-movie/old-gay-sex.htmlhttp://tdmiqyst.t35.com/free-sex-video/free-sex-woman-video.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com