Re: [PHP] dirty words

2004-10-18 Thread Philip Thompson
  $badwords = array('poo', 'bum', 'perl');
Perl. Laf!
~P
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] dirty words

2004-10-18 Thread Skippy
On Sat, 16 Oct 2004 07:41:11 -0700 (PDT) Mag [EMAIL PROTECTED] wrote:
 I am useing file_get_contents on a remote page then
 using stristr() to make sure there are no bad words
 and its a family site.

May I point out this is a lost battle from the start? If someone really
wants to enter bad words they will, by masking them in various ways;
humans will interpret the bad words correctly in far more cases than you
can filter with software. Additionally, you will end up filtering parts of
legit words that look like bad words.

-- 
Skippy - Romanian Web Developers - http://ROWD.ORG

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



RE: [PHP] dirty words

2004-10-18 Thread Graham Cossey
Skippy does have a point.

If you still receive spam emails you'll know what he means. I must have seen
20 different ways of spelling viagra, using various accented characters etc:
viagra, viagra, viiagra etc etc

As for the legit words, there is the tale of Scunthorpe town council having
ALL its email blocked by filtering. (Scunthorpe is a UK town BTW).

But then again I could be talking total b0llocks, [EMAIL PROTECTED] and shit. (Sorry 
for
any offense caused, but you see the problem)

Graham

 -Original Message-
 From: Skippy [mailto:[EMAIL PROTECTED]
 Sent: 18 October 2004 18:13
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] dirty words


 On Sat, 16 Oct 2004 07:41:11 -0700 (PDT) Mag [EMAIL PROTECTED] wrote:
  I am useing file_get_contents on a remote page then
  using stristr() to make sure there are no bad words
  and its a family site.

 May I point out this is a lost battle from the start? If someone really
 wants to enter bad words they will, by masking them in various ways;
 humans will interpret the bad words correctly in far more cases than you
 can filter with software. Additionally, you will end up filtering parts of
 legit words that look like bad words.

 --
 Skippy - Romanian Web Developers - http://ROWD.ORG

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



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



Re: RE: [PHP] dirty words

2004-10-18 Thread hitek
What I find interesting is that you managed to use 4 variations on the word viagra, 
and your email still made it past my ISP's spam filters :)

Keith
 
 From: Graham Cossey [EMAIL PROTECTED]
 Date: 2004/10/18 Mon PM 06:27:02 EDT
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] dirty words
 
 Skippy does have a point.
 
 If you still receive spam emails you'll know what he means. I must have seen
 20 different ways of spelling viagra, using various accented characters etc:
 viagra, viagra, viiagra etc etc
 
 As for the legit words, there is the tale of Scunthorpe town council having
 ALL its email blocked by filtering. (Scunthorpe is a UK town BTW).
 
 But then again I could be talking total b0llocks, [EMAIL PROTECTED] and shit. (Sorry 
 for
 any offense caused, but you see the problem)

 
 Graham
 
  -Original Message-
  From: Skippy [mailto:[EMAIL PROTECTED]
  Sent: 18 October 2004 18:13
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] dirty words
 
 
  On Sat, 16 Oct 2004 07:41:11 -0700 (PDT) Mag [EMAIL PROTECTED] wrote:
   I am useing file_get_contents on a remote page then
   using stristr() to make sure there are no bad words
   and its a family site.
 
  May I point out this is a lost battle from the start? If someone really
  wants to enter bad words they will, by masking them in various ways;
  humans will interpret the bad words correctly in far more cases than you
  can filter with software. Additionally, you will end up filtering parts of
  legit words that look like bad words.
 
  --
  Skippy - Romanian Web Developers - http://ROWD.ORG
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] dirty words

2004-10-18 Thread Mag
Hi,

  I am useing file_get_contents on a remote page
 then
  using stristr() to make sure there are no bad
 words
  and its a family site.
 
 May I point out this is a lost battle from the
 start? If someone really
 wants to enter bad words they will, by masking
 them in various ways;
 humans will interpret the bad words correctly in far
 more cases than you
 can filter with software. Additionally, you will end
 up filtering parts of
 legit words that look like bad words.

True, but only sites that pass the above test get
added to the database on an unconfirmed state, then
I personally look at the site and confirm itthe
aboev is just something of a pre-screen

