However, no one is perfect, and no one is perfect! Akismet is not perfect. Recently, I often find messages from "good people" among the messages that Akismet has judged as spam. However, sometimes they are automatically deleted after a long time, resulting in the loss of precious friendships and messages.
Don’t forget to modify __YOUR_AKISMET_KEY__, __YOUR_WEBSITE_URL__ and __YOUR_NAME__ in the code
http://www.script-tutorials.com/akismet-spam-protection/
index.php
Copy the code The code is 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 <<