Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

help with adding google captcha

Posted on 2014-07-10
12
Medium Priority
?
228 Views
Last Modified: 2014-07-17
Hi,
At this page here http://www.herbalwisdom.com.au/contact-us.html
I am trying to add googles captcha.  I followed these instructions (below link) to a T, but there is no captcha showing, and when you hit submit you get an error.

https://developers.google.com/recaptcha/docs/php

Please can someone help me get the captcha showing on this simple form?
Thanks
0
Comment
Question by:Amanda Watson
  • 9
  • 3
12 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40189690
First, http://www.herbalwisdom.com.au/contact-us.html needs to be http://www.herbalwisdom.com.au/contact-us.php.  I can see the PHP code for the captcha in the view source because it is Not running as a PHP page.
0
 
LVL 11

Author Comment

by:Amanda Watson
ID: 40189788
Oh my gosh, can I even do that in magento - I didn't even think of that!!!
But I was using sendresults.php originally to work the form, so I thought it would be ok, but yeah how do I insert php captcha into a html form?
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40189829
By making it a PHP file.  All you have to do is change the file extension from 'html' to 'php'.  And this has nothing to do with Magento.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Author Comment

by:Amanda Watson
ID: 40189979
ah, are you sure....I think it does have something to do with magento......Its a static block so the extensions are handled as a group?
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40189987
Never heard of such a thing.  I have thousands of PHP files that have nothing to do with Magento.  In fact, I don't have Magento on anything.  I don't use it.

Have you tried it yet?
0
 
LVL 11

Author Comment

by:Amanda Watson
ID: 40192570
I can't try it, I can't make the page php!!!!
0
 
LVL 11

Author Comment

by:Amanda Watson
ID: 40192576
I added the code locally too, and changed the page name to php but the big captcha picture still didn't show.
I am doing something wrong with the code somewhere
<h3>Herbal Wisdom - Natural Foods, Health &amp; Massage</h3>
<p><strong>Address</strong> - 64 Byron Street, Bangalow, NSW, 2479</p>
<p><strong>Phone</strong> - (02) 6687 0457</p>
<p><strong>Email</strong> - <a href="mailto:peter@herbalwisdom.com.au">peter@herbalwisdom.com.au</a></p>
</br>
<p><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.au/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com.au/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004" style="color:#0000FF;text-align:left">View Larger Map</a></small></p>
<form id="contactForm" method="post" action="verify.php" >
<div class="fieldset">
</br>
<h2>Contact/Enquiry Form</h2>
<ul class="form-list">
<li class="fields">
<div class="field" style="padding:5px;"><label class="required" for="name"><em>*</em>Name</label>
<div class="input-box" style="padding:5px;"><input id="name" class="input-text required-entry" title="Name" type="text" name="name" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label class="required" for="email"><em>*</em>Email</label>
<div class="input-box" style="padding:5px;"><input id="email" class="input-text required-entry validate-email" title="Email" type="text" name="email" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label for="telephone">Telephone</label>
<div class="input-box"><input id="telephone" class="input-text" title="Telephone" type="text" name="telephone" value="" /></div>
</div>
<div class="field last" style="padding:5px;"><label for="order">Order Number</label>
<div class="input-box"><input id="order" class="input-text" title="Order" type="text" name="order" value="" /></div>
</div>
</li>
<li class="wide" style="padding:5px;"><label class="required" for="comment"><em>*</em>Comment</label>
<div class="input-box" style="padding:5px;"><textarea id="comment" class="required-entry input-text" title="Comment" name="comment" rows="3" cols="5"></textarea></div>
<li class="website" style="display:none">
    <input id="website" type="text" name="website" value="www.example.com/" />
</li>
<li><?php
          require_once('recaptchalib.php');
          $publickey = "6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
        ?>
</li>
</ul>
</div>
<div class="buttons-set" ><input id="hideit" style="display: none !important;" type="text" name="hideit" value="" /> <button class="button" title="Submit" type="submit"><span><span>Submit</span></span></button>
<p class="required">* Required Fields</p>
</div>
</form>

Open in new window

0
 
LVL 11

Author Comment

by:Amanda Watson
ID: 40192582
Hey there, scrap this code,
This is better or closer I should say
.  But now there is no submit button??
Site is http://www.herbalwisdom.com.au/contact-us.html

