I look forward to hearing your ideas!
Thanks in advance.
Hawk wrote:Not sure about the captcha, but I'm quite sure it could be done with reCaptcha, implementation of it is simple, and it provides the protection of the captcha
http://recaptcha.net/
<?php
require_once('recaptchalib.php');
// Get a key from http://recaptcha.net/api/getkey
$publickey = "1234567898";
$privatekey = "1123445566";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp -> is_valid) {
echo "You got it!";
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
?> is_valid) {
echo "You got it!";
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
?>require_once('path-to-recaptcha-lib/recaptchalib.php');
$privatekey = "your-private-key";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn??™t entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}<div align="center">
<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=6Ld3gQUAAAAAADeIGizPe5hJgIzpWvGKNIyFRm1a"></script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k=6Ld3gQUAAAAAADeIGizPe5hJgIzpWvGKNIyFRm1a" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
</div>Hawk wrote:Hm, could you tell me in which file you are trying to implement the code?
I personally didn't try to include recaptcha in cnr, but based on how I included recaptcha on other scripts, I think it would work like this:
1. Upload the recaptchalib.php on your website.
2. Add following code into the cnr/inc/mod/editusers.mdu right after <?php
- Code: Select all
require_once('path-to-recaptcha-lib/recaptchalib.php');
$privatekey = "your-private-key";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn??™t entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
3. Include this code into the registration form:
- Code: Select all
<div align="center">
<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=6Ld3gQUAAAAAADeIGizPe5hJgIzpWvGKNIyFRm1a"></script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k=6Ld3gQUAAAAAADeIGizPe5hJgIzpWvGKNIyFRm1a" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
</div>
<div align="center">
<script type="text/javascript" src="http://api.recaptcha.net/challenge?k={here-comes-public-key}"></script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k={here-comes-public-key}" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
</div>Hawk wrote:I forgot to wrote that in the 2nd piece of code you need to enter your public key which you got from recaptcha (you can check it on their website too after you login).
- Code: Select all
<div align="center">
<script type="text/javascript" src="http://api.recaptcha.net/challenge?k={here-comes-public-key}"></script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k={here-comes-public-key}" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
</div>
If the recaptcha gets skipped, it means that the code isn't implemented correctly. You could try to put recaptchalib.php into the same directory as eduitusers.mdu and see if that will make any effect.
The reCAPTCHA was not entered correctly. Go back and try it again.(reCAPTCHA said: incorrect-captcha-sol)
Users browsing this forum: No registered users and 1 guest