Zen Cart Logo
Forums / All Other Contributions/Addons / Adding reCAPTCHA to Contact Us Form

Adding reCAPTCHA to Contact Us Form

Views: 38,808

Results 21 to 40 of 186
5 Aug 2009, 7:23 AM
#21
midpart avatar

midpart

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

7 Aug 2009, 12:57 AM
#22
pickupman avatar

pickupman

New Zenner

Join Date:
Jun 2009
Posts:
83
Plugin Contributions:
2

Re: Adding reCAPTCHA to Contact Us Form

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

13 Aug 2009, 3:26 PM
#23
cliffvt avatar

cliffvt

Zen Follower

Join Date:
Jul 2009
Posts:
100
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

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

18 Aug 2009, 12:44 PM
#24
pickupman avatar

pickupman

New Zenner

Join Date:
Jun 2009
Posts:
83
Plugin Contributions:
2

Re: Adding reCAPTCHA to Contact Us Form

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.

22 Oct 2009, 10:30 AM
#25
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,102
Plugin Contributions:
56

Re: Adding reCAPTCHA to Contact Us Form

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?

22 Oct 2009, 3:28 PM
#26
pickupman avatar

pickupman

New Zenner

Join Date:
Jun 2009
Posts:
83
Plugin Contributions:
2

Re: Adding reCAPTCHA to Contact Us Form

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.

22 Oct 2009, 3:52 PM
#27
pickupman avatar

pickupman

New Zenner

Join Date:
Jun 2009
Posts:
83
Plugin Contributions:
2

Re: Adding reCAPTCHA to Contact Us Form

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.

23 Oct 2009, 9:45 PM
#28
new2u avatar

new2u

Zen Follower

Join Date:
Sep 2009
Posts:
186
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

I am also getting just a blank white screen... Any help is appreciated..

24 Oct 2009, 2:04 AM
#29
pickupman avatar

pickupman

New Zenner

Join Date:
Jun 2009
Posts:
83
Plugin Contributions:
2

Re: Adding reCAPTCHA to Contact Us Form

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.

31 Oct 2009, 5:29 AM
#30
new2u avatar

new2u

Zen Follower

Join Date:
Sep 2009
Posts:
186
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

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?

31 Oct 2009, 6:19 AM
#31
new2u avatar

new2u

Zen Follower

Join Date:
Sep 2009
Posts:
186
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

It is almost like it isnt using the tpl_contact_us_default.php file..

31 Oct 2009, 6:36 AM
#32
new2u avatar

new2u

Zen Follower

Join Date:
Sep 2009
Posts:
186
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

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

31 Oct 2009, 7:59 AM
#33
pinkleopard avatar

pinkleopard

Zen Follower

Join Date:
Jun 2009
Posts:
383
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

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:
31 Oct 2009, 3:39 PM
#34
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Re: Adding reCAPTCHA to Contact Us Form

PinkLeopard:

Hi Dave,

Where do I get the PRIVATE-KEY-GOES-HERE from?

Thanks :cry:

From the reCAPTCHA website.... recaptcha.net

31 Oct 2009, 8:50 PM
#35
pinkleopard avatar

pinkleopard

Zen Follower

Join Date:
Jun 2009
Posts:
383
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

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:

1 Nov 2009, 2:11 AM
#36
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Re: Adding reCAPTCHA to Contact Us Form

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

1 Nov 2009, 6:17 AM
#37
pinkleopard avatar

pinkleopard

Zen Follower

Join Date:
Jun 2009
Posts:
383
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

Thanks Dave again! :yes:

17 Nov 2009, 2:31 PM
#38
spid3r1987 avatar

spid3r1987

Zen Follower

Join Date:
Jul 2009
Posts:
497
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

whaaatt, iv installed this, but i cant even see re-captcha on my admin>configuration>??

any idea's?

17 Nov 2009, 2:40 PM
#39
spid3r1987 avatar

spid3r1987

Zen Follower

Join Date:
Jul 2009
Posts:
497
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

never mind, followed some instructions, and it worked :D

7 Dec 2009, 2:25 AM
#40
murrayinperth avatar

murrayinperth

New Zenner

Join Date:
Dec 2009
Posts:
1
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

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.