Я искал сценарий в Интернете, чтобы отправить форму на ваш адрес электронной почты. Но когда я нажимаю кнопку отправки, я приду на страницу благодарности. Поэтому следовало отправить его. Но это не так. Может кто-нибудь помочь мне?Почему мой почтовый скрипт не работает?
Отправить Сценарий:
<?php
/*
This first bit sets the email address that you want the form to be submitted to.
You will need to change this value to a valid email address that you can access.
*/
$webmaster_email = "[email protected]";
/*
This bit sets the URLs of the supporting pages.
If you change the names of any of the pages, you will need to change the values here.
*/
$feedback_page = "feedback_form.html";
$error_page = "error_message.html";
$thankyou_page = "thank_you.html";
/*
This next bit loads the form field data into variables.
If you add a form field, you will need to add it here.
*/
$naam = $_REQUEST['naam'] ;
$wedstrijd1 = $_REQUEST['wedstrijd1'] ;
$wedstrijd2 = $_REQUEST['wedstrijd2'] ;
$wedstrijd3 = $_REQUEST['wedstrijd3'] ;
$wedstrijd4 = $_REQUEST['wedstrijd4'] ;
/*
The following function checks for email injection.
Specifically, it checks for carriage returns - typically used by spammers to inject a CC list.
*/
function isInjected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str)) {
return true;
}
else {
return false;
}
}
// If the user tries to access this script directly, redirect them to the feedback form,
if (!isset($_REQUEST['naam'])) {
header("Location: $feedback_page");
}
// If the form fields are empty, redirect to the error page.
elseif (empty($naam) || empty($wedstrijd1) || empty($wedstrijd2) || empty($wedstrijd3) || empty($wedstrijd4)) {
header("Location: $error_page");
}
// If email injection is detected, redirect to the error page.
elseif (isInjected($naam)) {
header("Location: $error_page");
}
// If we passed all previous tests, send the email then redirect to the thank you page.
else {
mail("$webmaster_email", "Nieuwe voorspelling ingestuurd!",
$naam,
$wedstrijd1,
$wedstrijd2,
$wedstrijd3,
$wedstrijd4);
header("Location: $thankyou_page");
}
?>
Но когда я удалить все «wedstrijd» 1, 2, 3 и 4 электронная почта будет отправлять. Код, где я говорю: // Если мы прошли все предыдущие тесты, отправьте электронное письмо, а затем перенаправите страницу благодарности. еще { почты ("$ webmaster_email", "Ньив voorspelling ingestuurd!", $ НА, $ wedstrijd1, $ wedstrijd2, $ wedstrijd3, $ wedstrijd4); header ("Местоположение: $ thankyou_page"); } – change1001
@ change1001 Вы отправляете его из своего дома с помощью сервера разработки? –
@AJHenderson Итак, как мне исправить это? (ответ на ваше редактирование) – change1001