<h3>Herbal Wisdom - Natural Foods, Health &amp; Massage</h3>
<p><strong>Address</strong> - 64 Byron Street, Bangalow, NSW, 2479</p>
<p><strong>Phone</strong> - (02) 6687 0457</p>
<p><strong>Email</strong> - <a href="mailto:peter@herbalwisdom.com.au">peter@herbalwisdom.com.au</a></p>
</br>
<p><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.au/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com.au/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004" style="color:#0000FF;text-align:left">View Larger Map</a></small></p>
<form id="contactForm" method="post" action="verify.php" >
<?php
     require_once('recaptchalib.php');
     $publickey = "6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"; // you got this from the signup page
     echo recaptcha_get_html($publickey);
   ?>

<div class="fieldset">
</br>
<h2>Contact/Enquiry Form</h2>
<ul class="form-list">
<li class="fields">
<div class="field" style="padding:5px;"><label class="required" for="name"><em>*</em>Name</label>
<div class="input-box" style="padding:5px;"><input id="name" class="input-text required-entry" title="Name" type="text" name="name" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label class="required" for="email"><em>*</em>Email</label>
<div class="input-box" style="padding:5px;"><input id="email" class="input-text required-entry validate-email" title="Email" type="text" name="email" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label for="telephone">Telephone</label>
<div class="input-box"><input id="telephone" class="input-text" title="Telephone" type="text" name="telephone" value="" /></div>
</div>
<div class="field last" style="padding:5px;"><label for="order">Order Number</label>
<div class="input-box"><input id="order" class="input-text" title="Order" type="text" name="order" value="" /></div>
</div>
</li>
<li class="wide" style="padding:5px;"><label class="required" for="comment"><em>*</em>Comment</label>
<div class="input-box" style="padding:5px;"><textarea id="comment" class="required-entry input-text" title="Comment" name="comment" rows="3" cols="5"></textarea></div>
<li class="website" style="display:none">
    <input id="website" type="text" name="website" value="www.example.com/" />
</li>
<li>
<script type="text/javascript"
   src="https://www.google.com/recaptcha/api/challenge?k=6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"
 </script>
 <noscript>
   <iframe src="https://www.google.com/recaptcha/api/noscript?k=6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"
       height="300" width="500" frameborder="0"></iframe><br>
 </noscript>
</li>
</ul>
</div>
<div class="buttons-set" ><input id="hideit" style="display: none !important;" type="text" name="hideit" value="" /> <button class="button" title="Submit" type="submit"><span><span>Submit</span></span></button>
<p class="required">* Required Fields</p>
</div>
</form>

Open in new window

<h3>Herbal Wisdom - Natural Foods, Health &amp; Massage</h3>
<p><strong>Address</strong> - 64 Byron Street, Bangalow, NSW, 2479</p>
<p><strong>Phone</strong> - (02) 6687 0457</p>
<p><strong>Email</strong> - <a href="mailto:peter@herbalwisdom.com.au">peter@herbalwisdom.com.au</a></p>
</br>
<p><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.au/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com.au/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004" style="color:#0000FF;text-align:left">View Larger Map</a></small></p>
<form id="contactForm" method="post" action="verify.php" >
<div class="fieldset">
</br>
<h2>Contact/Enquiry Form</h2>
<ul class="form-list">
<li class="fields">
<div class="field" style="padding:5px;"><label class="required" for="name"><em>*</em>Name</label>
<div class="input-box" style="padding:5px;"><input id="name" class="input-text required-entry" title="Name" type="text" name="name" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label class="required" for="email"><em>*</em>Email</label>
<div class="input-box" style="padding:5px;"><input id="email" class="input-text required-entry validate-email" title="Email" type="text" name="email" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label for="telephone">Telephone</label>
<div class="input-box"><input id="telephone" class="input-text" title="Telephone" type="text" name="telephone" value="" /></div>
</div>
<div class="field last" style="padding:5px;"><label for="order">Order Number</label>
<div class="input-box"><input id="order" class="input-text" title="Order" type="text" name="order" value="" /></div>
</div>
</li>
<li class="wide" style="padding:5px;"><label class="required" for="comment"><em>*</em>Comment</label>
<div class="input-box" style="padding:5px;"><textarea id="comment" class="required-entry input-text" title="Comment" name="comment" rows="3" cols="5"></textarea></div>
<li class="website" style="display:none">
    <input id="website" type="text" name="website" value="www.example.com/" />
