Form Help

TOPIC:

Re: Recaptcha in Classic Form? 9 years 2 months ago #66756

  • Topic Author
  • Ingrid
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 30
  • Thanks: 0

does it work now? If yes, I would propose if you could export the form and donate it to the users in the form apps section? Thanks!


Was this question to me or jpresult?

The problem I have is:

The captcha back to recipient works correct. If the field for the code is empty or wrong, is forwarded to the error page. And then in error page there is a Link to go back to form. By sending email with the right code the thank you page appears. And the email comes only once at the specified address. All is fine.

But the mail back to specified address from sender is not verifying. The mail is sent without verifying and the second time after verifying. Also, the email is twice in backend under manage entries.

Do you have any idea how I can solve this?

best regards

Ingrid

Please Log in or Create an account to join the conversation.

Re: Recaptcha in Classic Form? 9 years 2 months ago #66797

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
Did you put the code into an end submit piece? If yes, then put the recpatcha check into the begin submit. that would explain that behavior.

Please Log in or Create an account to join the conversation.

Re: Recaptcha in Classic Form? 9 years 2 months ago #66801

  • Topic Author
  • Ingrid
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 30
  • Thanks: 0
Yes, I did.

If I put the code into the begin submit, I get no emails.

The full code in end submit is:
$this->execPieceByName('ff_InitLib');
$from = ff_getSubmit('email'); // change to name of email field
$fromname = ff_getSubmit('name'); // change to name of user field
$attachment = ff_getSubmit('upload'); // change to name of upload field
$subject = 'Bewerbung'; // Change to your preferred Email subject
$recipient = 'foo@web.de'; // Change to your admin Email address


$body = '';

foreach ($this->maildata as $data) {

  if( $data[_FF_DATA_NAME] == 'upload' )
{
   $body .= $data[_FF_DATA_TITLE].': http://my-domain.de/components/com_breezingforms/uploads/' . basename($data[_FF_DATA_VALUE]);
} else {
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";

  }
}

  require_once('administrator/components/com_breezingforms/libraries/recaptcha/recaptchalib.php');
  $privatekey = "xxxxxxxxxxxxxxxxxxxxx";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
           header('location: /error-captcha');
           die ();

  } else {

$this->sendMail($from, $fromname, $recipient, $subject, $body, array($attachment));  // This line actually emails the form

header('location: /danke');
exit;
              
}

Please Log in or Create an account to join the conversation.

Re: Recaptcha in Classic Form? 9 years 2 months ago #66805

  • Topic Author
  • Ingrid
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 30
  • Thanks: 0
Hello Markus,

I put all the code (like above) in begin submit. An email ist sent to recipient, but not to the adress given by sender.

It is frustrading...

regards

Ingrid

Please Log in or Create an account to join the conversation.

Re: Recaptcha in Classic Form? 9 years 2 months ago #66812

  • Topic Author
  • Ingrid
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 30
  • Thanks: 0
Hello Markus.

I got it! :-)

It's the whole code.. for attachment and captcha and copy to sender.

Begin submit :
$this->execPieceByName('ff_InitLib');
$from = ff_getSubmit('email'); // change to name of email field
$fromname = ff_getSubmit('name'); // change to name of user field
$attachment = ff_getSubmit('upload'); // change to name of upload field
$subject = 'Bewerbung'; // Change to your preferred Email subject
$recipient = 'foo@web.de'; // Change to your admin Email address

$body = '';

foreach ($this->maildata as $data) {

  if( $data[_FF_DATA_NAME] == 'upload' )
{
   $body .= $data[_FF_DATA_TITLE].': http://my-domain.de/components/com_breezingforms/uploads/' . basename($data[_FF_DATA_VALUE]);
} else {
   $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";

  }
}

  require_once('administrator/components/com_breezingforms/libraries/recaptcha/recaptchalib.php');
  $privatekey = "xxxxxxxxxxxxxXXXXXXxxxxx";
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
           header('location: /error-captcha');
           die ();

  } else {

$this->sendMail($from, $fromname, $recipient, $subject, $body, array($attachment));  // This line actually emails the form

}

End submit:
$this->execPieceByName('ff_InitLib');
header('location: /danke');
exit;

And for mailback this:

crosstec.org/support/index.php?pid=knowl...viewentclient&id=154

Hope this helps

Please Log in or Create an account to join the conversation.

Last edit: Post by Ingrid.

Re: Recaptcha in Classic Form? 9 years 2 months ago #67468

  • jpresult
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 49
  • Thanks: 0
Been a bit busy so I didn't get a chance to work on this.
I finally got it working. The only thing I'm missing is someway to output an error.
The problem was that I was using location.go(-1) and it should have been history.go(-1). So now the email is not beign sent if captcha fails.
But how would I pass an error message to the user?
require_once('administrator/components/com_breezingforms/libraries/recaptcha/recaptchalib.php');
$privatekey = "XXxxxxxxXxXXX";

if ($_POST["recaptcha_response_field"]) {
    $resp = recaptcha_check_answer(
                $privatekey,
                $_SERVER["REMOTE_ADDR"],
                $_POST["recaptcha_challenge_field"],
                $_POST["recaptcha_response_field"]
            );
    if ($resp->is_valid) {
        $this->sendMail($from, $fromname, $recipient, $subject, $body);
    }
    else {
        echo    '<script type="text/javascript">
                    history.go(-1);
                </script>';
        exit;
    }
}

Please Log in or Create an account to join the conversation.

Last edit: Post by jpresult.
Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!