Hi, i’m editing an existing form to include a captcha code.
I used a basic php install from captcha.biz
It seemed to install fine, but the form will send to my email regardless of whether a captcha is entered or not, or whether it’s entered correctly or not. The validation part of the code doesn’t seem to work.
contact.php
[php]<?php session_start(); ?>
<div id="header-contact">
<p>Call us now</p>
<p>Chris: 0449 266 750</p>
</div>
<div id="nav">
<a class="hoverBtn" href="index.html">home</a>
<a class="hoverBtn" href="testimonials.html">testimonials</a>
<a class="hoverBtn" href="gallery.html">gallery</a>
<a class="hoverBtn" href="contact.html">contact us</a>
</div>
</div>
<div id="content">
<div id="container">
<div id="main">
<h1>Contact Us</h1>
<h2>When it comes to selecting a landscaping company in Greater Sydney, it can be difficult to distinguish between a professional and an amateur. Effect Landscaping provides expert landscape design, build and maintenance services. Contact us about your landscaping needs.</h2>
Chris Chisholm 0449 266 750
[email protected]Matt Barton 0424 930 560
[email protected]
You can also contact us with this form: |
|
Contact: | Matt Chris |
* Name: | |
* Email: | |
Company: | |
Phone: | |
Message: | |
* Security Code: |
<?php // Adding BotDetect Captcha to the page
$SampleCaptcha = new Captcha("SampleCaptcha");
$SampleCaptcha->UserInputID = "CaptchaCode";
echo $SampleCaptcha->Html();
?>
<?php
if ($_POST) {
// validate the Captcha to check we're not dealing with a bot
$isHuman = $SampleCaptcha->Validate();
} |
* required field | |
</div>
</div>
</div>
Copyright © 2012 Effect Landscapes All Rights Reserved
<div id="footer-contact">
<p class="copyright">Follow us on:</p>
<a href="http://www.book.com/s" alt="Effectbook page"><img src="images/book.png" alt="Follow us on book" width="70px" /></a>
</div>
verify.php
[php]<?php
$to = $_REQUEST[‘sendto’] ;
$from = $_REQUEST[‘Email’] ;
$name = $_REQUEST[‘Name’] ;
$headers = “From: $from”;
$subject = “Website Contact Data”;
$fields = array();
$fields{“Name”} = “Name”;
$fields{“Company”} = “Company”;
$fields{“Email”} = “Email”;
$fields{“Phone”} = “Phone”;
$fields{“Message”} = “Message”;
$body = “We have received the following information:\n\n”; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = “From: [email protected]”;
$subject2 = “contact”;
$autoreply = “Thank you for contacting . Matt or Chris will get back to you as soon as possible, usually within 48 hours. If you have any more questions, please consult our website at . Please feel free to contact Chris Chisholm on or on for urgent matters.”;
if($from == ‘’) {print “You have not entered an email adress, please go back and try again”;}
else {
if($name == ‘’) {print “You have not entered a name, please go back and try again”;}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( “Location: thankyou.html” );}
else
{print “We encountered an error sending your mail, please notify [email protected]”; }
}
}
?>[/php]
thankyou.html
[code]
Contact Us | | Design. Construction. Maintenance. <div id="header-contact">
<p>Call us now</p>
<p>Chris: 0449 266 750</p>
</div>
<div id="nav">
<a class="hoverBtn" href="index.html">home</a>
<a class="hoverBtn" href="testimonials.html">testimonials</a>
<a class="hoverBtn" href="gallery.html">gallery</a>
<a class="hoverBtn" href="contact.php">contact us</a>
</div>
</div>
<div id="content">
<div id="container">
<div id="main">
<h1>Contact Us</h1>
<h2>Thank you, your contact details have been sent to Effect Landscapes.</h2>
</div>
</div>
</div>
Copyright © 2012 Lpes All Rights Reserved
<div id="footer-contact">
<p class="copyright">Follow us on:</p>
<a href="http://www.book.com/scapes" alt="scapesbook page"><img src="images/book.png" alt="Follow us on facebook" width="70px" /></a>
</div>