Mod/Hack: Adding Akismet spam-checking to Coppermine commenting - Page 2 Mod/Hack: Adding Akismet spam-checking to Coppermine commenting - Page 2
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Mod/Hack: Adding Akismet spam-checking to Coppermine commenting

Started by pharaohweb, July 13, 2006, 07:09:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

soro

Quote from: jasa on September 02, 2006, 12:08:45 AM
same for me - I get only blank screen...

I also had the blank screen, until I realized I hadn't correctly entered my Akismet API key. :) Also, on my local sandbox install, it doesn't work. So I assume it's about the hack not interpreting the error Akismet probably returns if you're not authorized to use the service?

In any case, make sure you've dropped in your Akismet key, and your URL where it belongs. I believe also the Permalink URL some lines below. Finally, if your server is on PHP 5.+, from Prisoner_24601 above:

Quote from: Prisoner_24601 on July 17, 2006, 08:08:49 PM
BTB, I have PHP5.  I'm usening the PHP5 class from http://www.achingbrain.net/stuff/akismet/

Hope that solves the issue. Plus, I have the serious impression that this hack seriously rrrrrrrocks. At least, I haven't seen any spam for a week or so. Eager to see the next version with the possibility to have a look into what's being filtered. :)

jasa

It is definitely not the API key...
When I use wrog key than I get
QuoteInvalid API key. Please obtain one from http://wordpress.com/api-keys/
.

I also realized that I can add comment when I put out part of code after
$akismet = new Akismet($MyBlogURL, $WordPressAPIKey);
or comment the rest after
/* $akismet->setCommentAuthor($name);
$akismet->setCommentAuthorEmail($email);
$akismet->setCommentAuthorURL($url);
$akismet->setCommentContent($comment);
$akismet->setPermalink('http://www.kjd-zagreb.hr/galerija');

if($akismet->isCommentSpam())
    // store the comment but mark it as spam (in case of a mis-diagnosis)
    cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
else */


I tried everything but I don't know how to debug this and what is wrong in this part...
When I put only one line more for example:
Quote$akismet->setCommentAuthor($name);
I get again only blank screen...

When I use PHP5, it doesnt work from begining (include)...

SPAMers are killing me, and captcha also doesnt seem to work...

Any help?

Greetz
J.



soro

Hmm, different idea: May it be the include 'Akismet.class.php' statement has to come after you set the IN_COPPERMINE thingy to true? I remember I also played with the order of these statements between when I got a blank screen and when it started to pull. Just an idea, perhaps complete nonsense, for which case I do apologize.

soro

My Akismet hack stopped filtering. :-( Only thing I did in the meantime was to upgrade my CPG installation form 1.4.8 to 1.4.9. I redeployed the hack afterward, of course.

Anyone with a similar experience? Or is it just my site? Is there a way to monitor the communication between my installation and Akismet? I don't have access to server logs.

ernst34

I move this ost to this thjread as per suggestion of one of the Administrators:

Gau Gau
Thanks for your answer. Sorry to react late to it.
I was following your advise, got an API key and followed the procedures described in post
http://forum.coppermine-gallery.net/index.php?topic=33827.0 of Pharaoweb.

I must have done something wrong, when I did this:
------------------------------------------
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.4
  $Source: /cvsroot/coppermine/stable/db_input.php,v $
  $Revision: 1.18 $
  $Author: gaugau $
  $Date: 2006/02/24 13:30:07 $
**********************************************/

include 'Akismet.class.php';
define('IN_COPPERMINE', true);
define('DB_INPUT_PHP', true);[/size][/size]
---------------------------------------------------

I tested my new configuration in the gallery, and when I posted a test comment as a guest I only got an empty page, the route was http://www.ecolyma/galeria/db_input.php, and the page froze

I am confused now as to what the correct procedures would be.

Again, help from the forum will be much appreciated
Regards
Ernst

vody

Dear,

I think I have the solution for the "blank page" problem. I'm a newbie in programming and bad in English, so I will try to explain the little modifications I made...

The matter comes that the functions called in "db_input.php" haven't the same name in the "Akismet.class.php" document. You have to change the code that you input in "db_input.php" :


        $WordPressAPIKey =  'your Akismet API key goes here';
$MyBlogURL = 'http://www.example.com/coppermine_root_dir/';
$name = $msg_author;
$comment = $msg_body;

$akismet = new Akismet($MyBlogURL ,$WordPressAPIKey);
$akismet->setAuthor($name);
$akismet->setAuthorEmail($email);
$akismet->setAuthorURL($url);
$akismet->setContent($comment);
$akismet->setPermalink('http://www.example.com/blog/alex/someurl/');

if($akismet->isSpam())
    // store the comment but mark it as spam (in case of a mis-diagnosis)
    cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
else
    // store the comment normally
    $insert = cpg_db_query("INSERT INTO {$CONFIG['TABLE_COMMENTS']} (pid, msg_author, msg_body, msg_date, author_md5_id, author_id, msg_raw_ip, msg_hdr_ip) VALUES ('$pid', '{$CONFIG['comments_anon_pfx']}$msg_author', '$msg_body', NOW(), '{$USER['ID']}', '0', '$raw_ip', '$hdr_ip')");


As you can see, the functions are no more called "setCommentAuthor(); setCommentAuthorEmail(); setCommentAuthorURL(); setCommentContent() and isCommentSpam()". I give them the same name as in the "Akismet.class.php" I found.


freesouljah

your english is fine and your fix worked great...thanks a bunch for figuring this out...

peace
;D


Quote from: vody on September 16, 2006, 08:45:47 PM
Dear,

I think I have the solution for the "blank page" problem. I'm a newbie in programming and bad in English, so I will try to explain the little modifications I made...

The matter comes that the functions called in "db_input.php" haven't the same name in the "Akismet.class.php" document. You have to change the code that you input in "db_input.php" :


        $WordPressAPIKey =  'your Akismet API key goes here';
$MyBlogURL = 'http://www.example.com/coppermine_root_dir/';
$name = $msg_author;
$comment = $msg_body;

$akismet = new Akismet($MyBlogURL ,$WordPressAPIKey);
$akismet->setAuthor($name);
$akismet->setAuthorEmail($email);
$akismet->setAuthorURL($url);
$akismet->setContent($comment);
$akismet->setPermalink('http://www.example.com/blog/alex/someurl/');

if($akismet->isSpam())
    // store the comment but mark it as spam (in case of a mis-diagnosis)
    cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
else
    // store the comment normally
    $insert = cpg_db_query("INSERT INTO {$CONFIG['TABLE_COMMENTS']} (pid, msg_author, msg_body, msg_date, author_md5_id, author_id, msg_raw_ip, msg_hdr_ip) VALUES ('$pid', '{$CONFIG['comments_anon_pfx']}$msg_author', '$msg_body', NOW(), '{$USER['ID']}', '0', '$raw_ip', '$hdr_ip')");


As you can see, the functions are no more called "setCommentAuthor(); setCommentAuthorEmail(); setCommentAuthorURL(); setCommentContent() and isCommentSpam()". I give them the same name as in the "Akismet.class.php" I found.



ckroell

5000 times thank you very much - your description solved my blank page issue and comments are now stored again caoorectly - waiting for the spamers now :-)

