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