<?php
// remember to replace your@email.com with your own email address lower in this code.
// load the variables form address bar
$name = $_REQUEST["name"];
$from = $_REQUEST["from"];
$mobile = $_REQUEST["mobile"];
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$verif_box = $_REQUEST["verif_box"];
// remove the backslashes that normally appears when entering " or '
$name = stripslashes($name);
$from = stripslashes($from);
$mobile = stripslashes($mobile);
$message = stripslashes($message);
$subject = stripslashes($subject);
$edhavadhu = dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
//echo "if";
// if verification code was correct send the message and show this page
$message = "Como nos conocistes: ".$subject."\n".$message;
$message = "Email: ".$from."\n".$message;
$message = "Mobile: ".$mobile."\n".$message;
$message = "Name: ".$name."\n".$message;
mail("mymail@gmail.com", 'Asunto: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");
header("Location:".$edhavadhu."/contactar.php?sucess=true");
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
} else {
// if verification code was incorrect then return to contact page and show error
header("Location:".$edhavadhu."/contactar.php?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
}
?>