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]   Go Down

Author Topic: Captcha 3.0 Help!  (Read 9283 times)

0 Members and 1 Guest are viewing this topic.

storebatfar

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Captcha 3.0 Help!
« on: October 09, 2008, 11:38:17 am »

Hi...

I'm using Coppermine 1.4.19 (set to Danish language), and everything has been working fine, but the last couple of days i have been bugged with over 200 spam registrations.
I then downloaded Captcha v. 3.0 and installed it in my Coppermine system. I've activated the plug-in, however i still have some problems.

I want Captcha to display when a new user wants to register. I've looked through the codebase.php file, but i cant seem to figure it out.
When i try to register no Captcha ecurity displays. However when i login in the Captcha displays.

Here is some code from my codebase.php file :


Code: [Select]
* captcha_page_start()
 * check/validate captcha confirmation code [user input] for each page
 *
 * @return
 */
function captcha_page_start()
{
    global $lang_continue, $lang_error, $lang_plugin_captcha_conf, $CONFIG, $CAPTCHA_DISABLE, $CAPTCHA_TIMEOUT;
    /*                              Setting Options                                        */
    /**
     * Enable/Disable array
     *
     * Set which group should NOT see Captcha on each page
     * ''=> Captcha Enable for all users
     * COppermine Standard Group Name:
     * Administrators,Registered,Guests,Banned
     * You can add your custome group name too
     * Seprated by ','
     */

    $CAPTCHA_DISABLE = array('login' => 'Administrators,Registered',
        'register' => 'Administrators,Registered',
        'comment' => 'Administrators,Registered',
        'report' => 'Administrators',
        'ecard' => 'Administrators',
        );
    $CAPTCHA_TIMEOUT = 300; // How many sec should passed before we remove the code from database
    require ('plugins/captcha/include/init.inc.php');
    require('plugins/captcha/include/captcha.class.php');

    switch ($_SERVER['PHP_SELF']) {
        case 'login.php':
            $valid_groups = explode(',', $CAPTCHA_DISABLE['login']);
            if (!in_array(USER_GROUP, $valid_groups) OR $CAPTCHA_DISABLE['login'] == '') {
                if (isset($_POST['submitted']) AND !Validate($_POST['confirmCode'])) {
                    load_template();
                    pageheader($lang_error, "<META http-equiv=\"refresh\" content=\"3;url=login.php\">");
                    msg_box($lang_error, "$lang_plugin_captcha_error", $lang_continue, 'login.php');
                    pagefooter();
                    exit;
                }
            }
            break;
        case 'register.php':
            $valid_groups = explode(',', $CAPTCHA_DISABLE['register']);
            if (!in_array(USER_GROUP, $valid_groups) OR $CAPTCHA_DISABLE['register'] == '') {
                if (isset($_POST['submit']) AND !Validate($_POST['confirmCode'])) {
                    load_template();
                    pageheader($lang_error, "<META http-equiv=\"refresh\" content=\"3;url=register.php\">");
                    msg_box($lang_error, "$lang_plugin_captcha_error", $lang_continue, 'register.php');
                    pagefooter();
                    exit;
                }
            }
            break;
        case 'db_input.php':
            $valid_groups = explode(',', $CAPTCHA_DISABLE['comment']);
            if (!in_array(USER_GROUP, $valid_groups) OR $CAPTCHA_DISABLE['comment'] == '') {
                if (isset($_POST['msg_body']) AND !Validate($_POST['confirmCode'])) {
                    load_template();
                    pageheader($lang_error, "<META http-equiv=\"refresh\" content=\"3;url=displayimage.php?pos=" . (- $_POST['pid']) . "\">");
                    msg_box($lang_error, "$lang_plugin_captcha_error", $lang_continue, "displayimage.php?pos=" . (- $_POST['pid']));
                    pagefooter();
                    exit;
                }
            }
            break;
        case 'report_file.php':
            $valid_groups = explode(',', $CAPTCHA_DISABLE['report']);
            if (!in_array(USER_GROUP, $valid_groups) OR $CAPTCHA_DISABLE['report'] == '') {
                if (count($_POST) > 0 AND !Validate($_POST['confirmCode'])) {
                    load_template();
                    pageheader($lang_error, "<META http-equiv=\"refresh\" content=\"3;url=report_file.php?album={$_GET['album']}&pid={$_GET['pid']}&pos={$_GET['pos']}\">");
                    msg_box($lang_error, "$lang_plugin_captcha_error", $lang_continue, "report_file.php?album={$_GET['album']}&pid={$_GET['pid']}&pos={$_GET['pos']}");
                    pagefooter();
                    exit;
                }
            }
            break;
        case 'ecard.php':
            $valid_groups = explode(',', $CAPTCHA_DISABLE['ecard']);
            if (!in_array(USER_GROUP, $valid_groups) OR $CAPTCHA_DISABLE['ecard'] == '') {
                if (count($_POST) > 0 AND !Validate($_POST['confirmCode'])) {
                    load_template();
                    pageheader($lang_error, "<META http-equiv=\"refresh\" content=\"3;url=ecard.php?album={$_GET['album']}&pid={$_GET['pid']}&pos={$_GET['pos']}\">");
                    msg_box($lang_error, "$lang_plugin_captcha_error", $lang_continue, "ecard.php?album={$_GET['album']}&pid={$_GET['pid']}&pos={$_GET['pos']}");
                    pagefooter();
                    exit;
                }
            }
            break;
        default: ;
    } // switch
}

