Re: Form Data Filtering

From: Date: Fri, 15 Jun 2007 15:47:53 +0000
Subject: Re: Form Data Filtering
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-257091@lists.php.net to get a copy of this message
On 6/15/07, kvigor <k3cheese@insightbb.com> 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.
Nice list, but what about this: sh!t d!ck mtherfucker sl ut and I can continue for hours..., and what if your $_POST['var'] contains more than only the work, like: .fuck -slut `asshole The code Daniel provided seems the only that can handle the last things, and for the first you should get a real list of inappropriate words... Tijnema

« previous php.general (#257091) next »