</li>
<li><?php
          require_once('recaptchalib.php');
          $publickey = "6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
        ?>
</li>
</ul>
</div>
<div class="buttons-set" ><input id="hideit" style="display: none !important;" type="text" name="hideit" value="" /> <button class="button" title="Submit" type="submit"><span><span>Submit</span></span></button>
<p class="required">* Required Fields</p>
</div>
</form>

Open in new window

0
 
LVL 11

Author Comment

by:Amanda Watson
ID: 40192584
By the way that lady getting a massage is supposed to be in the left sidebar , but my code pushed it to the bottom....?
<h3>Herbal Wisdom - Natural Foods, Health &amp; Massage</h3>
<p><strong>Address</strong> - 64 Byron Street, Bangalow, NSW, 2479</p>
<p><strong>Phone</strong> - (02) 6687 0457</p>
<p><strong>Email</strong> - <a href="mailto:peter@herbalwisdom.com.au">peter@herbalwisdom.com.au</a></p>
</br>
<p><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.au/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com.au/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=64+Byron+Street,+Bangalow,+NSW,+2479&amp;sll=-32.830735,147.451465&amp;sspn=15.592573,27.443848&amp;ie=UTF8&amp;hq=&amp;hnear=64+Byron+St,+Bangalow+New+South+Wales+2479&amp;t=m&amp;z=14&amp;ll=-28.686382,153.526004" style="color:#0000FF;text-align:left">View Larger Map</a></small></p>
<form id="contactForm" method="post" action="verify.php" >
<div class="fieldset">
</br>
<h2>Contact/Enquiry Form</h2>
<ul class="form-list">
<li class="fields">
<div class="field" style="padding:5px;"><label class="required" for="name"><em>*</em>Name</label>
<div class="input-box" style="padding:5px;"><input id="name" class="input-text required-entry" title="Name" type="text" name="name" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label class="required" for="email"><em>*</em>Email</label>
<div class="input-box" style="padding:5px;"><input id="email" class="input-text required-entry validate-email" title="Email" type="text" name="email" value="" /></div>
</div>
<div class="field" style="padding:5px;"><label for="telephone">Telephone</label>
<div class="input-box"><input id="telephone" class="input-text" title="Telephone" type="text" name="telephone" value="" /></div>
</div>
<div class="field last" style="padding:5px;"><label for="order">Order Number</label>
<div class="input-box"><input id="order" class="input-text" title="Order" type="text" name="order" value="" /></div>
</div>
</li>
<li class="wide" style="padding:5px;"><label class="required" for="comment"><em>*</em>Comment</label>
<div class="input-box" style="padding:5px;"><textarea id="comment" class="required-entry input-text" title="Comment" name="comment" rows="3" cols="5"></textarea></div>
<li class="website" style="display:none">
    <input id="website" type="text" name="website" value="www.example.com/" />
</li>
<li><?php
          require_once('recaptchalib.php');
          $publickey = "6LetJvYSAAAAAAHfad8xPRPpF3UgbsDOsns5ZQ_O"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
        ?>
</li>
</ul>
</div>
<div class="buttons-set" ><input id="hideit" style="display: none !important;" type="text" name="hideit" value="" /> <button class="button" title="Submit" type="submit"><span><span>Submit</span></span></button>
<p class="required">* Required Fields</p>
</div>
</form>

Open in new window

0
 
LVL 11

Author Comment

by:Amanda Watson
ID: 40192608
Ok I have it all working now, but how to do Send the code to a particular recipient?

There is a section in verify.php that says  

 // Your code here to handle a successful verification which is where I assume you send you form....but I don't know what to write to send the form or post it to a ricipient.....please help I am at a road block.............?
 <?php
 require_once('recaptchalib.php');
 $privatekey = "6LetJvYSAAAAAKHTJpHMxLFVT0JgYGjdx7sn8TS1";
 $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
 
 }
 ?>
   <?php echo 'Your form was sucsellfully submitted.'  ?>

Open in new window

0
 
LVL 11

Accepted Solution

by:
Amanda Watson earned 0 total points
ID: 40192622
Solved it myself.
It didn't need to be a php at all .
I just had to write some code in verify.php for the google recaptch to work correctly which I did.
The veryify,php file required another php script to run for the form to work and I used sendresults.php
0
 
LVL 11

Author Closing Comment

by:Amanda Watson
ID: 40201510
Sorry, but I did find the final solution
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question