Advanced search  

News:

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

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

Author Topic: reCAPTCHA - Anti Spam - Comments, Registration, ecards, Report and Login  (Read 114333 times)

0 Members and 1 Guest are viewing this topic.

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page

@ brr, Sorry to say, I am fresh out of suggestions and/or answers.

The output of displayimage.php looks exactly to be what the plugin should find and replace. It's obvious that this is specific to that page since the reCAPTCHA works with ecard and also with the db_input part of the plugin.

So unless you have made any changes that I cannot see from here - recaptcha_config.php Groups - to something in themes.inc.php or somewhere else, these are the variables that you have that I can't replicate.
- The page wrapper/background  - the server - Brainfeeder plugin (I might try/test from here)

If I come up with an answer it will be posted!

brr

  • Tester
  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 26
    • BRR

Have you made any language file changes?

Checked. No changes done in the files in \plugins\recaptcha\lang\ - files or \lang\ catalogue. The main language for my gallery is Norwegian, but I have the same problems if I choose English. And as far as I have managed to understand the reCAPTCHA plugin will use English as language as it will not find any Norwegian language file(?).

And if you want to turn on Comments - at least for a while - I can also take a look at what your server sends for an output.

Comments activated, but reCAPTCHA is also activated. If you visit this album it should have been possible to post comments: http://web.brr.no/cpg-galleri/thumbnails.php?album=14
But the result you get is as mentioned: "Sorry, captcha error. Please try again Click Here to Go Back Or Use Your Back Button"

Tried to activate display_errors in php.ini (display_errors = On), but I did not get any errors at all.

access.log logs:

My IP - - [31/Aug/2009:21:44:54 +0200] "POST /cpg-galleri/db_input.php HTTP/1.1" 200 19840 "http://web.brr.no/cpg-galleri/displayimage.php?album=14&pos=1" "Mozilla/5.0 (Windows; U; Windows NT 6.0; nb-NO; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)"

[edit] To be always sure when testing, use Firefox, Chrome, or make sure you clear cookies/cache in IE [/edit]

Tested with Firefox, Internet Explorer 8 and Google Chrome.

Bjørn Roger Rasmussen
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page

I did try it and made my last reply after doing so. The things I mentioned in my last post still could be looked at. Maybe you could try uninstalling Brainfeeder for a test, I looked at it but won't be installing it only for testing just yet (Brainfeeder).

Like I said in my last post - the output from your server looks exactly right - leaving me with no answer (yet).

       =============
[Edit] Have now installed Brainfeeder plugin (wow) and see no ill effect on reCAPTCHA. This leaves you with variables - server type and/or setup - cpg installation - page wrapper - etc. that I cannot easily replicate [/edit]
« Last Edit: August 31, 2009, 11:01:00 pm by i-imagine »
Logged

brr

  • Tester
  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 26
    • BRR


[Edit] Have now installed Brainfeeder plugin (wow) and see no ill effect on reCAPTCHA. This leaves you with variables - server type and/or setup - cpg installation - page wrapper - etc. that I cannot easily replicate [/edit]

I agree! It must have something to do with server type, setup or something like that. A mysterious problem!

Today I tried a clean and totally new installation of cpg 1.4.25 at another Windows computer. Windows 7 computer with XAMPP 1.7.2 (Apache 2.2.12, MySQL 5.1.37 and PHP 5.3.0). Standard XAMPP configuration and no other plugins installed in Coppermine. The same result. No reCAPTCHA when I tried to make a guest comment, but I got reCAPTCHA to work with e-cards.

At the moment I must live with comments off in Coppermine. Maybe everything will be solved when Coppermine 1.5.1 is released....

Thanks i-magine for all the suggestions and test you have done!

Bjørn Roger Rasmussen
http://web.brr.no/cpg-galleri/
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page

Since you really seem to want to have comments and reCAPTCHA I will suggest something I would not normally advise. But the problem does seem to be an exception (I was actually expecting more issues even with just a few downloads so far).

So to give you "First Aid" for your specific problem see this post: reCAPTCHA Mod

There is a text file attached. Copy the contents into your theme.php with your Public key. You will now have the reCAPTCHA on your comments/displayimage page. It will not affect the other aspects of the plugin. It will prevent the plugin from working on it's own within the comments because the html expression will be different. This is not a permanent or viable fix for the plugin itself.

If you do indeed find an actual solution for this problem, please reply - thanks. I will do the same, but am still out of ideas.

brr

  • Tester
  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 26
    • BRR

So to give you "First Aid" for your specific problem see this post: reCAPTCHA Mod

Thanks! The "first aid" worked! Now I have comments activated in some albums with spam protection from the reCAPTCHA service!

Now I am a very satisfied "customer".

Bjørn Roger Rasmussen
http://foto.brr.no/
Logged

sharpo

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 170

I get "Sorry captcha error......" etc.