/**




This is what i want:  Captcha must show security display when a new user wants to register.
« Last Edit: October 10, 2008, 07:27:48 am by Joachim Müller »
Logged

storebatfar

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Captcha 3.0 Help!
« Reply #1 on: October 09, 2008, 12:02:42 pm »

When i try to register i get the folowing error...

Confirmation code didn't match

However no confirmation image was shown.
Logged

storebatfar

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Captcha 3.0 Help!
« Reply #2 on: October 09, 2008, 12:16:04 pm »

I got it to work, but there is still an issue.

The Captcha security code still shows at the login screen.

Help!!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Captcha 3.0 Help!
« Reply #3 on: October 10, 2008, 07:34:32 am »

I got it to work, but there is still an issue.
Then post what you did for the benefit of others with similar issues.

Original captcha thread is Captcha (Visual Confirmation) for comments/registration/reporting/login/ecard
Logged

storebatfar

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Captcha 3.0 Help!
« Reply #4 on: October 12, 2008, 09:40:50 pm »

I haven't had any help in how to remove captcha security at logon, so I can't quite post what i've done yet...

Still need help...
Logged

Nibbler

  • Guest
Re: Captcha 3.0 Help!
« Reply #5 on: October 12, 2008, 09:55:33 pm »

Read the readme file that comes with the plugin.
Logged

storebatfar

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Captcha 3.0 Help!
« Reply #6 on: October 12, 2008, 10:41:30 pm »

Listen, do you think I haven't done that already?

Even if I change the value in the codebase.php file, the security captcha still comes at login screen.

Someone have anything useful???
Logged

Nibbler

  • Guest
Re: Captcha 3.0 Help!
« Reply #7 on: October 12, 2008, 10:57:27 pm »

So what did you set 'login' to? Should be something like this:

Code: [Select]
'login' => 'Guests',
Logged

239online

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Captcha 3.0 Help!
« Reply #8 on: October 27, 2008, 12:51:13 pm »

So what did you set 'login' to? Should be something like this:

Code: [Select]
'login' => 'Guests',

I did that and the captcha is still showing up on the login screen.
Logged

PictureTaker

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Captcha 3.0 Help! - my solution
« Reply #9 on: November 14, 2008, 06:42:33 am »

I had the exact same problem... could not get login to NOT use captcha.  I tried everything suggested to no avail. Originaly using 1.4.18 , updated to .19, same  trouble. Here's what I did for a solution. I commented out the login.php case and, probably needlessly removed the disable entry... brutal, but effective.

Code: [Select]
/**
 * captcha_main()
 * Filter HTML and ADD Capthca image & confirmation
 *
 * @return HTML
 */
function captcha_main($html)
{
    global $lang_display_comments, $lang_register_php,

$lang_plugin_captcha_conf , $CAPTCHA_DISABLE;

    switch ($_SERVER['PHP_SELF']) {
/* ***********************Commented out**************************
         case 'login.php':
            $valid_groups = explode(',', $CAPTCHA_DISABLE['login']);
            if (!in_array(USER_GROUP, $valid_groups) OR

$CAPTCHA_DISABLE['login'] == '') {
                $exper = '(<input type="password".*</td>)';
                if (preg_match($exper, $html)) {
                    $newcpch = '<!-- CAPTCH PLUGIN 3 --><input

type="password" class="textinput" name="password" style="width: 100%"

tabindex="2" /></td></tr><tr><td class="tableb">' .

$lang_plugin_captcha_conf . '</td><td class="tableb" colspan="2"><input

type="text" name="confirmCode" id="confirmCode" size="20"

class="textinput" style="width=50%" tabindex="3"><img src="captcha.php"

align="middle"></td>';
                    $html = preg_replace($exper, $newcpch, $html);
                }
            }
            break; 
**********************************************
*/
        case 'register.php':
            $valid_groups = explode(',', $CAPTCHA_DISABLE['register']);
            if (!in_array(USER_GROUP, $valid_groups) OR

and...

Code: [Select]
/**
     * Enable/Disable array
     *
     * Set which group should NOT see Captcha on each page
     * ''=> Captcha Enable for all users
     * COppermine Standard Group Name:
     * Administrators,Registered,Guests,Banned
     * You can add your custome group name too
     * Seprated by ','
     */
    /* ****************************************************************
   Removed--- 'login' => 'Administrators,Registered,Guests,Banned',  from

$CAPTCHA_DISABLE below (adding banned did not help either)                 

                     */

    $CAPTCHA_DISABLE = array('register' => 'Administrators,Registered',
        'comment' => 'Administrators,Registered',
        'report' => 'Administrators',
        'ecard' => 'Administrators',
        );
    $CAPTCHA_TIMEOUT = 300; // How many sec should passed before we remove

the code from database
    require ('plugins/captcha/include/init.inc.php');
    require('plugins/captcha/include/captcha.class.php');

    switch ($_SERVER['PHP_SELF']) {
/*  *************************Commented out****************
          case 'login.php':
            $valid_groups = explode(',', $CAPTCHA_DISABLE['login']);
            if (!in_array(USER_GROUP, $valid_groups) OR

$CAPTCHA_DISABLE['login'] == '') {
                if (isset($_POST['submitted']) AND

!Validate($_POST['confirmCode'])) {
                    load_template();
                    pageheader($lang_error, "<META http-equiv=\"refresh\"

content=\"3;url=login.php\">");
                    msg_box($lang_error, "$lang_plugin_captcha_error",

$lang_continue, 'login.php');
                    pagefooter();
                    exit;
                }
            }
            break; 
*****************************************************************
*/
        case 'register.php':

... hope this helps you.

http://www.mikesmiley.org
PictureTaker ***a/t*** OTRinthe dot US


           _______    ______________________________________
     |__/      |   |   [                                                           ]
  __,/"__|2648  |   [    http://www.otrinthe.us                        ]
 /    ___| _____|   [                                                           ]
[___|====|=====| [____________________________________]
(@)***************(@)(@)***                *(@)(@)* 

 

 
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.