Captcha 3.0 Help! Captcha 3.0 Help!
 

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

Captcha 3.0 Help!

Started by storebatfar, October 09, 2008, 11:38:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

storebatfar

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 :


* 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.

storebatfar

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

Confirmation code didn't match

However no confirmation image was shown.

storebatfar

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

The Captcha security code still shows at the login screen.

Help!!

Joachim Müller

Quote from: storebatfar on October 09, 2008, 12:16:04 PM
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

storebatfar

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...

Nibbler

Read the readme file that comes with the plugin.

storebatfar

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???

Nibbler

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

'login' => 'Guests',

239online

Quote from: Nibbler on October 12, 2008, 10:57:27 PM
So what did you set 'login' to? Should be something like this:

'login' => 'Guests',

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

PictureTaker

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.


/**
* 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...


/**
     * 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                        ]
/    ___| _____|   [                                                           ]
[___|====|=====| [____________________________________]
(@)***************(@)(@)***                *(@)(@)*