<?php
/* PHP Form Mailer - phpFormMailer v2.1, last updated 30th Nov 2005 - check back often for updates!
(easy to use and more secure than many cgi form mailers) FREE from:
www.TheDemoSite.co.uk
Should work fine on most Unix/Linux platforms */
// ------- three variables you MUST change below -------------------------------------------------------
$valid_ref1="http://lapattedouce.com/JP/contact.htm";// chamge "Your--domain" to your domain
$valid_ref2="http://www.lapattedouce.com/JP/contact.htm";// chamge "Your--domain" to your domain
$replyemail="gfjsagfjsgd@videotron.ca";//change to your email address
// ------------------------------------------------------------
//clean input in case of header injection attempts!
function clean_input_4email($value, $check_all_patterns = true)
{
$patterns[0] = '/content-type:/';
$patterns[1] = '/to:/';
$patterns[2] = '/cc:/';
$patterns[3] = '/bcc:/';
if ($check_all_patterns)
{
$patterns[4] = '/\r/';
$patterns[5] = '/\n/';
$patterns[6] = '/%0a/';
$patterns[7] = '/%0d/';
}
//NOTE: can use str_ireplace as this is case insensitive but only available on PHP version 5.0.
return preg_replace($patterns, "", strtolower($value));
}
$name = clean_input_4email($_POST["name"]);
$email = clean_input_4email($_POST["email"]);
$thesubject = clean_input_4email($_POST["thesubject"]);
$themessage = clean_input_4email($_POST["themessage"], false);
$error_msg='Erreur - message non envoyé - veuillez essayer de nouveau';
$success_sent_msg='<META HTTP-EQUIV="Refresh" CONTENT="3; URL=http://www.quetzalreptiles.ca">
<p align="center"><strong> </strong></p>
<p align="center"><strong>Votre message a été envoyé avec succès.<br><br>
</strong> Nous vous répondrons le plus tôt possible.</p>
<p align="center">Une copie de votre message vous a été envoyé.</p>
<p align="center">Merci de nous avoir contacté <br><br>Quetzal Reptiles! </p>
<p align="center"><a href="contact.htm">retour</a></p>';
$replymessage = "Bonjour $name
Merci d'avoir contacté Quetzal Reptiles.
Nous vous répondrons dans les plus brefs délais.
N'hésitez pas à visiter notre forum!
Merci de NE PAS répondre à ce courriel.
--------------------------------------------------
Subject: $thesubject
Query:
$themessage
--------------------------------------------------
Merci";
// email variable not set - load $valid_ref1 page
if (!isset($_POST['email']))
{
echo "<script language=\"JavaScript\"><!--\n ";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}
$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if($ref_page==$valid_ref1) $valid_referrer=1;
elseif($ref_page==$valid_ref2) $valid_referrer=1;
if(!$valid_referrer)
{
echo "<script language=\"JavaScript\"><!--\n alert(\"$error_msg\");\n";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}
$themessage = "name: $name \nQuery: $themessage";
mail("$replyemail",
"$thesubject",
"$themessage",
"From: $email\nReply-To: $email");
mail("$email",
"Receipt: $thesubject",
"$replymessage",
"From: $replyemail\nReply-To: $replyemail");
echo $success_sent_msg;
/*
PHP Form Mailer - phpFormMailer (easy to use and more secure than many cgi form mailers)
FREE from:
www.TheDemoSite.co.uk */
?>