jasa

finally...  ;D work for me also fine! No blank screen any more...
TNX vody!

ckroell

Hi,

I have successfully implemented this SPAM thing but do still suffer from these kind of entries:

http://tennotr.ifrance.com http://novieludi.blogspot.com/ (...) http://voyagithochu.blogspot.com/ (...) http://blditedor.blogspot.com/


I have just received more than 200 comments in a row with these links.

I do not want to force my guests to register so guests are allowed to enter comments.

Is there a chance to avoid these http comments? Maybe using this SPAM thing?

Thank you in advance.

Christian

ckroell

Please disregard my last comment - I found the solution - I hope - in a different threat and I will go on implementing the captcha thing.

Thank you,

Christian

Thorsten

Hello

to the first post: there are 2 identical lines that match the one to replace! Which one is to replace? I replaced the first one.
It seems to work, no errors but I don't know if spammers still can spam.
what to enter in $MyBlogURL and $akismet->setPermalink ? I entered the url to the cpg root in the first and my domain in the second field. correct? the whole rest has been untouched by me.

my gallery: http://bilder.dampftraktion.de
Thorsten

To see my gallery go to the website link in my profile

Thorsten

adding Askimet to the gallery brought me this error:
Parse error: parse error, unexpected T_IF, expecting T_CASE or T_DEFAULT or '}' in /[...]/coppermine/db_input.php on line 40
so, commenting is not possible at the moment.....
I only edited what waswritten above.
Thorsten

To see my gallery go to the website link in my profile

Joachim Müller

See my reply to your identical posting on the German support board: http://forum.coppermine-gallery.net/index.php?topic=37632.msg177659#msg177659
Please don't double-post your issues on several threads - decide for one, then stick to it.

osh

Vody - thank you!!!   Your changes fix it correctly, and yes.  Your English is excellent, I was able to follow along what was going on.

This hack works great, so far.  I tested it as being logged in, not logged in with a legit anonymous comment, and with a proven spam comment (user "viagra-test-123" will always provide a true spam, based on akismet web site http://akismet.com/development/api/)

Now I wait patiently for pharaohweb's updates.  Being able to submit spam and ham back will allow us to help keep that database up to date and keep those evil bastard spammers at bay!!!

Sosha

There seems to be a server error causing the captcha plugin/mod to not work on my host so I tried this instead and, after using the fix, it works great

hopefully the gallery will still be spam free in a few days

thanks

osh

I have currently turned off anonymous comments, there were still spam comments getting through.  I believe this is the better method, it requires less overhead from the end user to worry about.  Having to try and decipher text in an image box is not something I enjoy, so don't want to inflict that on my visitors.

I eagerly await the additional changes to get the spam/ham submissions working...

Sosha

ditto, the mod seems to work well but akismet aren't stopping the type of spam that goes through.
I honestly think that if i could just block any messages that contained urls or (...) then it would be spam free

bllamasy@gmail.com

I am sorry I am new at this! I have installed akismet and done all modifications, how do I know that it is working???
Thanks in advance