Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I stop spam on my custom forum/blog?

Tags:

php

spam

So I have a custom built forum & blog system that as of late has been dealing with a lot of spam. If it was Wordpress I would use Akismet, if it was a different common platform I'm sure I'd find a plugin. Is there any kind of static class I can download to do this? I am using PHP.

like image 510
Andrew G. Johnson Avatar asked Feb 18 '11 20:02

Andrew G. Johnson


People also ask

What is spamming on a forum?

Forum spam consists of posts on Internet forums that contains related or unrelated advertisements, links to malicious websites, trolling and abusive or otherwise unwanted information.


3 Answers

I'd still go with Akismet, if you like it. For uses outside of WordPress, you may have to pay a fee for it, depending on your use -- check the terms and conditions -- but it's definitely an option and easy to implement yourself in PHP using their API. You just use the API key from a wordpress.com account for the access.

Basically, you grab yourself whichever PHP client library takes your fancy -- I use Alex Potsides' PHP5 library -- plug in your key, and it's a handful of lines of code. Here's the bare bones of the validation straight from one of my live sites:

...
            if ($akismet)
            {
                $akismet->setCommentAuthor($name);
                $akismet->setCommentAuthorEmail($session->userinfo["email"]);
                $akismet->setCommentAuthorURL("");
                $akismet->setCommentContent($sentence);
                $akismet->setPermalink("");
                if($akismet->isCommentSpam())
                {
                    // store the comment but mark it as spam (in case of a mis-diagnosis)
                    $spam = true;
                    // ...
                }
...

You just shove in whichever fields you have, and Akismet does its best for you and returns you a yay or nay...

like image 74
Matt Gibson Avatar answered Oct 18 '22 09:10

Matt Gibson


Akismet is not just for wordpress. They have an API.

Combine that with reCaptcha, and you should be much better off.

http://akismet.com/development/api/
http://code.google.com/apis/recaptcha/docs/php.html

like image 2
profitphp Avatar answered Oct 18 '22 09:10

profitphp


There are many solutions to stop spammers in your sites

  • Akismet
  • http://www.stopforumspam.com/ API
  • http://www.fassim.com/ API
  • Honeypot
  • Catptchas (bit outdated and creates inconvenience to normal users too) including image captcha, Text captcha etc..
  • IP blocking etc..

All these are php based which you can easily integrate to any CMS

like image 2
Team Webgalli Avatar answered Oct 18 '22 07:10

Team Webgalli