I got it working though so this is an old problem :-)

Cheers,
Mag


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



[PHP] dirty words

2004-10-16 Thread Mag
Hi,
I am useing file_get_contents on a remote page then
using stristr() to make sure there are no bad words
and its a family site.
Right now I am checking for just 3 bad words which
means 3 stristr() function calls, but if the bad words
increase then that would mean more calls

I have seen some forum software before that used to
take an array of bad words and check it against the
post, anybody have an idea what that function would be
like coz I am pretty sure I am going about this the
wrong way...php has a simple solution to most of these
problems...

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



RE: [PHP] dirty words

2004-10-16 Thread Chris Kay
 
in_array() can check your $string against a array and return if a bad word
is in string

Is this what you are after?

Chris Kay (CK)
[EMAIL PROTECTED]


-Original Message-
From: Mag [mailto:[EMAIL PROTECTED] 
Sent: Sunday, 17 October 2004 12:41 AM
To: php php
Subject: [PHP] dirty words

Hi,
I am useing file_get_contents on a remote page then using stristr() to make
sure there are no bad words
and its a family site.
Right now I am checking for just 3 bad words which means 3 stristr()
function calls, but if the bad words increase then that would mean more
calls

I have seen some forum software before that used to take an array of bad
words and check it against the post, anybody have an idea what that function
would be like coz I am pretty sure I am going about this the wrong way...php
has a simple solution to most of these problems...

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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

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



RE: [PHP] dirty words

2004-10-16 Thread Mag
Hey!
Thanks, I think in_array() is what I was looking for,
but by a quick glance I think its case sensitive (?),
I didnt want to use a class for this coz it kind of
seemed like using a gun instead of a flyswatter
:-)

Also, any way to check if a remote file exists?
I am presently using this:
$url='http://www.blah.net/movie.mpg'; 
$addy=parse_url($url); 
$addy['port']=isset($addy['port'])?$addy['port']:80; 
$sh=fsockopen($addy['host'],$addy['port']) or
die('cant open socket'); 
fputs($sh,HEAD {$addy['path']} HTTP/1.1\r\nHost:
{$addy['host']}\r\n\r\n); 
while($line=fgets($sh)) 
if(preg_match('/^Content-Length: (d+)/',$line,$m)) 
$size=$m[1]; 
echo isset($size)?size of $url file is $size: 'no
such file: '.$url; 

Thanks,
Mag


 in_array() can check your $string against a array
 and return if a bad word
 is in string
 
 Is this what you are after?
 
 Chris Kay (CK)
 [EMAIL PROTECTED]
 
 
 -Original Message-
 From: Mag [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, 17 October 2004 12:41 AM
 To: php php
 Subject: [PHP] dirty words
 
 Hi,
 I am useing file_get_contents on a remote page then
 using stristr() to make
 sure there are no bad words
 and its a family site.
 Right now I am checking for just 3 bad words which
 means 3 stristr()
 function calls, but if the bad words increase then
 that would mean more
 calls
 
 I have seen some forum software before that used to
 take an array of bad
 words and check it against the post, anybody have an
 idea what that function
 would be like coz I am pretty sure I am going about
 this the wrong way...php
 has a simple solution to most of these problems...
 
 Thanks,
 Mag
 
 =
 --
 - The faulty interface lies between the chair and
 the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)
 
 
   
 __
 Do you Yahoo!?
 Yahoo! Mail Address AutoComplete - You start. We
 finish.
 http://promotions.yahoo.com/new_mail 
 
 --
 PHP General Mailing List (http://www.php.net/) To
 unsubscribe, visit:
 http://www.php.net/unsub.php
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] dirty words

2004-10-16 Thread Kevin Waterson
This one time, at band camp, Mag [EMAIL PROTECTED] wrote:

 Hi,
 I am useing file_get_contents on a remote page then
 using stristr() to make sure there are no bad words
 and its a family site.
 Right now I am checking for just 3 bad words which
 means 3 stristr() function calls, but if the bad words
 increase then that would mean more calls

  $badwords = array('poo', 'bum', 'perl');

  $goodString = str_replace($badwords, '***', file_get_contents($url);

  echo $goodString;

If you are using php5 you can use str_ireplace() for a case insensitive 
search

Kevin
-
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

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