True, and that is all the client wants to be honest. In fact, to be more
precise, they were not fussed, but I wanted to add the profanity checker as
a bit of fun, and because I think it is a good idea to have something.
Of course, there are always ways around them. Also, you must be careful that
you don't accidentally filter out perfectly legitimate words. Take the word
knob, which has several connatations. A knob of butter would be perfectly
innocent, but in other contexts knob could be considered profane.
I'm relatively happy that my solution will catch the more obvious ones, but
there is no allowing for how creative people can get if they really want.
The client also always has the option of editing or deleting any posting if
they wish.
Anyhow, I doubt that this will be the last bulletin board I build for a
client, and so I will revisit this from time to time and try to improve it.
Thanks
Will
-----Original Message-----
From: Robert Everland [mailto:[EMAIL PROTECTED]]
Sent: 18 May 2001 15:47
To: CF-Talk
Subject: RE: profanity checker
This is really no way to check for all kinds of bad words. Let's use the
Clinton scenario wCiLlIlNiTaOmN If you look closely you see I put the word
willion in between where there were space for clinton. The only way to
insure there are no bad words is if you have a place where you can manually
screen each thing that is put through. If not you will only get the ones
that are above abvious.
Robert Everland III
Dixon Ticonderoga
Web Developer Extraordinaire
-----Original Message-----
From: Will Swain [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 18, 2001 10:09 AM
To: CF-Talk
Subject: RE: profanity checker
Thanks Raymond, I will look at that regular expression, as I can see it
being a loophole, people putting spaces between letters.
Like your choice for a bad word!!
Cheers
Will
-----Original Message-----
From: Raymond Camden [mailto:[EMAIL PROTECTED]]
Sent: 18 May 2001 13:22
To: CF-Talk
Subject: RE: profanity checker
> <cfloop query="getprofanities">
>
> <cfset newlist = ReplaceNoCase(bodytext, "getprofanities.badword",
> "getprofanities.rate1", "ALL")>
>
> </cfloop>
One mistake is the use of quotes. In a function, if you do Function("foo"),
foo is a string. But you want to use the value of getprofanities.badword, so
you don't use the quotes. Try rewriting it like so:
<cfset newlist = ReplaceNoCase(bodytext,
getprofanities.badword,getprofanities.rate1, "ALL")>
You also don't need the getprofanities. in front of badword and rate1. Since
you are looping over the query, it is implied.
Another thing you may want to look out. Consider the case where Clinton is
the bad word. What happens if I do:
C l i n t o n
Your checker won't find that word. What I've done in the past is to take the
bad word and translate it into a regex that looks like this:
C[[:space:]]l[[:space:]]etc
This will make it match the test above. You would also change ReplaceNoCase
w/ REReplaceNoCase.
=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
Email : [EMAIL PROTECTED]
ICQ UIN : 3679482
"My ally is the Force, and a powerful ally it is." - Yoda
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists