Contact form
if (isset($_POST['submit_x'])){
$mesaj = ""; $err=0;
$nume =$_POST['nume'];
$adresa = $_POST['email'];
$text = $_POST['text'];
$cod = $_POST['cod'];
$ip = $_SERVER['REMOTE_ADDR'];
if ($nume == "" || $nume == "Name"){
$mesaj = "Fill in your name!";
$err=1;
}
if (!$err && ($adresa == "" || $adresa == "E-mail")){
$mesaj = "Fill in your email address!";
$err=1;
}
if (!$err && ($text == "" || $text == "Your message" && $mesaj == "")){
$mesaj = "Fill in your message!";
$err=1;
}
if (strtolower($cod) != strtolower($_SESSION['captcha']) && $mesaj == ""){
$mesaj = "Incorrect captcha code!";
}
if ($mesaj ==""){
$email="$adresa";
$name="$nume";
$To = "office@mobilier-de-baie.ro";
$text = nl2br($text);
// Setarile mailului
$headers = "From: $name <$email>\n";
$headers .= "X-Sender: <$email>\n";
$headers .= "X-Mailer: IWS\n"; // mailer
//$headers .= "X-Priority: 1\n"; // Urgent message
$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type // Asta-i pentru mail in format HTML
$Body = "Name: $nume\n
Email: $email\n
Message: $text\n\n
---------------
IP: $ip
"; $Subject = "Contact form on ".$_SERVER['SERVER_NAME']; if (@mail($To, $Subject, $Body, $headers)) { echo "Your message has been sent!
"; unset($_SESSION['captcha']); unset($_POST); $nume =""; $telefon = ""; $adresa = ""; $text = ""; } else { echo "Your message could not be sent!
"; } }else{ echo "$mesaj
"; } } ?>
Email: $email\n
Message: $text\n\n
---------------
IP: $ip
"; $Subject = "Contact form on ".$_SERVER['SERVER_NAME']; if (@mail($To, $Subject, $Body, $headers)) { echo "Your message has been sent!
"; unset($_SESSION['captcha']); unset($_POST); $nume =""; $telefon = ""; $adresa = ""; $text = ""; } else { echo "Your message could not be sent!
"; } }else{ echo "$mesaj
"; } } ?>