Script Creadunet Version 3

ID #1039

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.

Catégories de cet article

Nuage de tags: -

Questions - Réponses en relation :

Dernière mise à jour : 2017-09-16 14:42
Auteur : creadunet
Révision: 1.1

modifier langue
 

Digg it! Share on Facebook Imprimer cet article Envoyer à un ami version PDF
Proposer une traduction pour Proposer une traduction pour
Merci de noter cette entrée :

Moyenne des notes : 0 (0 Vote)

complètement inutile 1 2 3 4 5 indispensable

Vous pouvez commenter cet article