Andy Jarrett // Code. Develop. Create.

Blocking recent comment spam

There are a ton of ways to stop spam on blogs. This is my dirty (and not pretty) solution that I am adding to stop the recent wave of crap that is getting through the front end checks.

The long term plan is to put a back-end on this but for now here is v.00001

<cfset commentBlacklist = "coachoutletmall|wowgold" /><cfset checkFields =trim(form.name) & trim(form.email) & trim(form.website) & trim(form.comments) /><cfif reFindNoCase("#commentBlacklist#", checkFields, 1) ><cfoutput>Sorry deadbeat, I don't allow comment spam. If you feel you were wrongly blacklistedContact Me</cfoutput><cfabort></cfif>

n.b. If you are on BlogCFC then this is for addcomment.cfm


I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee. Your support keeps this site running and the coffee brewing! ☕️