#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Dubai, UAE
    Posts
    449
    Rep Power
    15

    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. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,265
    Rep Power
    968
    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>
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Dubai, UAE
    Posts
    449
    Rep Power
    15
    what is the function of index="thisWord"?
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,265
    Rep Power
    968
    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/coldf...6.1/index.html

IMN logo majestic logo threadwatch logo seochat tools logo