Kod: Zaznacz cały
<?php $header = 'Reply-to: luk@lukastransport.cba.pl' . "\r\n";
$header .= 'From: luk@lukastransport.cba.pl' . "\r\n";
$header .= 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$to = 'luk@lukastransport.cba.pl';
$subject = 'LUKAS TRANSPORT';
$contact_submitted = '<p style="color: #888;">Twoja wiadomosc zostala wyslana.</p>';
// Do not amend anything below here, unless you know PHP
function email_is_valid($email) {
return preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',$email);
}
if (!email_is_valid($to)) {
echo '<p style="color: red;">You must set-up a valid (to) email address before this contact page will work.</p>';
}
if (isset($_POST['submit'])) {
$return = "::::::";
$youremail = trim(htmlspecialchars($_POST['email']));
$yourname = stripslashes(strip_tags($_POST['name']));
$yourmessage = stripslashes(strip_tags($_POST['message'])); $contactemail = "Email:".$youremail;
$contact_name = "Imię i Nazwisko:".$yourname;
$message_text = "Wiadomość: ".$yourmessage;
$user_answer = trim(htmlspecialchars($_POST['user_answer']));
$answer = trim(htmlspecialchars($_POST['answer']));
$message = "<p style='color:#555;'>$contact_name</p><p style='color:#555;'>$contactemail</p><p style='color:#555;'>$message_text</p>";
if (email_is_valid($youremail) && !eregi("\r",$youremail) && !eregi("\n",$youremail) && $yourname != "" && $yourmessage != "" ) {
mail($to,$subject,$message,$header);
$yourname = '';
$youremail = '';
$yourmessage = '';
echo '<p style="color: blue;">'.$contact_submitted.'</p>';
}
else echo '<p style="color: #888;">Uzupełnij wszystkie pola formularza.</p>';
}
$number_1 = rand(1, 9);
$number_2 = rand(1, 9);
$answer = substr(md5($number_1+$number_2),5,10); include ('email.html');
?>