Fancy stuff about my technical life
What this all about is....Akismet @ Pastebin
posted by cimnine @ 9:42pm, Thursday 20 November 2008.
Today I strungled over Akismet, which is a webservice designed for classifing your comments as SPAM, rsp. as "No SPAM". And I missuse this function to let the postings of my public Pastebin (which is based on PasteBox) rush through that service.I've implemented it today and I'm testing it now for a while. If it's a success, I'll implement it for this EggBlog too.
But first, the implementation for PasteBox:
$entry->date = time();
#SPAM detection
require_once("akismet/Akismet.class.php");
$apikey = "xxxxxx";
$url = url_generate('entry');
$akismet = new Akismet($url,$apikey);
$akismet->setCommentAuthor($entry->name);
$akismet->setCommentContent($entry->content);
if(!$akismet->isCommentSpam()) {
$id = $entry->save();
header('Location: '.url_generate('entry.view', $id));
} else {
require_once("views/new.php");
return;
}
That's it. Just change the end of "sys/new.php" to this and get the PHP5-Class from here and extract it, so that Akismet.class.php's path is "sys/akismet/Akismet.class.php".
Ooh. And yes. You have tho change the $apikey to your own. Look here for an explanation how to get an API Key.
~cimnine
PS: Yesterday I found a blog useing nearly the same design as I have. (Nearly, because I modified it a bit ^^) ~cimnine
UPDATE:
The test failed. :(
But: I implemented a new textbrowser-friendly CAPTCHA-Method.
The user has just to press the correct submit button.
There is one hidden button too.
It's like that:
{Formfields}
Press button [random(1,2)]:
[submit hidden] {Submit 1} {Submit 2}
You'll find an example on http://pastebin.ch/new.
Maybe this works.... I hope so.
~cimnine
Comments
Submit Your Comment
You are not logged in.