Formular de contact
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 == "Nume"){
$mesaj = "Introduceti numele!";
$err=1;
}
if (!$err && ($adresa == "" || $adresa == "E-mail")){
$mesaj = "Introduceti adresa de email!";
$err=1;
}
if (!$err && ($text == "" || $text == "Mesaj" && $mesaj == "")){
$mesaj = "Introduceti textul mesajului!";
$err=1;
}
if (strtolower($cod) != strtolower($_SESSION['captcha']) && $mesaj == ""){
$mesaj = "Codul de securitate incorect!";
}
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 = "Nume: $nume\n
Email: $email\n
Mesaj: $text\n\n
---------------
IP: $ip
"; $Subject = "Formular de contact de pe ".$_SERVER['SERVER_NAME']; if (@mail($To, $Subject, $Body, $headers)) { echo "Mesajul a fost trimis!
"; unset($_SESSION['captcha']); unset($_POST); $nume =""; $telefon = ""; $adresa = ""; $text = ""; } else { echo "Mesajul nu a putut fi trimis!
"; } }else{ echo "$mesaj
"; } } ?>
Email: $email\n
Mesaj: $text\n\n
---------------
IP: $ip
"; $Subject = "Formular de contact de pe ".$_SERVER['SERVER_NAME']; if (@mail($To, $Subject, $Body, $headers)) { echo "Mesajul a fost trimis!
"; unset($_SESSION['captcha']); unset($_POST); $nume =""; $telefon = ""; $adresa = ""; $text = ""; } else { echo "Mesajul nu a putut fi trimis!
"; } }else{ echo "$mesaj
"; } } ?>