How can I stop spam on my custom forum/blog?
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 kin开发者_运维技巧d of static class I can download to do this? I am using PHP.
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...
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
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
I use this Akismet library here for my php website: http://www.achingbrain.net/stuff/php/akismet
I only run the first 10 comments from new users through it, and if they're spam, it sends me a notice.
I forgot to mention that we pay for their premium service, but it's cheap :-)
Yup, Akismet is definitely the best for stopping spam. It's like the Gmail of blog comments.
Akismet and captcha are both going to be useful. Another neat trick is to use a hidden form field. In my experience this will stop 90% of spam:
<style type="text/css">
label#hidden_label {
display:none;
}
</style>
<label id="hidden_label">Leave the following field blank:
<input type="text" name="fauxfield">
</label>
If fauxfield has text in it, you know it's spam. Spam bots will usually try to fill in all the fields.
Not foolproof in the least, but useful in low-traffic, non-mission-critical situations.
Check out Captcha. You can use it to help prevent bots from posting/signing up for your forums. This doesn't filter spam but tries to prevent things from being able to post it in the first place.
Edit
Also, you can actually use Akismet in your own projects, though it may cost money.
in setting > discussions and check the box
Other comment settings " Users must be registered and logged in to comment " you can control spam comments easily by this feature. and you can [block spam comments][1] using akismet and other plugins.
精彩评论