[Mod] Captcha (Visual Confirmation) for new users registration [Mod] Captcha (Visual Confirmation) for new users registration
 

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] Captcha (Visual Confirmation) for new users registration

Started by Ludo, July 14, 2008, 07:17:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ludo

For those, like me, who can't get Captcha Plugin working, I've "extended" Abbas Ali Captcha Mod for comments to registration page, in order to prevent automatic registrations by spambots and alike.
This mod will present new users trying to register an additional required field to enter the confirmation code shown aside in the captcha image: no matching confirmation code = registration not allowed, quite simple :-)

DEMO: http://vanrokken.altervista.org/register.php

NEW FILES: 4 (only if Captcha Mod for comments is not installed)

  • captcha.php
  • include/captcha.class.php
  • fonts/acidic.ttf
  • fonts/hurryup.ttf

FILES TO EDIT: 2

  • register.php
  • lang/english.php

EXTRACT (only if Captcha Mod for comments is not installed)
attached zip file to your gallery root directory, as follows:

  • captcha.php => / (root directory)
  • captcha.class.php => /include
  • acidic.ttf => /fonts
  • hurryup.ttf => /fonts

OPEN
register.php

FIND
require('include/init.inc.php');

AFTER, ADD
require('include/captcha.class.php');

FIND
        array('input', 'email', $lang_register_php['email'], 255),

AFTER, ADD
        array('input', 'confirm', $lang_register_php['confirm'], 5),

FIND
            if ($element[2]) echo <<<EOT
        <tr>
            <td width="40%" class="tableb"  height="25">
                        {$element[2]}
        </td>
        <td width="60%" class="tableb" valign="top">
                <input type="text" style="width: 100%" name="{$element[1]}" maxlength="{$element[3]}" value="$value" class="textinput" />
                </td>
        </tr>

EOT;


REPLACE WITH
            if ($element[2]) {
               echo <<<EOT
        <tr>
            <td width="40%" class="tableb"  height="25">
                        {$element[2]}
        </td>
        <td width="60%" class="tableb" valign="top">
EOT;
               if ($element[1] == "confirm") {
                   echo '<input type="text" style="width: 40%" name="'.$element[1].'" maxlength="'.$element[3].'" value="'.$value.'" class="textinput" />&nbsp;<img src="captcha.php" align="middle">';
               } else {       
                   echo '<input type="text" style="width: 100%" name="'.$element[1].'" maxlength="'.$element[3].'" value="'.$value.'" class="textinput" />';
               }
               echo <<<EOT
        </td>
        </tr>
EOT;
            }


FIND
    $email = trim(get_post_var('email'));

AFTER, ADD
    $confirm = trim(get_post_var('confirm'));

FIND
    if ($error != '') return false;

BEFORE, ADD
    if (!PhpCaptcha::Validate($confirm)) $error .= '<li>' . $lang_register_php['captcha_error'];


OPEN
lang/english.php

FIND
);

$lang_register_confirm_email = <<<EOT


BEFORE, ADD
  'confirm' => 'Enter confirmation code', 
  'captcha_error' => 'Confirmation code not matching',



SAVE AND CLOSE ALL FILES

goku

hey im sorry but i didnt find  any fonts folder in my cpg folder
what shud i do

Ludo

It should be created extracting the attached zip file, if not create it manually...

goku

hey z i have installed the mod like u said but my captcha image dont show up and im really depressed man i can't get ppl to join my gallery :( please help.

Ludo


VaporDesigns


Heroe

i having problems with this mod
captcha don't appear ???
i double check the files and the edits all is fine

my gallery link

http://abroadbg.com


Nibbler

Works fine in other languages. Looks like you broke your Bulgarian language file by editing it. Restore a clean copy.