Liam Delahunty: Home | Tips | Web | Contact |
---|
Recommended laptop
under £500. Think I deserve a present? See my Amazon Wish List |
PHP URL Count Check for Comment SpamThis simple little bit of code can be added to your spam filtering section on your contact forms, it checks for "http", "href" and "[url" in the message block. It counts them and repors them. It could be used within a spam detection routine on a form to filter away all those annoying "Your site is great" messgae that arrive with a dozen links in them...
$http = substr_count($text, "http");
Here's the ever so simple code:
if($submit){
Now simply check the values of $http, $href and $url and if beyond your limit, mark the message as spam. Here's a form for you to paste in some spam and see it in action. |