Re: link counting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 06 Apr 2007 09:01:20 -0400, Sebe wrote:
> i thought of an idea of counting the number of links to reduce comment spam.
>
> unfortunately my methods is not reliable, i haven't tested it yet 
> though.. anyone have maybe a better solution using some regexp?
>
> $links = array('http://', 'https://', 'www.');
>
> $total_links = 0;
> foreach($links as $link)
> {
>      $total_links = substr_count($string, $link);
> }
>        
> if($total_links > X)
> {
>     .....
> }

What I use:


     function check_bad_content($string)
     {
      // Stuff that spammers post with:
      $bad_strings =  array('www.','/url]','ttp://','ttps://') ;

      foreach( $bad_strings as $bad_string )
      {
       if ( ereg( $bad_string, $string ) ) return false ;
      }

      return true;

     }  // E-O- function check_bad_content


I permit _*NO*_ URL's on my message board.  I guess you could just as 
easily count them in the function above -- versus setting TRUE/FALSE.

Jonesy
-- 
  Marvin L Jones    | jonz          | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
    *** Killfiling google posts: <http://jonz.net/ng.htm>

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux