Internet spam is on the rise and more importantly spammers are targeting your site's comment forms.

They are looking for the trackback urls to fool search engines into ranking their website higher in the search results.

When this started to happen to me, I wanted to sent out emails to the offenders demanding that they stop.

Unfortunatly the spam is being generated by bots and programs not some pimple faced kid behind a keyboard.

Banning IP addresses is not enough and rarely works since intelligent spammers hide their true identity anyway.

Next approach...

Banning Keywords used by the offending sites. Thats where this tutorial comes in.

<!--- DEFINE BANNED WORDS LIST --->
<cfset BannedWordsList = "poker,casino,roulette,tournament,backgammon,vegas,gambling,baccarat,vigorish">

<!--- SET NAUGHTY POSTER VALUE TO 0 --->
<cfset naughty = 0>

<!--- LOOP OVER FORM FIELDS AND CHECK ALL FIELDS FOR BANNED WORDS SET NAUGHTY POSTER TO 1 IF BANNED WORDS WERE FOUND PERIOD --->
<!--- Adoped code from by D Evans tutorial on "Checking for submitted form fields" http://tutorial55.easycfm.com/ --->

<cfloop index="thefield" list="#form.fieldnames#">
     <cfif ListFindNoCase(BannedWordsList, Evaluate(TheField),
",")>
         <cfset naughty = 1>
     </cfif>
</cfloop>

<!--- IF BANNED WORDS WERE FOUND GIVE AN ERROR AND ABORT PROCESSING --->
<cfif naughty EQ 1>
    
<h1>ERROR</h1>
     <p>You have entered a keyword that has now been banned from this site.</p>
     <p>
please <a href="javascript:history.go(-1);">Go back</a> and correct obvious words.</p>
     <cfabort>
</cfif>
About This Tutorial
Author: Mark Aplet
Skill Level: Beginner 
 
 
 
Platforms Tested: CFMX,CFMX7
Total Views: 94,998
Submission Date: March 15, 2006
Last Update Date: June 05, 2009
All Tutorials By This Autor: 1
Discuss This Tutorial
Advertisement

Sponsored By...
Mobile App Development (IOS, Android, Cordova, Phonegap, Objective-C, Java) - Austin, Texas Mobile Apps - Touch512, LLC.