I've tried it on a test gallery which uses vertical film strip. As a last resort I set it to use the classic theme & it works, so the problem is within vertical film strip.

http://www.sharpos-world.co.uk/testing/cpg1424test/

Any ideas on what I need to modify to get it to work with vertical film strip please.
Logged
Sharpo (not an expert, just a Coppermine user)

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page

I have just tested and left a comment on a page with vertical filmstrip - it looks OK from here.

http://www.sharpos-world.co.uk/testing/cpg1424test/displayimage.php?pos=-1

If you are using Internet Explorer remember to clean your cache as you test.....

sharpo

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 170

I have just tested and left a comment on a page with vertical filmstrip - it looks OK from here.

http://www.sharpos-world.co.uk/testing/cpg1424test/displayimage.php?pos=-1

If you are using Internet Explorer remember to clean your cache as you test.....

Thanks, if all problems were solved that easily. I use Firefox and clearing the cache enabled me to add a comment.

Logged
Sharpo (not an expert, just a Coppermine user)

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page

Google has now acquired reCAPTCHA. It was announced yesterday.

Thread announcement is located here:Official Google Blog

begl

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
    • GZone

I believe I may have found the solution regarding some of the comments about the 'strange behaviour' of the plugin with some things like eCards working, while comment protection doesn't work. I think the problem is caused by the regex.

