|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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?
Thanks! |
|
#2
|
|||
|
|||
|
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... </cfif> </cfloop> |
|
#3
|
|||
|
|||
|
what is the function of index="thisWord"?
|
|
#4
|
|||
|
|||
|
For a list loop, the index hold the current list element.
For future reference, questions like this are easily resolved with a quick look at the documentation: http://livedocs.macromedia.com/cold.../6.1/index.html |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > checking string submitted in form for expletives |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|