How would I do a BCC for the code below?
<?php
$Name = $_REQUEST['Name'] ;
$Email = $_REQUEST['Email'] ;
$Query = $_REQUEST['Query'] ;
$flag="OK"; // This is the flag and we set it to OK
$msg=""; // Initializing the message to hold the error messages
if(strlen($Name) < 5){ // checking the length of the entered userid and it must be more than 5 character in length
$msg=$msg."<strong>Please make sure you enter your full name</strong><br />";
$flag="NOTOK"; //setting the flag to error flag.
}
if(stristr($Name,"Your name")){ //
//if($Name="Your name"){ //
$msg=$msg."<strong>Please make sure your name is not the default in the text field</strong><br />";
$flag="NOTOK"; //setting the flag to error flag.
}
if(strlen($Email) < 1){ //
$msg=$msg."<strong>Please enter an email</strong><br />";
$flag="NOTOK"; //setting the flag to error flag.
}
if (!stristr($Email,"@") OR !stristr($Email,".")) {
$msg=$msg."<strong>Please make sure you enter a valid email</strong><br />";
$flag= "NOTOK";} //setting the flag to error flag.
if(strlen($Query) < 10){ //
$msg=$msg."<strong>Please enter a valid query</strong><br />";
$flag="NOTOK"; //setting the flag to error flag.
}
//if($Query="Enter your message here to contact us"){ //
if(stristr($Query,"Enter your message here to contact us")){ //
$msg=$msg."<strong>Please make sure your comments are not the default comments in the text field</strong><br />";
$flag="NOTOK"; //setting the flag to error flag.
}
if($flag <>"OK"){
echo "<p>Please click on the browser back button and make the following changes;</p><p>$msg </p>";
}else{
$my_email = "myemail@emailaddress.com";
if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}
$disallowed_name = array(':',';',"'",'"','=','(',')','{','}','@');
foreach($disallowed_name as $value)
{
if(stristr($_POST[Name],$value)){header("location: $_SERVER[HTTP_REFERER]");exit;}
}
$disallowed_email = array(':',';',"'",'"','=','(',')','{','}');
foreach($disallowed_email as $value)
{
if(stristr($_POST,$value)){header("location: $_SERVER[HTTP_REFERER]");exit;}
}
$message = "";
while(list($key,$value) = each($_POST)){if(!(empty($value))){$set=1;}$message = $message . "$key: $value\n\n";} if($set!==1){header("location: $_SERVER[HTTP_REFERER]");exit;}
$message = $message . "";
$message = stripslashes($message);
$subject = "Enquiry";
$headers = "From: " . $_POST['Email'] . "\n" . "Return-Path: " . $_POST['Email'] . "\n" . "Reply-To: " . $_POST['Email'] . "\n";
?>
<h4>Thank you <?php print stripslashes($_POST['Name']); ?>.</h4>
<p>Your query has been sent and will be replied to if necessary.</p>
<?
mail($my_email,$subject,$message,$headers);
}
?>
thanks.
<?php
$Name = $_REQUEST['Name'] ;
$Email = $_REQUEST['Email'] ;
$Query = $_REQUEST['Query'] ;
$flag="OK"; // This is the flag and we set it to OK
$msg=""; // Initializing the message to hold the error messages
if(strlen($Name) < 5){ // checking the length of the entered userid and it must be more than 5 character in length
$msg=$msg."<strong>Please make sure you enter your full name</strong><br />";
$flag="NOTOK"; //setting the flag to error flag.
}
if(stristr($Name,"Your name")){ //
//if($Name="Your name"){ //
$msg=$msg."<strong>Please make sure your name is not the default in the text field</strong><br />";
$flag="NOTOK"; //setting the flag to error flag.
}
if(strlen($Email) < 1){ //
$msg=$msg."<strong>Please enter an email</strong><br />";
$flag="NOTOK"; //setting the flag to error flag.
}
if (!stristr($Email,"@") OR !stristr($Email,".")) {
$msg=$msg."<strong>Please make sure you enter a valid email</strong><br />";
$flag= "NOTOK";} //setting the flag to error flag.
if(strlen($Query) < 10){ //
$msg=$msg."<strong>Please enter a valid query</strong><br />";
$flag="NOTOK"; //setting the flag to error flag.
}
//if($Query="Enter your message here to contact us"){ //
if(stristr($Query,"Enter your message here to contact us")){ //
$msg=$msg."<strong>Please make sure your comments are not the default comments in the text field</strong><br />";
$flag="NOTOK"; //setting the flag to error flag.
}
if($flag <>"OK"){
echo "<p>Please click on the browser back button and make the following changes;</p><p>$msg </p>";
}else{
$my_email = "myemail@emailaddress.com";
if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}
$disallowed_name = array(':',';',"'",'"','=','(',')','{','}','@');
foreach($disallowed_name as $value)
{
if(stristr($_POST[Name],$value)){header("location: $_SERVER[HTTP_REFERER]");exit;}
}
$disallowed_email = array(':',';',"'",'"','=','(',')','{','}');
foreach($disallowed_email as $value)
{
if(stristr($_POST,$value)){header("location: $_SERVER[HTTP_REFERER]");exit;}
}
$message = "";
while(list($key,$value) = each($_POST)){if(!(empty($value))){$set=1;}$message = $message . "$key: $value\n\n";} if($set!==1){header("location: $_SERVER[HTTP_REFERER]");exit;}
$message = $message . "";
$message = stripslashes($message);
$subject = "Enquiry";
$headers = "From: " . $_POST['Email'] . "\n" . "Return-Path: " . $_POST['Email'] . "\n" . "Reply-To: " . $_POST['Email'] . "\n";
?>
<h4>Thank you <?php print stripslashes($_POST['Name']); ?>.</h4>
<p>Your query has been sent and will be replied to if necessary.</p>
<?
mail($my_email,$subject,$message,$headers);
}
?>
thanks.