//require_once('recaptchalib.php');
$publickey = "6Ley_VUUAAAAAGUEBupBAot_hZGrZMyxZf6_3L8"; // you got this from the signup page
?>
$flag=$_REQUEST["flag"];
$lname=$_REQUEST["lname"];
$fname=$_REQUEST["fname"];
$email=$_REQUEST["email"];
$phone=$_REQUEST["phone"];
$subject=$_REQUEST["subject"];
$services=$_REQUEST["services"];
$comments=$_REQUEST["comments"];
if ($flag == "process"){
$privatekey = "6Ley_VUUAAAAABiqbD8l0-jxZq9UJSMeOZVje6RQ";
//$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
$response = $_POST["g-recaptcha-response"];
$url = 'https://www.google.com/recaptcha/api/siteverify';
$data = array(
'secret' => $privatekey,
'response' => $_POST["g-recaptcha-response"]
);
$options = array(
'http' => array (
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$verify = file_get_contents($url, false, $context);
$captcha_success=json_decode($verify);
if ($captcha_success->success==false){
die ("The CAPTCHA code wasn't entered correctly. Go back and try it again.");
}
if ($fname == ""){
$missing="yes";
$whatsmissing = "$whatsmissing
First Name";
}
if ($lname == ""){
$missing="yes";
$whatsmissing = "$whatsmissing
Last Name";
}
if ($email == ""){
$missing="yes";
$whatsmissing = "$whatsmissing
Email Address";
}
if ($services == ""){
$missing="yes";
$whatsmissing = "$whatsmissing
Message";
}
if ($missing == "yes"){
$text="$whatsmissing
";
$sendflag="false";
}
if ($missing == ""){
function is_valid_email($email) {
return preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $email);
}
if($_SERVER['REQUEST_METHOD'] != "POST"){
echo("Unauthorized attempt to access page.");
exit;
}
if (!is_valid_email($email)) {
echo 'Sorry, invalid email';
exit;
}
function contains_bad_str($str_to_test) {
$bad_strings = array(
"content-type:"
,"mime-version:"
,"multipart/mixed"
,"Content-Transfer-Encoding:"
,"bcc:"
,"cc:"
,"to:"
);
foreach($bad_strings as $bad_string) {
if(eregi($bad_string, strtolower($str_to_test))) {
echo "$bad_string found. Suspected injection attempt - mail not being sent.";
exit;
}
}
}
function contains_newlines($str_to_test) {
if(preg_match("/(%0A|%0D|\\n+|\\r+)/i", $str_to_test) != 0) {
echo "newline found in $str_to_test. Suspected injection attempt - mail not being sent.";
exit;
}
}
contains_bad_str($email);
contains_newlines($email);
$sendflag="true";
//print "$sender";
/* To send HTML mail, you can set the Content-type header. */
/* additional headers */
$subject = "$subject";
if ($subject == ""){
$subject="Message for your website";
}
$fullname = "$fname $lname";
$message = "Someone filled out the contact form:\n
Name: $fname $lname\r\n
Email: $email\r\n
Interested in: $services\r\n";
if ($phone != ""){
$message .= "Phone Number: $phone\r\n";
}
if ($comments != ""){
$message .= "Comments: $comments\r\n";
}
$message .= "Comments/Questions: $comments\r\n";
$crecipemail="rl@cpataxsavings.com";
//$crecipemail = "lindseytyner@gmail.com";
mail("$crecipemail", "$subject", $message,
"MIME-Version: 1.0\r\n" .
"Content-type: text/html; charset=iso-8859-1\r\n" .
"From: $fullname<$email>\r\n" .
"Reply-To: $crecipemail\r\n" .
"Return_Receipt-To: $crecipemail\r\n" .
"Return-Path: $crecipemail\r\n" .
"X-Mailer: PHP/" . phpversion());
}
}
?>
|
|
||
CONTACT US:
Your information has been submitted. We will contact you shortly. } if ($sendflag=="false"){?> You forgot to fill out some information. Please try again. }?> | |||
2955 Dawn Drive, Suite 102, Georgetown, Texas 78628 | Phone: (512) 763-1010 - Fax: (512) 763-1015 | rl@cpataxsavings.com | |||
HOME | ABOUT RUSSELL | TAX PLANNING & SERVICES | FINANCIAL TOOLS | CONTACT US |
Copyright 2007, Russell Langbein, All Rights Reserved | Site Design by ATX Multimedia |