The current code (codebase.php in recaptcha_main - line 145) is:
Code: [Select]
...
if (!in_array(USER_GROUP, $valid_groups) OR $CAPTCHA_DISABLE['comment'] == '') {
                $exper = '(/>*
                                .*<input type="submit" class="comment_button" name="submit" value="' . $lang_display_comments['OK'] . '" />)';
                if (preg_match($exper, $html)) {
                    $newcpch = <<<EOT
/>
<tr> <table  align="center" colspan="3" valign= "top"><tr>
...

I am no PHP expert, so I don't know how PHP handles whitespace / newline characters in variable assignments or whether or not the "preg_match" function is capable of a regex over multiple lines. However, I do know these problems have plagued other code I have seen.  So, I figured I'd drop the first part of the expression and only look for the "input" part of the expression.  That has resolved my problems. I don't know what other impact this may have for other themes (I use Rainy Day), but the fix works for me, so I figured I'd share. YMMV.

My update to "codebase.php":
Code: [Select]
...
if (!in_array(USER_GROUP, $valid_groups) OR $CAPTCHA_DISABLE['comment'] == '') {
                $exper = '(<input type="submit" class="comment_button" name="submit" value="' . $lang_display_comments['OK'] . '" />)';
                if (preg_match($exper, $html)) {
                    $newcpch = <<<EOT
<tr> <table  align="center" colspan="3" valign= "top"><tr>
...

Note the change to "$exper" - I have removed the closing tag, newline and wildcards.  Also, the closing tag is removed from "$newcpch".

I haven't made any other changes as my only concern was comments.  I haven't looked at any other parts of the code.

Hope this helps some people.
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page

Can you post a link to your Coppermine? I am curious if your mod. works with multiple comments on the same page.....

The whitespace in that regular expression is intended.

As far as I know there has been only one other posting regarding real trouble with the reCAPTCHA (with more than 65 downloads) on the comments page. The user that posted with that issue also had trouble with captcha in cpg 1.5 and his troubles might have been caused by B.O.M. , lang. file and/or server issues.

It seems to work ok with an unmodified Rainy Day theme for me. It was tested with this version.
Code: [Select]
<!--
  SVN version info:
  Coppermine version: 1.4.25
  $Revision: 5997 $
  $LastChangedBy: gaugau $
  $Date: 2009-05-26 08:43:24 +0200 (Di, 26 Mai 2009) $
-->

Thanks in advance for your reply.

[edit]
try this - change
Code: [Select]
           if (!in_array(USER_GROUP, $valid_groups) OR $CAPTCHA_DISABLE['comment'] == '') {
                $exper = '(/>*
                                .*<input type="submit" class="comment_button" name="submit" value="' . $lang_display_comments['OK'] . '" />)';

to
Code: [Select]
            if (!in_array(USER_GROUP, $valid_groups) OR $CAPTCHA_DISABLE['comment'] == '') {
                $exper = '(/>.*
 .*<input type="submit" class="comment_button" name="submit" value="' . $lang_display_comments['OK'] . '" />)';

seems to work, perhaps to be in possible future release
[/edit]

« Last Edit: September 21, 2009, 03:45:05 am by i-imagine »
Logged

begl

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
    • GZone

My site is http://www.gzone.org/gallery/

My fix to codebase.php did not work well with multiple comments. I was able to post a new comment to an image with an existing comment and didn't test further. You will notice that I only have a single comment, so testing of multiple comments didn't cross my mind  ;).

I am not sure why the original codebase.php did not work as I am using the same (latest) version you used for test purposes.

I have now modified codebase.php with your suggested update and that works well for me.

BTW - Line 121 (recaptcha_header function) has a slight typo - an extra double quote.
Code: [Select]
$html = '<script type=""text/javascript"  ....
                       ^ Here

One other thought - would it make sense to move the 'common' text (like the various javascript functions) in to a single location which is then reference within your code - to make (future) updates to your plugin simpler?

Thanks for your assistance and thanks for putting the plugin together - I'm pleased not to be getting comment spam!
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page

@ begl,

Thanks for your reply.

The reason for reCAPTCHA not working with that regular expression and multiple comments is that there is a limit of one reCAPTCHA per page. When you have a comment that can be edited that regular expression is repeated. The resulting two attempts at creating the reCAPTCHA then fail. I am hoping that there is a change in the way this works from reCAPTCHA.

I too am not sure why v2.1 didn't work for you and the other user who reported trouble with the Comments reCAPTCHA. The only theory is that it might be server/setup related.

Since both you and I have had success with the small change it will be incorporated into the next release (soon).

I was aware of the double quote typo. (thanks anyway) and had planned on fixing it in the next release. I had been holding back to make that minor fix until more user and trouble reports have been submitted.

Thanks for the suggestions and the reply.

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page

Release of Version 2.2 

    Changes made in this version
    • Change expression to replace for Comments captcha (based on 2 user's issues out of 75 downloads)
    • Clean up un-needed html output - Comments
    • Remove extra quote mark in pageheader

    v2.2 now attached to first post in thread.


    (Note to Moderators,  Please, if you can, add this to the
Plugins page. - thanks in advance)

brr

  • Tester
  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 26
    • BRR
Re: reCAPTCHA - Anti Spam - Comments, Registration, ecards, Report and Login
« Reply #35 on: September 27, 2009, 10:05:31 am »

Hello!

Thanks for the new version! With this version I do not need anymore to "cheat" or use the "first aid" solution you helped me with for a while ago. The new version worked "out of the box" in my gallery.

I have not managed to get Norwegian translation to work. Tried with $recapt_lang = 'no'; and 'nb' in recaptcha_config.php and \lang\norwegian.php. In norwegian.php I translatet: $lang_plugin_captcha_submit_click =  'Klikk her, skriv de to ordene og klikk publiser kommentar'; // Comments and Registration  Did not work, got the English text. Maybe I have to read a litte bit more to understand how language files works.

Bjørn Roger Rasmussen
http://web.brr.no/cpg-galleri/



« Last Edit: September 27, 2009, 10:13:43 am by brr »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de

Thanks for the release.

Note to Moderators,  Please, if you can, add this to the Plugins page.
You don't have to explicitely ask for this - this is done anyway once in a while. Did so right now.

Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page
Re: reCAPTCHA - Anti Spam - Comments, Registration, ecards, Report and Login
« Reply #37 on: September 27, 2009, 02:49:00 pm »

@ Joachim Müller,

Thanks for your time and reply.

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page
Re: reCAPTCHA - Anti Spam - Comments, Registration, ecards, Report and Login
« Reply #38 on: September 27, 2009, 04:16:45 pm »

@ Brr,

Thanks for the information, it is good to hear the new revision works for you. Especially since I was not able to reproduce the same error.

For your language issues, there are two separate parts.

1) Variable $recapt_lang in recaptcha_config.php has only the limited set of 8 languages listed in the file. That language variable sets what the recaptcha will use - inside the recaptcha (Help, Get new, Audio). I hope that there will soon be more languages now that Google has acquired recaptcha.

2) The issue you are having with your custom language file is caused by a silly and stupid mistake by me. This will  of course need to be confirmed by further testing, but try this.

In codebase.php find:
Code: [Select]
include('plugins/recaptcha/recaptcha_config.php');
    global $lang_display_comments, $lang_register_php, $CAPTCHA_DISABLE, $key_public, $lang_ecard_php, $lang_report_php, $lang_login_php, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA;

Replace with:
Code: [Select]
   global $CONFIG, $lang_display_comments, $lang_register_php, $CAPTCHA_DISABLE, $key_public, $lang_ecard_php, $lang_report_php, $lang_login_php, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $lang_plugin_captcha;
    include('plugins/recaptcha/recaptcha_config.php');

 Apologies for this giving you so much trouble. (although I should ask you to test all of my work...)
« Last Edit: September 27, 2009, 04:22:27 pm by i-imagine »
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page
Re: reCAPTCHA - Anti Spam - Comments, Registration, ecards, Report and Login
« Reply #39 on: September 27, 2009, 06:34:48 pm »

Release of Version 2.3

    Changes made in this version
    • Fix error in selecting plugin language file

    v2.3 now attached to first post in thread.
    Pages: 1 [2] 3 4 5 6   Go Up
     

    Page created in 0.032 seconds with 21 queries.