February 5th, 2004, 10:09 AM
checking string submitted in form for expletives
I have a username/password fucntion created for part of my website, and I would like to figure out a way to filter out foul language in either their password or username. How can I create a string of expletives and have it search their username or password to see if they are in the name somewhere?
February 5th, 2004, 01:01 PM
Yes, you can use findNoCase() to do this. In fact, you can easily combine a list of words with the find, in case the user name has a bad word in it anywhere, even if it is combined with another word. Something like this:
<cfset badWordList = "word1,word2" />
<cfloop list="#badWordList#" index="thisWord">
<cfif findNoCase( thisWord, form.userName )>
bad word found code goes here...
February 6th, 2004, 08:29 AM
what is the function of index="thisWord"?
February 6th, 2004, 08:53 AM