Jump to content

add a email confimation to existing PHP


ea0184

Recommended Posts

I have a php form processor/thank you that I got for free. I have it directed to my email, and and autoresponder, but the auto-responder is not auto-responding. Can I just add script to my current form so that the user recieves an email with links automatically? I don't want them to verify their email address, but I do want to send them a link

 

here is the thank you/form processor:

 

Enter the email address below to send the contents of the form to.  You can enter more than one email address separated by commas, like so: $my_email = "[email protected]"; or $my_email = "[email protected],[email protected],[email protected]";

 

*/

 

$my_email = "[email protected],[email protected]";

 

/*

 

 

*/

 

$continue = "http://www.w8trainher.com";

 

/*

 

 

*/

 

$errors = array();

 

// Remove $_COOKIE elements from $_REQUEST.

 

if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}

 

// Validate email field.

 

if(isset($_REQUEST['Email']) && !empty($_REQUEST['Email']))

{

 

$_REQUEST['Email'] = trim($_REQUEST['Email']);

 

if(substr_count($_REQUEST['Email'],"@") != 1 || stristr($_REQUEST['Email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['Email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}

 

}

 

// Check referrer is from same site.

 

if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}

 

// Check for a blank form.

 

function recursive_array_check_blank($element_value)

{

 

global $set;

 

if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}

else

{

 

foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}

 

}

 

}

 

recursive_array_check_blank($_REQUEST);

 

if(!$set){$errors[] = "You cannot send a blank form";}

 

unset($set);

 

// Display any errors and exit if errors exist.

 

if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}

 

if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}

 

// Build message.

 

function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}

 

$message = build_message($_REQUEST);

 

$message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."Weight Loss";

 

$message = stripslashes($message);

 

$subject = "Weight_Loss";

 

$subject = stripslashes($subject);

 

$from_name = "";

 

if(isset($_REQUEST['name']) && !empty($_REQUEST['name'])){$from_name = stripslashes($_REQUEST['name']);}

 

$headers = "From: {$from_name} <{$_REQUEST['email']}>";

 

mail($my_email,$subject,$message,$headers);

 

?>

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

 

<html>

 

<head>

<title>Weight Loss</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body bgcolor="#D0A6CC" text="#000000">

<div>

<center>

<img src="siteassistpro_images/w8train21logo_small.png">

</center></div>

<div>

<center>

<b>Thank you <?php if(isset($_REQUEST['Name'])){print stripslashes($_REQUEST['Name']);} ?></b>

<p><b>Your request has been sent to the email address you have provided.<br> Be sure to check spam folder.</b><br></p>

<p><a href="javascript:window.close()">Click here to continue</a></p>

</center>

</div>

 

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/169267-add-a-email-confimation-to-existing-php/
Share on other sites

my goal is to have this script send the user an email with links on top of sending me their contact info. right now it only sends me their info.

 

Sorry I am new to php...

 

Enter the email address below to send the contents of the form to.  You can enter more than one email address separated by commas, like so: $my_email = "[email protected]"; or $my_email = "[email protected],[email protected],[email protected]";

*/

$my_email = "[email protected],[email protected]";

/*


*/

$continue = "http://www.w8trainher.com";

/*


*/
$errors = array();
// Remove $_COOKIE elements from $_REQUEST.
if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}

// Validate email field.

if(isset($_REQUEST['Email']) && !empty($_REQUEST['Email']))
{
$_REQUEST['Email'] = trim($_REQUEST['Email']);
if(substr_count($_REQUEST['Email'],"@") != 1 || stristr($_REQUEST['Email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['Email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}

}

// Check referrer is from same site.

if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}

// Check for a blank form.

function recursive_array_check_blank($element_value)
{

global $set;

if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
else
{

foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}

}

}
recursive_array_check_blank($_REQUEST);
if(!$set){$errors[] = "You cannot send a blank form";}
unset($set);

// Display any errors and exit if errors exist.

if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}
if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}

// Build message.

function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}

$message = build_message($_REQUEST);
$message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."Weight Loss";
$message = stripslashes($message);
$subject = "Weight_Loss";
$subject = stripslashes($subject);
$from_name = "";
if(isset($_REQUEST['name']) && !empty($_REQUEST['name'])){$from_name = stripslashes($_REQUEST['name']);}
$headers = "From: {$from_name} <{$_REQUEST['email']}>";
mail($my_email,$subject,$message,$headers);?>

I tried a few things from the tutorials you provided, and I have had no success....One way it did work but it just sent the user their own contact info. I would like for the form to send me their info, and send the user the thank you note with the link.... The biggest issue here is I am very ignorant when it comes to php

 

I really appreciate your time.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.