Hi guys I am trying to implement and CAPTCHA response on one of my forms on my website..I got instructions from here:
I have configured both client and server files per instructions but I think there is something wrong wit the server file....if i upload the client file to my website and, then go to that page, it loads fine with no problems but of course it doesn't work because i have not uploaded the sever file yet...problem happens when I upload the server file...as soon as i update the server file and i then go to the CLIENT file it does not load at all...i get an error message instead that says: The reCAPTCHA wasn't entered correctly. Go back and try it again.(reCAPTCHA said: incorrect-captcha-sol)....i thinks this is because some of the code on my server file is not correct...can you please take a look and let me know if you see why I am having this problem?? attaches is the serve file code...this is driving me nuts..thanks! beow is my server file code:
<?php
require_once('recaptchalib.php');
$privatekey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else
{
date_default_timezone_set( 'America/New_York' );
/*
Simple web form mailer
*/
//safe error-free retrival of post values
//required - do not touch or move
function pval($key){ return ( isset( $_POST[$key] ) ) ? $_POST[$key] : "" ; }
/***************************************************************
* Config Settings
***************************************************************/
//INFO FOR EMAIL
$to = 'sales@sxxxx.com';
$from = 'sales@xxxxxxxx.com';
$email_subject = 'New eLines Request Form';
//INFO FOR EMAIL TO Customer
$confirm_from = 'sales@xxxxxxxxx.com';
$confirm_email_subject = 'Thank you for submitting your eLines quote with xxx';
//Email Server Info
//disable the testing info on the production server
$smtp_server = 'mailwash27.xxxxxx.com';
$smtp_port = 225;
$smtp_username = 'ecommerce@xxxxxxxxxxx.com';
$smtp_password = 'xxxxxxxxxx';
//our list of required fields
//
// the form element 'key' or 'name' is on the left
//
// The printable title of the field is on the right
// this is used for the 'Please correct the following errors'
//
$required_fields = array(
'first_name' => "First Name",
'last_name' => "Last Name",
'company' => "Company",
'phone' => "Phone Number",
'email' => "Email Address",
'part_number' => "Part Number",
'ship_time' => "Shipping Time",
'ship_method' => "Shipping Method",
'hear_about_us' => "How did you hear about us?"
);
$required_file_fields = array(
'image' => 'Drawing Attachment'
);
//FORM VALUES
//for EVERY field you MUST have one of these. Not just required fields
// not just required fields. These are used to fill in the Email template
// and the thank you page. Also suitable for re-displaying the form
$first_name = pval('first_name');
$last_name = pval('last_name');
$company = pval('company');
$phone = pval('phone');
$email = pval('email');
$part_number = pval('part_number');
$ship_time = pval('ship_time');
$ship_method = pval('ship_method');
$requirements = pval('requirements');
$hear_about_us =pval('hear_about_us');
$thankyou = "thankyou.php";
$form = 'index.php';
$message = 'message.php';
$confirm_message = 'confirm_message.php';
$failure_notice = "There was an unknown error submitting your form. Please Call Us.";
$form_errors = array();
}
?>
I have configured both client and server files per instructions but I think there is something wrong wit the server file....if i upload the client file to my website and, then go to that page, it loads fine with no problems but of course it doesn't work because i have not uploaded the sever file yet...problem happens when I upload the server file...as soon as i update the server file and i then go to the CLIENT file it does not load at all...i get an error message instead that says: The reCAPTCHA wasn't entered correctly. Go back and try it again.(reCAPTCHA said: incorrect-captcha-sol)....i thinks this is because some of the code on my server file is not correct...can you please take a look and let me know if you see why I am having this problem?? attaches is the serve file code...this is driving me nuts..thanks! beow is my server file code:
<?php
require_once('recaptchalib.php');
$privatekey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else
{
date_default_timezone_set( 'America/New_York' );
/*
Simple web form mailer
*/
//safe error-free retrival of post values
//required - do not touch or move
function pval($key){ return ( isset( $_POST[$key] ) ) ? $_POST[$key] : "" ; }
/***************************************************************
* Config Settings
***************************************************************/
//INFO FOR EMAIL
$to = 'sales@sxxxx.com';
$from = 'sales@xxxxxxxx.com';
$email_subject = 'New eLines Request Form';
//INFO FOR EMAIL TO Customer
$confirm_from = 'sales@xxxxxxxxx.com';
$confirm_email_subject = 'Thank you for submitting your eLines quote with xxx';
//Email Server Info
//disable the testing info on the production server
$smtp_server = 'mailwash27.xxxxxx.com';
$smtp_port = 225;
$smtp_username = 'ecommerce@xxxxxxxxxxx.com';
$smtp_password = 'xxxxxxxxxx';
//our list of required fields
//
// the form element 'key' or 'name' is on the left
//
// The printable title of the field is on the right
// this is used for the 'Please correct the following errors'
//
$required_fields = array(
'first_name' => "First Name",
'last_name' => "Last Name",
'company' => "Company",
'phone' => "Phone Number",
'email' => "Email Address",
'part_number' => "Part Number",
'ship_time' => "Shipping Time",
'ship_method' => "Shipping Method",
'hear_about_us' => "How did you hear about us?"
);
$required_file_fields = array(
'image' => 'Drawing Attachment'
);
//FORM VALUES
//for EVERY field you MUST have one of these. Not just required fields
// not just required fields. These are used to fill in the Email template
// and the thank you page. Also suitable for re-displaying the form
$first_name = pval('first_name');
$last_name = pval('last_name');
$company = pval('company');
$phone = pval('phone');
$email = pval('email');
$part_number = pval('part_number');
$ship_time = pval('ship_time');
$ship_method = pval('ship_method');
$requirements = pval('requirements');
$hear_about_us =pval('hear_about_us');
$thankyou = "thankyou.php";
$form = 'index.php';
$message = 'message.php';
$confirm_message = 'confirm_message.php';
$failure_notice = "There was an unknown error submitting your form. Please Call Us.";
$form_errors = array();
}
?>