New Zenner
- Join Date:
- Aug 2009
- Posts:
- 4
- Plugin Contributions:
- 0
Adding reCAPTCHA to Contact Us Form
Can any one help me to add a captcha in zencart in contact page.I need it badly as possible as anyone can???:dontgetit
Views: 38,808
New Zenner
Can any one help me to add a captcha in zencart in contact page.I need it badly as possible as anyone can???:dontgetit
New Zenner
I posted a link to the file in my last post. It's at the bottom of page 2 of this thread. I wrote the plugin and use it on my site. Very easy to setup. Here's the link again:
recaptca_plugin
Zen Follower
Hi There
pickupman:
I finished writing the code for the reCAPTCHA plugin. It supports configuration options in the admin page, and only requires a few files to upload. I just uploaded it to the add ons, and waiting approval. Here is a link to download it.
oldeparsonage.com/wp-content/uploads/2009/06/contactus_recaptcha_v1-0.zip
Just installed this in 1.3.8a and it doesn't show up nder Admin>Configuration
Cheers
Cliff
New Zenner
In the zip file the admin directory was /admin, however, if you have renamed your admin folder you would need to upload this to the appropriate folder.
The recaptcha_functions file should automatically be loaded from zen cart's default behaviour. The file checks the DB for a configuration group called "reCAPTCHA". If the configuration group is not found, then it inserts it along the settings keys.
In phpMyAdmin or something like run the query:
SELECT *
FROM zen_configuration_group
WHERE configuration_group_title = 'reCAPTCHA';
If it's returning an empty result, the file /admin/includes/functions/extra_functions/recaptcha_functions.php must not be in the appropriate folder.
One last attempt maybe to clear your browser's cache.
Administrator
FWIW, logging into admin to cause the script to run doesn't work for me either. I've got the files in my <renamedadmin>\includes\functions\extra_functions ... but where/how do these functions get invoked? Having the functions loaded is nice, but where are they called?
New Zenner
Since files in the extra_functions folder are auto loaded, what happens is that recaptcha_functions.php runs a query checking for a configuration key named "recaptcha". If it is not found the script calls a function invoking the install of the configuration keys. In that file you may change at line 33-36 from:
if (mysql_num_rows($result) < 1) {
// install values
install_recaptcha();
}
and change to
if (mysql_num_rows($result) < 1) {
// install values
install_recaptcha();
}else{
echo 'recaptcha found';
}
This should has a output error in the header if it is being loaded by zencart. If it does, change the code back. Make sure there are no previous reCAPTCHA keys in the database. Run the sql query (in phpMyAdmin or the like) posted above and see if the keys already exist.
New Zenner
Not exactly a secure option, but another option is to add to <adminfolder>/includes/functions/extra_functions/recaptcha_functions.php at line 22 add
if($_GET['remove_recaptcha'] == 'yes')
{
remove_recaptcha();
}
if($_GET['install_recaptcha'] == 'yes')
{
install_recaptcha();
}
You should be able to invoke it by adding ?remove_recaptcha=yes to the end of your url, or ?install_recaptcha=yes to install it.
Zen Follower
I am also getting just a blank white screen... Any help is appreciated..
New Zenner
I am also getting just a blank white screen... Any help is appreciated..
Please provide details about your problem. What page your are trying to access, what changes have you currently made, etc. Blank white page probably means there is a problem parsing a file before it gets outputted to the browser. Check your error logs to see where the error is coming from.
Zen Follower
Ok... I re uploaded all the files ad my contact us page is not blank, yet the recaptcha isn't there. I have set the public and private keys under Configuration>reCAPTCHA and updated them, but I still do not see the captcha, nor do I see any process on the page attempting to run for it. Any file I should check?
Zen Follower
It is almost like it isnt using the tpl_contact_us_default.php file..
Zen Follower
Hahaha wow I feel dumb. Just had to enable it in configuration... That's what I get for working so late... I'm going to bed now. Thanks for the great mod
Zen Follower
davewest:
Lost me with your other messages, but getting back to your first request.... This is what worked for my testing...
for includes\modules\pages\contact_us\header_php.php
add this just below the $error = false;
require_once('includes/templates/custom/templates/recaptchalib.php');
$privatekey = "PRIVATE-KEY-GOES-HERE";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($_POST['submitted'] == 'yes' && !$resp->is_valid) {
$error = true;
}
> ```
if ($zc_validate_email and !empty($enquiry) and !empty($name) and $resp->is_valid) {
```now for includes\templates\classic\templates\tpl_contact_us_default.php
>
> bottom of the page above the submit button code you see a </fieldset> just above it paste this code..
> ```
<?php
if ($error == true) {
echo '<span style="color:red;font-style:bold;">*Please re-try entering the 2 word reCAPTCHA:</span>';
}
//require_once('recaptcha/recaptchalib.php');
$publickey = "PUBLIC-KEY-GOES-HERE";
echo recaptcha_get_html($publickey);
?>
```Of course replace the KEY-GOES-HERE with your key.
>
> This work for my tests, if captcha fails, your back to the contact us page. If all is right your on to the success page.
Hi Dave,
Where do I get the PRIVATE-KEY-GOES-HERE from?
Thanks :cry:
Totally Zenned
PinkLeopard:
Hi Dave,
Where do I get the PRIVATE-KEY-GOES-HERE from?
Thanks :cry:
From the reCAPTCHA website.... recaptcha.net
Zen Follower
Dave!
Thanks I did that.
Now, I took a peek at your site and I really like your multi-color reCAPTCHA.
May I ask which add-on you used?
Thanks! :clap:
Totally Zenned
PinkLeopard:
Dave!
Thanks I did that.
Now, I took a peek at your site and I really like your multi-color reCAPTCHA.
May I ask which add-on you used?
Thanks! :clap:
I use the 'CAPTCHA using TTF & GD' mod with two sets fonts.
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=551
Zen Follower
Thanks Dave again! :yes:
Zen Follower
whaaatt, iv installed this, but i cant even see re-captcha on my admin>configuration>??
any idea's?
Zen Follower
never mind, followed some instructions, and it worked :D
New Zenner
Hi there - anyone know where the sql files that the install document refers to? there were none with my download??am trying to get the recaptcha mod working and it isn't - I have checked and re-checked and can find no other files anywhere?
Your speedy assistance would be greatly appreciated.
Tell staff why this post should be reviewed.