Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: 1 2 [3] 4 5 6   Go Down

Author Topic: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting  (Read 213644 times)

0 Members and 1 Guest are viewing this topic.

csa

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • Team Hustler
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #40 on: December 13, 2006, 12:45:57 pm »

Within the next few days, I plan to start looking to how to pluing-ize the whole thing.  Before then though, I may post some raw code snippets for those not interested in waiting and more keen on modding their own installation.  I want to do a little more testing of the spam/ham functionality before I rush to get it up though.

Thanks for the support, take care.

Sounds great pharaohweb. Any chance you might be posting fresh code snippets any time soon?
Logged

moli

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #41 on: January 16, 2007, 12:33:29 am »

I´m doing anything or all bad, I 'm getting blank page.

Quote
$WordPressAPIKey =  'my api  key code (including this marks ' ')';
   $MyBlogURL = 'http://usuarios.lycos.es/moliterni/web/';
   $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/');

could somebody help me?

thanks in advance.
Logged

moli

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #42 on: January 16, 2007, 08:57:36 pm »

no ones help me?
Logged

osh

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #43 on: January 17, 2007, 10:51:52 pm »

Make sure that the Akismet.class.php file contains the same function names that you are calling from your db_input.php.  (that they contain  setAuthor, setAuthorEmail, etc....)

One of the issues solved earlier was the Akismet.class changed and the function names changed.  If you are using an older Akismet.class.php file, it could be that the functions are still the older names.
Logged

cindyr

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #44 on: January 23, 2007, 06:22:55 am »

Hello. This looks like the perfect solution to my spam problem (thanks!), but I'm obviously doing something basic wrong. I don't get any errors, it just lets spam through, even the "viagra-test-123". http://www.sandycove.org/community/gallery

I obtained the WP API key and the Akismet.class.php. I followed your include and put it in the root folder. I found the only line that directly matched your line to replace (using search and replace) and pasted your code into it. Then correctly put in my API key and my URL. (I'm using PHP4 and using Vody's hacks to avoid the blank screen for anonymous users which by the way doesn't show up for registered users...)  Uploaded it to replace the existing db_input.php file in the root directory. Nothing. Nada. It doesn't even attempt to block spam, but doesn't create any errors or blank screens (now, thanks to Vody).

Possible causes:
1. I'm still uncertain about the permalink line. What should this be? I tried a couple of different things, but I don't know what this line is for, so I haven't a clue what it should be.

2. Um, well, I don't have any other ideas. Help?

cindyr
Logged

osh

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #45 on: January 25, 2007, 07:54:42 pm »

Make sure the "patch" is applied at the correct location.  There are some similar places that is can be applied.  The original $insert=cpg_db_query... was on line 147.  As far as permalink, I didn't change anything from the sample, and it (for the most part) works.

There is still spam making it through, but the bulk of my issues were resolved with this fix.
Logged

soro

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #46 on: January 25, 2007, 10:20:31 pm »

The permalink thing is for if you apply it to a single blog which has one exact address, I guess. So that Akismet can know for which blog it is filtering. Now, with coppermine, you have of course a different address for each of your images. I remember I got the impression that there was an issue with the permalink when I first installed it, and I settled on the address of a random image from my gallery. Works since then.

The entire system works like a charm for me. Every once in a while, I get a few spam messages, and I'm always waiting for the dams to break. Particularly since we don't have a way to submit the coppermine specific spam that might be out there. But it seems that until now, Akismet has always learned of the new spam arriving at my gallery within a day or two.
Logged

osh

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #47 on: January 26, 2007, 09:36:12 pm »

Hmmm, that could be why I kept getting spam, even though akismet blocked the bulk of it.  I'll try setting the permalink to one of the images.
Logged

MstrMitch

  • Guest
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #48 on: January 27, 2007, 09:49:33 am »

I cannot get this to work and I have upgraded to the latest version

in the vody hack it says to change the hack to whatever askimet is using as its parameters. I am using the php4 version

askimet says to use these:

$format = array(
            'type' => 'comment_type',
            'author' => 'comment_author',
            'email' => 'comment_author_email',
            'website' => 'comment_author_url',
            'body' => 'comment_content'
         );

but the hack says to use these...

$akismet->setAuthor($name);
$akismet->setAuthorEmail($email);
$akismet->setAuthorURL($url);
$akismet->setContent($comment);

am I reading this wrong because I would think it should be SetAuthor($author) not ($name)

sometimes when I do this I get an array error. it shows the info for my settings but most variations give me a blank page EVEN with vody's hack changes.

Logged

jasa

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #49 on: January 28, 2007, 07:44:18 pm »

Im using PHP4 Askimet class with coppermine 1.4.8
Till now everything worked fine - I installed askimet and it reduced spam to few spam comments in a week. But now the spamers are back again and I didn't changed anything by my coppermine gallery or Askimet.

Today I even tried to simulate the spam writing someting like viagra etc. but everything goes through. Did they changed something at askimet or I don't know what happened?

I use folowing piece of code in db_input.php
Code: [Select]
$WordPressAPIKey='my_key';
$MyBlogURL = 'http://www.xxx.com/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.xxx.com/dir/');

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')");

