1. Tom Drugan

    Project Manger at Communicator_e

    07 June 2001 18:30pm

    Tom Drugan

    I am working on creating a Flash based kid's game. On this game, we are allowing kids to enter a handle, 6 characters in length, to post their high scores. What we want to do is add a filter on this application so they can not enter any questionable or vulgar handles. We have done this before with 3 characters, and had client side java script checks for bad words, but 6 charaters adds about another million possibilities. Anybody come across this before? And if so, is there a software solution you would recommend?

  2. Kris Ellis

    Group Manager at Infosys

    18 June 2001 23:39pm

    Kris Ellis

    I have seen this done before for a kids football forum. A validation script using JavaScript was used. You need to write a fairly complex string parser that uses JavaScript Regular Expressions. The hardest thing is to list all the possible vulgar phases. But the character length is unlimited and it was fairly quick.

    I am not 100% familar with LiveScript the scripting language used by Flash 5, but it does look like a JavaScript hybrid. So the conversion should not be too difficult.

    However I will try and locate the source code for you which should make things a little easier.

    On 18:30:59 7 June 2001 tdrugan wrote:
    >I am working on creating a Flash based kid's game. On this
    >game, we are allowing kids to enter a handle, 6 characters
    >in length, to post their high scores. What we want to do
    >is add a filter on this application so they can not enter
    >any questionable or vulgar handles. We have done this
    >before with 3 characters, and had client side java script
    >checks for bad words, but 6 charaters adds about another
    >million possibilities. Anybody come across this before?
    >And if so, is there a software solution you would
    >recommend?

  3. Matthew O'Riordan Staff

    Founder / Director / Co-founder at easyBacklog / Aqueduct / Econsultancy

    19 June 2001 11:27am

    Matthew O'Riordan

    Livescript unfortunately does not support Regular Expressions (one of the most useful features of JavaScript which was quite strangely left out). Thus a regular expression is out of the question.
    You can however use the String().indexOf function to do a number of searches for expressions, but you will certainly end up filtering words that are not vulger as some vulgar words are contained within a normal word. Regular expressions would allow a set of context rules to be applied to a vulgar word such as a space before and after the word i.e. /\svulgar\s/, but once again they are out of the question.
    The 2 options I think you have are:
    1. Create an array of all vulgar words you can think of, and do an indexOf search for the words:
    var vulgarWords = new Array ('word1', 'word2', 'word3'); // etc.
    for (needle in vulgarWords) {
    if (String(handle).indexOf (vulgarWords[needle]) > -1) {
    // abort, vulgar word found
    }
    }

    2. Get the code from kris and use this code Server-side. You can then use the loadVariables() function in Flash 5, and send the handle as a String to the server. The Server-side code will verify the handle variable sent as a GET/POST, and should send back a response URL encoded to the Flash movie. The flash movie can then display a message to the user that their handle is inappropriate etc.

    Hope this helps.
    Matt

    On 23:39:54 18 June 2001 kris wrote:
    >I have seen this done before for a kids football forum. A
    >validation script using JavaScript was used. You need to
    >write a fairly complex string parser that uses JavaScript
    >Regular Expressions. The hardest thing is to list all the
    >possible vulgar phases. But the character length is
    >unlimited and it was fairly quick.
    >
    >I am not 100% familar with LiveScript the scripting
    >language used by Flash 5, but it does look like a
    >JavaScript hybrid. So the conversion should not be too
    >difficult.
    >
    >However I will try and locate the source code for you
    >which should make things a little easier.
    >
    >On 18:30:59 7 June 2001 tdrugan wrote:
    >>I am working on creating a Flash based kid's game. On
    >this
    >>game, we are allowing kids to enter a handle, 6
    >characters
    >>in length, to post their high scores. What we want to
    >do
    >>is add a filter on this application so they can not
    >enter
    >>any questionable or vulgar handles. We have done this
    >>before with 3 characters, and had client side java
    >script
    >>checks for bad words, but 6 charaters adds about
    >another
    >>million possibilities. Anybody come across this
    >before?
    >>And if so, is there a software solution you would
    >>recommend?

Reply to this thread

Log in to reply to this thread or join Econsultancy for free so you can post to our forums along with other benefits.