Module Captcha - Creadunet 3
Since Creadunet 3.0.0 you can put the captcha you want.
The script comes with 2 captchas:
- captcha classic called captcha Creadunet
- captcha advertising (solvemedia)
If you want to add another one, it happens in:
/mods/captcha/captcha.php
The instructions are in the file.
Here, the code with Creadunet captcha
Solvemedia is desactivated by /* */
/* UTILISATION de la CAPTCHA CREADUNET */
if (isset($_POST['captcha']) && md5($_POST['captcha']) != $_SESSION['captcha']) {
$captchaReponse = _t("Code Anti-Robot invalide");
} else {
$captchaReponse = 'ok';
}
$txtCaptcha = '<img src="/mods/captcha/captchaCreadunet/captcha.php" alt="Captcha" id="captcha" />
<b>'._t("Code Anti-Robot :").'</b>
<input type="text" name="captcha" value="" />';
/* UTILISATION de la CAPTCHA SolveMedia
require_once('solvemedia/solvemedialib.php'); //include the Solve Media library
if (isset($_POST['adcopy_challenge'])) {
$privkey = 'private_key_to_put_here';
$hashkey = 'hash_key_solve_media';
$solvemedia_response = solvemedia_check_answer($privkey,
$_SERVER['REMOTE_ADDR'],
$_POST['adcopy_challenge'],
$_POST['adcopy_response'],
$hashkey);
if (!$solvemedia_response->is_valid) {
//handle incorrect answer
$captchaReponse = _t("Code Anti-Robot invalide").' : '.$solvemedia_response->error;
}
else {
$captchaReponse = 'ok';
}
}
$txtCaptcha = solvemedia_get_html('key_solvemedia', null, true); //true for https, false for http
//$txtCaptcha = solvemedia_get_html('key_solvemedia'); //si site pas https
*/
Same thing, with Creadunet captcha desactivated, and Solvemedia activated.
(be carefull with last line of solvemedia, with or without httpS - take the right line!!)
/* UTILISATION de la CAPTCHA CREADUNET
if (isset($_POST['captcha']) && md5($_POST['captcha']) != $_SESSION['captcha']) {
$captchaReponse = _t("Code Anti-Robot invalide");
} else {
$captchaReponse = 'ok';
}
$txtCaptcha = '<img src="/mods/captcha/captchaCreadunet/captcha.php" alt="Captcha" id="captcha" />
<b>'._t("Code Anti-Robot :").'</b>
<input type="text" name="captcha" value="" />';
*/
/* UTILISATION de la CAPTCHA SolveMedia */
require_once('solvemedia/solvemedialib.php'); //include the Solve Media library
if (isset($_POST['adcopy_challenge'])) {
$privkey = 'private_key_to_put_here';
$hashkey = 'hash_key_solve_media';
$solvemedia_response = solvemedia_check_answer($privkey,
$_SERVER['REMOTE_ADDR'],
$_POST['adcopy_challenge'],
$_POST['adcopy_response'],
$hashkey);
if (!$solvemedia_response->is_valid) {
//handle incorrect answer
$captchaReponse = _t("Code Anti-Robot invalide").' : '.$solvemedia_response->error;
}
else {
$captchaReponse = 'ok';
}
}
$txtCaptcha = solvemedia_get_html('key_solvemedia', null, true); //true for https, false for http
//$txtCaptcha = solvemedia_get_html('key_solvemedia'); //si site pas https
Broadly speaking,
1- a code to display the captcha
2- a code to check the captcha, which returns OK if it's good.