What for is this setPremalink command anyway?

Thanks!

Greetz
J.
Logged

soro

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #50 on: February 03, 2007, 03:09:00 am »

That setPermalink sets some information that the Akismet system wants to collect/verify. It should normally point back to your blog. But since we're here not talking about a blog, but about a whole lot of different pictures, it's not quite obvious what to correctly fill in here... It may, at some point in time, prevent Akismet from catching all the spam if it doesn't point back to the exact URL for which the system is put to work, but I don't think that's the case now.

Akismet reads every message posted to your gallery against a database of spam messages that have been submitted and identified as spam by users. There may be some spam messages which are clearly spam, but haven't been identified as such by any Akismet user (yet). Those spam messages will get through. Don't expect Akismet to catch everything! If you want to implement and never look back, consider Captchas instead.

If you want to check whether your Akismet implementation works, you have to send a comment to your gallery which is clearly in the Akismet database. There're a few sample spam messages a few pages up in this thread, which have done the trick for me a few months back.

You may also look into your server logs or, better, webstats if you compile them for instance with Awstats. If your hits on db_input.php are considerably more frequent than ham AND spam arriving at your gallery, it's my understanding that Akismet is filtering something. Also, I've found that the spambots posting to my site hit directly on db_input.php, without doing some camouflage moves through the gallery before. Which means my Awstats counts them as Entry/Exit to the site. Normal legit users shouldn't enter the site at the comment input script, I would believe. So you can count those Entry/Exit hits, or hosts which don't leave any trace other than hits con db_input.php, as spambots, and see whether the number of those hits is considerably higher than the Spam arriving at your gallery. If it is --> take it as evidence that Akismet is performing.

Also a trace of the spammers in your webstats: Hosts which make as many hits as pageviews. I don't think there's any page which is worth just one hit in most of our sites, so you can assume that those one-hit-per-pageview visits are spambots. Again, to have an idea how much exposure to spambots you have, and to weigh it against the spam that's actually arriving.

The shame is that we don't have the full plugin promised by Pharaoweb so far. With that, we could submit our own spam samples to Akismet, and we could also see what's identified as spam by Akismet. We could be full Akismet users, in other words. But I'm not complaining! :-)
Logged

jasa

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #51 on: February 10, 2007, 11:29:10 pm »


Thank you for your long reply soro.

However some things connected to Askimet are still unknown for me.
I just noticed that Askimet efficiency dropped to nearly zero in my case in last 2 months. At the beginning when I installed Askimet I had few comments in a week or day. Now I’ve again 30-100 or more per day! Why is Askimet filtering so badly or SPAMers are now much better?

However I did some simple tests – when I put for the name of commenter for example “Viagra”, and for comment ”visit Viagra site” – Askimet will block the comment. When I change the name of commenter to for example Marco, and use same comment text (visit Viagra site) comment will go trough. Both examples are simplest case of spam. Why Askimet let the second one to go through?

