RE: [PHP] dirty words
| From: | Mag | Date: | Sat, 16 Oct 2004 15:01:49 +0000 |
| Subject: | RE: [PHP] dirty words | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199634@lists.php.net to get a copy of this message | ||
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)
> chris@eleet.com.au
>
>
> -----Original Message-----
> From: Mag [mailto:genphp@yahoo.com]
> 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