|
printable version
- email this article
URL Spam Detector Function
by johnk
Saturday, Oct. 21, 2006 at 1:08 AM
This is a function that returns true if URLs make up a big portion of the post.
Add this to the spam_class.inc
function too_many_urls( $str ) {
$sansUrls = preg_replace( '/http:[a-zA-Z0-9.\\/]+?/', '', $str );
$sansHref = preg_replace( '/href/', '', $sansUrls );
$sansUrl = preg_replace( '/url/', '', $sansHref );
$sansWww = preg_replace( '/www[a-zA-Z0-9.\\/]+?/', '', $sansUrl );
if ((sizeof($sansWww)/sizeof($str)) > 0.5)
return 1;
else
return 0;
}
You can use it like this, just before return $ret:
if ($this->too_many_urls( $_POST['article'] ))
$ret = 1;
LATEST COMMENTS ABOUT THIS ARTICLE
Listed below are the 10 latest comments of 1 posted about this article.
These comments are anonymously submitted by SF-IMC website visitors.
| TITLE |
AUTHOR |
DATE |
| fix |
johnk |
Saturday, Oct. 21, 2006 at 1:44 AM |
|
|
|