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.phpNEW 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.phpFIND
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" /> <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.phpFIND
);
$lang_register_confirm_email = <<<EOT
BEFORE, ADD
'confirm' => 'Enter confirmation code',
'captcha_error' => 'Confirmation code not matching',
SAVE AND CLOSE ALL FILES