$clean = $input;
foreach($badwords as $badword){
$clean = preg_replace('/(\\W)$badword(\\W)/ims', '\\1' .
str_repeat('*', strlen($badword)) . '\\2', $clean);
}
On Wed, September 13, 2006 11:51 am, Beauford wrote:
> Hi,
>
> I have a form which I want to check for inappropriate words before it
>
On 13 Sep 2006, at 11:02 , Dave Goodchild wrote:
$_SESSION['profane'] = false;
foreach ($_POST as $value) {
foreach ($swearbox as $profanity) {
if (preg_match("/$profanity/i", $value)) {
$errors = true;
$_SESSION['profane'] = true;
mail(TEC
[PHP] Question on explode and join.
Hi. If you re-read my reponse you will see that it uses preg_replace with
the i flag which ignores case and will match banned words within words. With
a little modification (I can help if you like) you can easily use it in your
case.
On Thursday 14 September 2006 09:47, Ray Hauge wrote:
> On Wednesday 13 September 2006 11:51, Beauford wrote:
> > Hi,
> >
> > I have a form which I want to check for inappropriate words before it is
> > posted. I have used explode to put the string into an array using a space
> > as the delimiter a
On Wednesday 13 September 2006 11:51, Beauford wrote:
> Hi,
>
> I have a form which I want to check for inappropriate words before it is
> posted. I have used explode to put the string into an array using a space
> as the delimiter and then I check it against another array that contains
> the inapp
ker, which presents its own problems.
tedd
Thanks
-Original Message-
From: Ducarom [mailto:[EMAIL PROTECTED]
Sent: September 13, 2006 2:26 PM
To: Beauford
Cc: php
Subject: Re: [PHP] Question on explode and join.
I made some changes to the script from Butera. Now it only replaces complete
words.
play around with it
since
earlier today, so I haven't experimented with it, but ideas are welcome.
Thanks
-Original Message-
From: Ducarom [mailto:[EMAIL PROTECTED]
Sent: September 13, 2006 2:26 PM
To: Beauford
Cc: php
Subject: Re: [PHP] Question on explode and join.
I made some
uford
Cc: php
Subject: Re: [PHP] Question on explode and join.
I made some changes to the script from Butera. Now it only replaces complete
words.
$dirty = array(
'ipsum',
'eloquentiam',
'Vero'
);
foreach ($dirty as $key => $word) {
$dirty[$key] =
I made some changes to the script from Butera. Now it only replaces complete
words.
$dirty = array(
'ipsum',
'eloquentiam',
'Vero'
);
foreach ($dirty as $key => $word) {
$dirty[$key] = '/\b'. $word . '\b/';
}
$string = "Lorem ipsum ius no etiam veniam, usu alii novum ne, sed cu
molesti
Beauford wrote:
I have a form which I want to check for inappropriate words before it is
posted. I have used explode to put the string into an array using a space
as
the delimiter and then I check it against another array that contains the
inappropriate words.
I then replace the inappropriate w
_
From: Eric Butera [mailto:[EMAIL PROTECTED]
Sent: September 13, 2006 1:07 PM
To: Beauford
Cc: php
Subject: Re: [PHP] Question on explode and join.
On 9/13/06, Beauford <[EMAIL PROTECTED]> wrote:
Hi,
I have a form which I want to check for inappropriate words before it is
pos
Definitely look into preg_match or even preg_replace, instead of
tokenizing the string and rubbing it up against an array of your own.
Iterate on your array of bad words, and then use Regular Expressions
to selectively hunt and squash. You MAY be able to do it in one regex
operation by building a
On 9/13/06, Beauford <[EMAIL PROTECTED]> wrote:
Hi,
I have a form which I want to check for inappropriate words before it is
posted. I have used explode to put the string into an array using a space
as
the delimiter and then I check it against another array that contains the
inappropriate words
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 $val
14 matches
Mail list logo