Skip to content

Instantly share code, notes, and snippets.

@stevereich
Created October 13, 2012 01:45
Show Gist options
  • Save stevereich/3882872 to your computer and use it in GitHub Desktop.
Save stevereich/3882872 to your computer and use it in GitHub Desktop.
Coldfusion handler for bad words filter.
<cfscript>
if(structkeyexists(form, "filterBox")){
variables.checkString = form.filterBox;
if(structKeyexists(form, "replaceString")){
if(form.replaceString EQ "0"){
variables.cleanText = application.filters.filterWords(variables.checkString,0);
}
else{
variables.cleanText = application.filters.filterWords(variables.checkString,1);
}
}
else{
variables.cleanText = application.filters.filterWords(variables.checkString,0);
}
variables.cleanText = serializejson(variables.cleanText);
writeoutput(variables.cleanText);
}
else{
location(url="wordFilter.cfm",addtoken=false);
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment