kvigor wrote:
Hello,

I 'm checking form data for profanity but it only works if the $_POST['var'] is lowercase I was wondering if anyone knew how I could catch the profanity no matter what case it was. No matter if it was BAD or bad or mixed like BaD?

Instead of the long way:

if ($value == "fuck" || $value == "shit" || $value == "whore" || $value == "shit" || $value == "bullshit" || $value == "ass" || $value == "asshole" || $value == "piss" || $value == "bitch" || $value == "bastard" || $value == "motherfucker" || $value == "pussy" || $value == "cunt" || $value == "slut" || $value == "hell" || $value == "goddamn" || $value == "skank" || $value == "Tit" || $value == "dick" || $value == "hoe")
 {
  $profanity[$field] = "bad";
 }

Any suggestions welcome.


I find it hilarious how you've just posted as many dodgy words as you could to the list :)

But try...

        $bad_words = array("word1", "word2", "word3");
if(in_array(strtolower($_POST['val']), $bad_words)){ $_POST['val'] = "bad";
        }

Darren

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to