I implemented Askimet also on cutenews and some other scripts… It is the same problem and spamers are now back again. :(
I wanted to try with captcha but it didn’t work with my gallery.

Awstats says for January that db_imput.php was 2022 accessed, from which was 728x entry, and 1257 exit. However as you say I don’t know how much Askimet blocked because I delete every week all spam in my gallery – and it was lot, more than 500 for sure…

It seems that I’ve to move to other solutions for spamers such as captcha is…

TNX…
Greetz
Jasa
Logged

soro

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #52 on: February 11, 2007, 12:10:54 am »

At my gallery, they arrive in bouts. But after two days or three, it's always been over so far. Why Akismet blocks some things and not others, that's certainly something they would have to tell. It's not a perfect defense, and the spammers can probably also interfere with the filtering and mark their own shit as ham. So on the long run, it depends on everyone cooperating in telling spam from ham. We can't do that for the moment. But having a more elaborate Akismet module would probably mean some serious mods to the database... Which is something I certainly cannot do on my own.

I guess somebody thinks there may be legit reasons for people to exchange about erectile dysfunction and cures for it.

On a different system, I've made pretty positive experiences with Bad Behavior. That also looks like something that could be implemented rather easily. Or perhaps, it's just back to the captcha and other challenges once it gets too bad.
Logged

morktron

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #53 on: February 14, 2007, 01:15:23 am »

Hello everyone, well done developing this thing.

I can't get it to work though, I'm getting a blank screen despite using the fix.

in my akismet.class.php i have:

'type' => 'setType',
'author' => 'setAuthor',
'email' => 'setAuthorEmail',
'website' => 'setAuthorUrl',
'body' => 'setContent'

in my db_input.php i have:

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

should it be working?
Logged

fcollingwood

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #54 on: February 16, 2007, 12:32:06 pm »

Hi

Using 1.4.10 and the latest version of akismet.class.php. I also had the blank screen problem, and on looking at the changes made in the current (as of todays date) class, this is how you get it to work (Replace the bold sections with your own relevant information):

Quote
        $WordPressAPIKey =  'put your API key here';
        $MyBlogURL = 'put your gallery URL here';
        $name = $msg_author;
        $comment = $msg_body;

        $check_comment = array(
                'author'         => $name,
                'email'           => 'no-one@nowhere.com',
                'website'        => 'http://www.example.com/',
                'body'           => $comment,
                'permalink'     => 'put a link to one of your images here',
        );

        $akismet = new Akismet($MyBlogURL ,$WordPressAPIKey,$check_comment);

        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')");
Logged

fcollingwood

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #55 on: February 16, 2007, 12:35:15 pm »

Update to above - Akismet PHP4 class version is 0.3.3
Logged

fcollingwood

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #56 on: February 16, 2007, 01:00:07 pm »

Final update to the above......

Find the following lines in db_input.php:

  • $update = cpg_db_query("UPDATE {$CONFIG['TABLE_COMMENTS']} SET msg_body='$msg_body' WHERE msg_id='$msg_id' AND author_id ='" . USER_ID . "' LIMIT 1");
  • $update = cpg_db_query("UPDATE {$CONFIG['TABLE_COMMENTS']} SET msg_body='$msg_body' WHERE msg_id='$msg_id' AND author_md5_id ='{$USER['ID']}' AND author_id = '0' LIMIT 1");
  • $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')");
  • $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', '" . addslashes(USER_NAME) . "', '$msg_body', NOW(), '', '" . USER_ID . "', '$raw_ip', '$hdr_ip')");

Above each of these lines, add the following (do not replace them!!!!):

Quote
        $WordPressAPIKey =  '853b85ad0ab0';
        $MyBlogURL = 'http://www.collingwood.me.uk/gallery/';
        $name = $msg_author;
        $comment = $msg_body;

        $check_comment = array(
                'author'        => $name,
                'email'         => $email,
                'website'       => 'http://www.example.com/',
                'body'          => $comment,
                'permalink'     => 'http://http://www.collingwood.me.uk/gallery/displayimage.php?album=6&pos=4/',
        );

        $akismet = new Akismet($MyBlogURL ,$WordPressAPIKey,$check_comment);

        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

This does not allow spam comments from anonymous or registered users, and also prevents editing of an existing, innocuous, comment to add spam. All done, your gallery is no longer open to abuse by the b'stards!
Logged

Anrulz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #57 on: February 21, 2007, 02:04:05 pm »

I did all what said above but I dont have anythin changed
www.hababam.biz/galeri
Logged

Anrulz

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #58 on: February 21, 2007, 02:49:22 pm »

Do I need to add bad words on my own or what ? :( anyways guys the problem why all you get blank page is pharoah is telling you the way with php5 library but you are downloading php4 keep this in mind ...
Logged

Vee

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 33
Re: Mod/Hack: Adding Akismet spam-checking to Coppermine commenting
« Reply #59 on: February 27, 2007, 03:19:10 am »

if you're using 1.4.10. do fcollingwood's solution. it works great!
thank you so much!  ;D
Logged
Pages: 1 2 [3] 4 5 6   Go Up
 

Page created in 0.053 seconds with 20 queries.