However, no one is perfect, plug (pieces) No end plug! Akismet is not perfect, recently, I often in the akismet judged as rubbish in the message found "good people" message, however, sometimes long time on the automatic deletion, loss of valuable friendship and messages.
Don't forget to modify the __your_akismet_key__ in the code, __your_website_url__ and __your_name__
http://www.script-tutorials.com/akismet-spam-protection/
index.php
Copy the Code code as follows:
Require_once (' classes/akismet.class.php ');
Class Myspamprotection {
Variables
var $sMyAkismetKey;
var $sWebsiteUrl;
var $sAuthName;
var $sAuthEml;
var $sAuthUrl;
var $oAkismet;
Constructor
Public Function myspamprotection () {
Set necessary values for variables
$this->smyakismetkey = ' __your_akismet_key__ ';
$this->swebsiteurl = ' __your_website_url__ ';
$this->sauthname = ' __your_name__ ';
$this->sautheml = ";
$this->sauthurl = ";
Akismet initialization
$this->oakismet = new Akismet ($this->swebsiteurl, $this->smyakismetkey);
$this->oakismet->setcommentauthor ($this->sauthname);
$this->oakismet->setcommentauthoremail ($this->sautheml);
$this->oakismet->setcommentauthorurl ($this->sauthurl);
}
Public function Isspam ($s) {
if (! $this->oakismet) return false;
$this->oakismet->setcommentcontent ($s);
return $this->oakismet->iscommentspam ();
}
}
Echo <<
EOF;
if ($_post) {
Draw Debug Information
Echo '
Echo '
';
Obtain sent Info
$sPostAuthor = $_post[' author ');
$sCommentComment = $_post[' comment ');
Check for spam
$oMySpamProtection = new Myspamprotection ();
$sAuthorCheck = ($oMySpamProtection->isspam ($sPostAuthor))? ' Author ' marked as Spam ': ' Author ' not marked as Spam ';
$sCommentCheck = ($oMySpamProtection->isspam ($sCommentComment))? ' Comment ' marked as Spam ': ' Comment ' not marked as Spam ';
Echo $sAuthorCheck. '
' . $sCommentCheck;
}
?>
Source.zip
The above describes the use of Kismet PHP akismet to prevent spam comments, including the kismet aspects of the content, I hope that the PHP tutorial interested in a friend helpful.