|
-
Dec 29th, 2008, 02:51 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Is this php code correct for emailing with a Captcha??
PHP Code:
<?php
require_once('recaptchalib.php');
$publickey = "my_publickey";
$privatekey = "my_privatekey";
$resp = null;
$error = null;
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$company = $_REQUEST['company'] ;
$address = $_REQUEST['address'] ;
$city = $_REQUEST['city'] ;
$state = $_REQUEST['state'] ;
$zip = $_REQUEST['zip'] ;
$phone = $_REQUEST['phone'] ;
$sendsale = $_REQUEST['sendsalespacket'] ;
$keep = $_REQUEST['keepmeupdated'] ;
if ( ereg( "[\r\n]", $name) || ereg("[\r\n]", $email ) ) {
header( "Location: error.htm" );
}
mail("[email protected]", "Request Packet", $message, "Name: $name\nCompany: $company\nAddress: $address\nCity: $city\nState: $state\nZip Code: $zip\nPhone: $phone\nEmail: $email\nComments: $message\nSend Sales Packet: $sendsale\nKeep Me Informed: $keep") ;
header( "Location: contacts.htm" ) ;
} else {
# set the error code so that we can display it
header( "Location: error.htm" ) ;
}
}
echo recaptcha_get_html($publickey, $error);
?>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|