This mod. version uses AJAX to load a third party visual (reCAPTCHA) challenge to the registration form. It uses the error handling already built into register.php The captcha is hidden from the user until it is called. Like the above method it uses a public and private key set.
This method seems to solve two issues found when the above methods were used:1) Conflict with other mods'/plugins' javascript would cause IE to get "lost" and out of the gallery. 2) External page error handling did not cooperate well with other plugins/mods that rewrite the page header (best guess).
Bots should not be able to get past the protections in this mod. so far it has worked for me.
The files register.php and template.htm are modifed and one file is added to your gallery root directory. To uninstall this mod. replace register.php with a clean copy.
1) Get the keys and register your domains at
recaptcha.net - they are free
2) Get file recaptchalib.php from recaptcha.net. Upload it to your gallery root directory.
a) you can also get a set of testing files for validation testing and practice
3) Modify files register.php and template.htm (for every template that you use)
a) Insert your PUBLIC and PRIVATE keys where shown below
4) After backup, upload mod. files to their directories - you are done
Insert into the <HEAD> of your template.htm<script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script>
in your register.php file find
<td colspan="2" align="center" class="tablef">
<input type="submit" name="submit" value="{$lang_register_php['submit']}"
class="button" />
replace it with this - insert your key where shown
<td class="tableb_compact" align ="center" colspan="3">
<div><br></div>
<script>
function showRecaptcha(element, submitButton, themeName) {
Recaptcha.create("YOUR PUBLIC RECAPTCHA KEY GOES IN HERE", element, {
theme: 'white',
tabindex: 0,
callback: Recaptcha.focus_response_field
});
hideSubmitButtons();
document.getElementById(submitButton).style.visibility = "visible";
}
function hideSubmitButtons() {
document.getElementById('submit_button_1').style.visibility = "hidden";
}
function destroyRecaptchaWidget() {
hideSubmitButtons();
Recaptcha.destroy();
}
</script>
<form method="post" action="">
<p>
<input type="button" class="button" value="Click here - type the words - click submit"
onclick="showRecaptcha('dynamic_recaptcha_1', 'submit_button_1', 'red');"></input>
<div id="dynamic_recaptcha_1"></div>
<input type="submit" style="visibility: hidden" id="submit_button_1" class="button" name="submit"
value="{$lang_register_php['submit']}" /></input>
<div><br></div>
<input type="button" class="comment_button" value="Hide the reCAPTCHA widget"
onclick="destroyRecaptchaWidget();"></input>
<br><br>
in your file register.php find $error = '<li>' . $lang_register_php['err_duplicate_email'];
return false;
}
mysql_free_result($result);
}
insert below it this code with your key where shown
require_once('recaptchalib.php');
$privatekey = "YOUR PRIVATE RECAPTCHA KEY GOES IN HERE";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$error .= '<li>' . 'Captcha Error - Please Try Again - You Will Need to
Re-enter your Password First';
if ($error != '') return false;
}
It is now installed here
i-imagine.net and
gallery.josephcarver.com/natural/ - try it, any feedback is welcome.
Other styles than this hidden one can be applied. It seems to be keeping the usual offenders away, even though their ip addresses keep showing in the logs.
i-imagine