Hi all,
I emailed the list regarding this a few weeks ago, but an interesting
problem has now come up.
I have some code that pulls a list of profanities from a db table, then
checks them against a form feild submitted by a user. Any words that match
are asterisked out. All well and good. But, when someone entered Saturday,
the code returned Sa****ay!! Yers, turd is in the database! What I want to
know is this. How would I look at changing this so that whilst turd would be
picked up and returned as ****, saturday is not??
Any ideas? Code is below.
TIA
Will
<cfset bodytext = Form.thread_body>
<cfset titletext = Form.thread_title>
<!--- Pull out all the bad words from the database --->
<cfquery name="getprofanities" datasource="#APPLICATION.chatdsn#">
SELECT ID, badword, rate1
FROM tbl_profanity
</cfquery>
<!--- Loop over the profanity list and compare with words in the
bodytext --->
<cfloop query="getprofanities">
<cfset bodytext = ReplaceNoCase(bodytext, "#getprofanities.badword#",
"#getprofanities.rate1#", "ALL")>
<cfset titletext = ReplaceNoCase(titletext, "#getprofanities.badword#",
"#getprofanities.rate1#", "ALL")>
</cfloop>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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