Re: Question on explode and join.

From: Date: Wed, 13 Sep 2006 17:02:46 +0000
Subject: Re: Question on explode and join.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-241736@lists.php.net to get a copy of this message
Hi. I have just added a profanity filter to a current project which runs like so (all form values are passed into the session after checking for required fields etc). $swearbox is an array containing profanities so I won't include it here! $_SESSION['profane'] = false; foreach ($_POST as $value) {
       foreach ($swearbox as $profanity) {
           if (preg_match("/$profanity/i", $value)) {
           $errors = true;
           $_SESSION['profane'] = true;
           mail(TECHEMAIL, 'profane content attack attempt on DJST', "From:
{$_SERVER['REMOTE_ADDRESS']} Time: " . date('d F Y G:i:s', time()-TIMEDIFF), 'whoops@dontjustsitthere.co.uk');
           }
       }
} ...if $errors is true at the end of processing I send the user back to the form. In this instance if there are rude words $_SESSION['profane'] is set and we warn the user.
-- http://www.web-buddha.co.uk http://www.projectkarma.co.uk

« previous php.general (#241736) next »