We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18913
    • 654 Posts
    Mine is not sending an email when the input is incorrect. I get the "Incorrect. Try again" message within the recaptcha dialog... Dunno what to tell you - I did not use any of the code you provided - only the off-the-shelf recaptchalib (untouched) and the eform snippet (as I provided). The form template was plain-vanilla, with the exception of the [+captcha_html+] tag. No javascript.

    Not sure what else to tell you. If someone else could try this and chime in, I’d feel better about what I uploaded!
    Matt
      • 18913
      • 654 Posts
      I did a fresh MODx install to test out the recaptcha code. With one exception it still works. The exception is if there is no entry whatsoever in the recaptcha dialog box. If the entry is successful then an email gets sent. And if an entry is erroneous it does not. I’m guessing I have a relatively straightforward logic error, as the dialogue back and forth with the recaptcha library/site seems to be working.

      Wish I could help more...

      Matt
        • 38685
        • 59 Posts
        Mmmm... I have the site owner testing this for me too...

        and the debug output from my code is....

        Subject: Crimes Act Section 59 Law Change Recaptcha Private Key: --our private key ------ Response is really, really valid! GREAT! Response: manual_challenge 02goQbzgajPS7NKQJV8MNW8VKyFxLBHWwf78xC828ZLgvLJirrb1j9LSnhYlnzSYyw2feqWzCBdoPLBBKwsYzy6PSRV61QPAn5Oui7XE1-_CQMogL__vLu76FP3ZHmMZ5mLMDTVFU1MeMKUquA3dPFDh2vGkMatEtkM8M31FbV-gKgGvQQOmrxWe_VIshDUgj26Pj9Hq1ljEEFNO7iu79yLHHaMryrYspOsXoMJxvHul-AFj78hvEpxKsHN7vdmQFjFbDB1mXFPk4qCUMQc2bFDi6T8aAB

        Which is strange because when I do it... all I get is....
        Subject: Crimes Act Section 59 Law Change Recaptcha Private Key: --- our private key ----- Response is really, really valid! GREAT! asdf asfd asd manual_challenge

        the code that generates the debug...
        //build a list of values for debug and mail them ... added by paulhomebus   
        			$arr2 =  'Subject:      ' . $subject . '         Recaptcha Private Key:      ' . $privatekey  . '         Response:      ' . $_POST["recaptcha_response_field"];
        			$out10 = $arr2 . $arr1;
        			//$out9 = $out10; // var_export($out10,$out11);
        			mail('[email protected]','testing modx mailing form', $out10); //debug report
        
        					if(!$mail->send()) return 'Main mail: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;
        				}
        


        Which is generated here....
        if (!$resp->is_valid){
        					$arr1 = 'Response was not valid!' . '      ' . 'OH DEAR!' .  '      ' . $_POST['recaptcha_challenge_field'] . '      ' . $newremoteip;
        					# set the error code so that we can display it. You could also use
            					# die ("reCAPTCHA failed"), but using the error message is
            					# more user friendly
        				//	$vMsg[count($vMsg)]= "reCAPTCHA said: " . $resp->error .
        		        	  //             " -- Please re-select the recipients you wish to send to!";  // This died!
          			
        				    } 
        				// $resp = null;				 
        				$arr1 = 'Response is really, really valid!' . '      ' . 'GREAT!' . '      ' . $_POST['recaptcha_challenge_field'] . '      ' . $_POST["recaptcha_response_field"]; // $error = null; 
        			}
        


        P.S. I am thinking I ought to be testing under different conditions... so I will conduct some more tests under Win XP...

        Thanks mconsidine for all your help! I hope someone else can chime in... I am at dead-end!
          Paul AL Bakulich - Association for Computing Machinery Professional Member
          http://palbakulich.me/ | http://twitter.com/#!/palhmbs
          • 18913
          • 654 Posts
          Okay, now I think my code is working.
          This line
            if ($_POST["recaptcha_response_field"]) {

          along with it’s closing bracket should be commented out in the code I uploaded.

          I’ll post a line to a demo site in a bit...
          Matt
            • 18913
            • 654 Posts
            The demo of my version of the code is here
            http://www.considine.net/recaptcha/
            When the fields are finally correct, one is redirected to a "thank you" page.

            Hope this helps
            Matt
              • 38685
              • 59 Posts
              Matt ....

              This all leads me to think that I have an invalid PHP.ini option....

              Or something server-side that is causing this!

              Thanks
              Paul
                Paul AL Bakulich - Association for Computing Machinery Professional Member
                http://palbakulich.me/ | http://twitter.com/#!/palhmbs
                • 38685
                • 59 Posts
                Matt FIXED THIS!!! Wooo hooo! grin

                The problem was I was loading the <form> tag between the <table> tag
                which threw the Recaptcha validation....

                Thank you so much Matt for your solution.....
                Paul
                  Paul AL Bakulich - Association for Computing Machinery Professional Member
                  http://palbakulich.me/ | http://twitter.com/#!/palhmbs
                  • 18913
                  • 654 Posts
                  Glad to help! And glad that we seem to have recaptcha capability with eform.
                  Matt
                    • 13226
                    • 953 Posts
                    After reading this post is it viable to say that this now works fully - without any problems ??

                    Can this recaptcha eform snippet be called so that we have the choice between the standard captcha and googles recaptcha ??

                    Ive downloaded the txt file found at mconsidine post.

                    Whilst going through the txt/snippet I noticed that it is an older version of eForm.

                    Although eForm hasn’t been updated in the repository it has been modified - the modified version (can be found here) contains a new string "safestring" which helps against "XSS" attacks.

                    Cheers
                      • 18913
                      • 654 Posts
                      From my perspective, albeit with limited testing, I believe it works without problems. Still, I’d call it an "alpha release" until others validated it.

                      I think it’s clear I should take the snippet text I posted and replace it with specific instructions on where to make changes in the eForm snippet as well as the file it requires (eform.inc.php). FWIW, I think the only change to the eForm snippet was in the location of my edited version of eform.inc.php, as well as to the name of the function (i.e. I changed "eForm" to "recapeForm" so I didn’t trip myself up somewhere). In short, the real edits took place in eform.inc.php and it might be easier if I just posted a note on what I added and what I commented out (I didn’t actually delete anything ...)

                      I believe that with the addition of another parameter (such as "&recaptcha=`1`") that this could live alongside the existing Captcha code. I haven’t tried that integration yet, but I will.

                      The version of eForm that I edited was the one which came with my 1.0.2 install, I think. So if there’s a newer version, I was unaware of it. I’ll take a look at the link you provided.

                      Finally, you didn’t ask the question, but I’ve been wondering how easy it would be to take this approach and integrate it with SPForm. A brief glance through that code did not suggest to me an obvious route to take.

                      When I have some progress on the items above, I’ll post it.
                      Matt