Hi all,
I'm not a coder or developer, I know absolutely bugger all about PHP I'm just a tinkerer that is about to get into trouble. Having FTP down a PHP form and deleted the cc address, I've forgotten the syntax to get it working again, I've been trawling all day to try to work it out but to no avail.
Please can anyone help?
everything on this form works ok (I think) except the need to cc to somebody else.
<?PHP
session_start();
//Encrypt the posted code field and then compare with the stored key
if(md5($_POST['veri']) != $_SESSION['key'])
{
header("Location: callback.php");
}else{
function preprocessHeaderField($value)
{
//Remove line feeds
$ret = str_replace("\\r", "", $value);
$ret = str_replace("\\n", "", $ret);
// Remove injected headers
$find = array("/bcc\:/i",
"/Content\-Type\:/i",
"/Mime\-Type\:/i",
"/cc\:/i",
"/to\:/i");
$ret = preg_replace($find,
"**bogus header removed**",
$ret);
return $ret;
}
if($_REQUEST){
$msg="Form Submission:\n\n";
foreach ($_REQUEST as $key => $value)
{
$value = preprocessHeaderField($value);
$message.=$key.": ".$value."\n";
}
$message .="\nDO NOT REPLY TO THIS EMAIL\n\n**ENDS**";
# Enter the email address below - leave the "; on the end!
$to="me@myplace.co.uk";
#$to="you@yours.com";
$subject='from: Our Service';
$headers = "From: Enquiry <$to> \n";
$headers .= "X-Mailer: PHP\n";
$headers .= "Return-Path:<PHP>\n";
$headers .="From: FREE Special Report <info@myplace.co.uk>\r\n";
#$headers .= "bcc: my1@myotherplace.co.uk\n";
mail($to,$subject,$message, $headers) or print "Could not send mail";
# Enter the thank you page address below...
include('thanks.html');
}
}
?>
Respect the pro in his chosen field