- Posts: 48
- Thank you received: 0
Questions about Payment Form extension
Captcha (or ReCaptcha) for Payment Form too
- azurelink
- Topic Author
- Offline
- Senior Member
Less
More
13 years 4 months ago #10527
by azurelink
Captcha (or ReCaptcha) for Payment Form too was created by azurelink
Hello Tuan,
Is it possible to add a captcha feature to the Payment Form? I know you added it to Joom Donation.
Thanks,
azurelink
Is it possible to add a captcha feature to the Payment Form? I know you added it to Joom Donation.
Thanks,
azurelink
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
13 years 4 months ago #10536
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Captcha (or ReCaptcha) for Payment Form too
This is a planned feature and I will add it to next release of the extension (in one or two weeks) .
Regards,
Tuan
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- azurelink
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 48
- Thank you received: 0
13 years 4 months ago - 13 years 4 months ago #10546
by azurelink
Replied by azurelink on topic Re: Captcha (or ReCaptcha) for Payment Form too
Thanks for your reply Tuan,
I'm actually in need of a solution for the time being. And I'm more interested in using reCAPTCHA — you didn't specify what your plans involved. So if you could please help me with some direction I would appreciate it.
I've figured out that I can display the ReCAPTCHA text character field on my confirmation form by placing the code quoted below at about line 211 on the confirmation form (/components/com_pmformviews/confirmation/tmpl/default.php):
I've placed the reCAPTCHA library file (recaptchalib.php) on the server.
Where do I place the following server side code?:
It says to put it at the top of the form processing script, which in the confirmation form is a little more complicated than I can figure out.
Please advise.
Thanks,
Azurelink
I'm actually in need of a solution for the time being. And I'm more interested in using reCAPTCHA — you didn't specify what your plans involved. So if you could please help me with some direction I would appreciate it.
I've figured out that I can display the ReCAPTCHA text character field on my confirmation form by placing the code quoted below at about line 211 on the confirmation form (/components/com_pmformviews/confirmation/tmpl/default.php):
Code:
<tr>
<td class="title_cell">Enter anti-spam text:</td>
<td class="field_cell">
<?php
require_once('includes/recaptcha/recaptchalib.php');
$publickey = "your_public_key"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
</td>
</tr>
I've placed the reCAPTCHA library file (recaptchalib.php) on the server.
Where do I place the following server side code?:
Code:
<?php
require_once('path_to_file/recaptchalib.php');
$privatekey = "your_private_key";
$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
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification
}
?>
It says to put it at the top of the form processing script, which in the confirmation form is a little more complicated than I can figure out.
Please advise.
Thanks,
Azurelink
Last edit: 13 years 4 months ago by azurelink.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
13 years 4 months ago #10547
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Captcha (or ReCaptcha) for Payment Form too
Hi
You can add the code to components/com_pmform/controller.php file, in the function process_payment . Have a look at that function and add the code to !
Regards,
Tuan
You can add the code to components/com_pmform/controller.php file, in the function process_payment . Have a look at that function and add the code to !
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- azurelink
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 48
- Thank you received: 0
13 years 4 months ago #10549
by azurelink
Replied by azurelink on topic Re: Captcha (or ReCaptcha) for Payment Form too
Hi Tuan,
Cool! Thanks.
So where in the function should I put it? I don't want to break it.
Right on the line below the opening curly bracket like the below?
Cool! Thanks.
So where in the function should I put it? I don't want to break it.
Right on the line below the opening curly bracket like the below?
Code:
function process_payment() {
require_once('path_to_file/recaptchalib.php');
$privatekey = "your_private_key";
$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
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
JRequest::checkToken() or jexit( 'Invalid Token' );
$post = JRequest::get('post', JREQUEST_ALLOWHTML) ;
$model = & $this->getModel('Payment') ;
$model->processPayment($post) ;
}
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2024 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.