Re: [PHP] Question on explode and join.

2006-09-15 Thread Google Kreme
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;

Re: [PHP] Question on explode and join.

2006-09-15 Thread Richard Lynch
$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 is

RE: [PHP] Question on explode and join.

2006-09-14 Thread tedd
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. $dirty = array( 'ipsum', 'eloquentiam', 'Vero

Re: [PHP] Question on explode and join.

2006-09-14 Thread Ray Hauge
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

Re: [PHP] Question on explode and join.

2006-09-14 Thread Ray Hauge
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 and then I

RE: [PHP] Question on explode and join.

2006-09-14 Thread Beauford
] 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.

Re: [PHP] Question on explode and join.

2006-09-13 Thread Dave Goodchild
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

Re: [PHP] Question on explode and join.

2006-09-13 Thread Eric Butera
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.

Re: [PHP] Question on explode and join.

2006-09-13 Thread Christopher Watson
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

RE: [PHP] Question on explode and join.

2006-09-13 Thread Beauford
_ 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 posted. I have

Re: [PHP] Question on explode and join.

2006-09-13 Thread Jon Anderson
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

Re: [PHP] Question on explode and join.

2006-09-13 Thread Ducarom
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

RE: [PHP] Question on explode and join.

2006-09-13 Thread Beauford
: [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] = '/\b'. $word . '\b/'; } $string = Lorem ipsum ius no etiam

Re: [PHP] Question on explode and join.

2006-09-13 Thread Ducarom
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 changes to the script from Butera. Now it only replaces complete words