Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Carlos E. G. Barbosa

    (@sanskritforum)

    To see the reCAPTCHA form you may call
    nurc_recaptcha_challenge();

    But you must assure to check the validity of the answer to that challenge, by placing some code on the landing page to where the form data is sent after being posted. That code may be something like this:

    $result = new ReCaptchaResponse(); // sets $result as a class variable
    $result = recaptcha_check_answer(get_option('sktnurc_privtkey'), $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
    if ($result->is_valid) { // captcha passed, so let's run anything else...
    	} else { // captcha is not valid, so display some warning and block access...
    	}

    These lines get an object ‘ReCaptchaResponse’ at Google server, from the answer writen on the captcha form. If the ‘is_valid’ property of that object is set to true, you may keep on the normal processing track of your custom registration form. If it is false, you must force your custom form to return to the initial state, with some warning on the captcha failure.

    Let me know if you need some more information.

    Thread Starter newterminator3

    (@newterminator3)

    Hey Carlos

    I got the form showing up … i m going to check now if it validates too…

    Thanks

    Thread Starter newterminator3

    (@newterminator3)

    Hey Carlos
    Just to let follow up … yes the code does show on the custom page and gets validated too.
    Thank you for your time and help.

    Plugin Author Carlos E. G. Barbosa

    (@sanskritforum)

    You’re welcome.
    ??

    Plugin Author Carlos E. G. Barbosa

    (@sanskritforum)

    Dear newterminator3,

    A few reCAPTCHA functions are changing names in the next release of the plugin. This is to avoid a fatal error on the server (“cannot redeclare [name-of-the-function]() previously declared in…”) in the case where another plugin uses the same Google’s functions library to produce the reCAPTCHA challenge (or to verify the response).

    The change is just the addition of a “nurc_” prefix to the existing function name as to make it unique.

    So if you are still using the references given two months ago, I suggest you change them to the conditional format below for awhile. This format will give your site the ability to automatically change to the new name as soon as the new version of the plugin is released.

    To display the captcha: no changes.

    nurc_recaptcha_challenge();

    To verify the response:

    if(class_exists('nurc_ReCaptchaResponse')){
        $result = new nurc_ReCaptchaResponse(); // sets $result as a class variable
    }else{
        $result = new ReCaptchaResponse();
    }
    if(function_exists('nurc_recaptcha_check_answer')){
        $result = nurc_recaptcha_check_answer(get_option('sktnurc_privtkey'), $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
    }else{
        $result = recaptcha_check_answer(get_option('sktnurc_privtkey'), $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
    }
    if ($result->is_valid) { // captcha passed, so let's run anything else...
    	} else { // captcha is not valid, so display some warning and block access...
    	}

    I am sorry for the trouble.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Skt NURCaptcha] Custom Registration Form’ is closed to new replies.