This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

reCAPTCHA ssl?


  1. imranmohammed
    Member

    Hi

    I have the form working with CAPTCHA http://www.domain.co.uk/webapps/view.php?id=1 HOWEVER https://www.domain.co.uk/webapps/view.php?id=1 causes a security popup box in IE, and Firefox shows a broken SSL icon, so there's secure and insecure content on the page and the culprit is reCAPTCHA.

    According to http://recaptcha.net/apidocs/captcha/ - it says to use https://api-secure.recaptcha.net

    Please help, we're stuck as we can't process data

    Posted 16 years ago #
  2. yuniar

    Hi Imran,

    Thanks for letting us know about this. Current captcha code is indeed permanently set to use the standard http connection.

    To fix it, it's pretty easy.
    Edit your includes/view-functions.php file, search around line 1347, you will find this code:

    $recaptcha_html = recaptcha_get_html(RECAPTCHA_PUBLIC_KEY, $error_code);

    Now, replace that code with the following:

    if(!empty($_SERVER['HTTPS']) || ($_SERVER['HTTPS'] == 'on')){
    	$use_ssl = true;
    }else{
    	$use_ssl = false;
    }
    
    $recaptcha_html = recaptcha_get_html(RECAPTCHA_PUBLIC_KEY, $error_code,$use_ssl);


    This should fix the problem. The captcha will use https connection for secure forms and normal http connection for standard forms.

    Let me know if this doesn't work for you.


    MachForm Founder

    Posted 16 years ago #
  3. tabonec
    Member

    yunair,
    This works great for me after modifying the file. Do you think you could include it in the SSL patch zip file for future releases?

    Posted 16 years ago #
  4. yuniar

    Yes, this is definitely will be included.


    MachForm Founder

    Posted 16 years ago #

RSS feed for this topic

Reply