저는 PHP에 익숙하지 않습니다. 이메일을 보내려면 홈페이지에 간단한 양식을 사용하고 있습니다.PHP 메일()을 철저히 확인했지만 빈 메일을받습니다.
<form data-abide action="anfrage.php" method="post">
\t <fieldset>
\t \t <div class="row">
\t \t \t <div class="large-12 columns">
\t \t \t \t <label>Firma
\t \t \t \t \t <input type="text" name="firm" placeholder="Firma" />
\t \t \t \t </label>
\t \t \t </div>
\t \t </div>
\t \t <div class="row">
\t \t \t \t <div class="large-4 columns">
\t \t \t \t \t <label>Anrede
\t \t \t \t \t \t <select name="salutation">
\t \t \t \t \t \t \t <option value="-">-</option>
\t \t \t \t \t \t \t <option value="Herr">Herr</option>
\t \t \t \t \t \t \t <option value="Frau">Frau</option>
\t \t \t \t \t \t </select>
\t \t \t \t \t </label>
\t \t \t \t </div>
\t \t \t <div class="large-8 columns">
\t \t \t \t <label>Name <small>benötigt</small>
\t \t \t \t \t <input type="text" name="name" placeholder="Ansprechpartner" required pattern="[a-zA-Z]+">
\t \t \t \t </label>
\t \t \t \t <small class="error">Bitte geben Sie einen Ansprechpartner an!</small>
\t \t \t </div>
\t \t </div>
\t \t <div class="row">
\t \t \t <div class="large-4 columns">
\t \t \t \t <label>Adresse <small>benötigt</small>
\t \t \t \t \t <input type="text" name="address" placeholder="Strasse, PLZ, Stadt" />
\t \t \t \t </label>
\t \t \t \t <small class="error">Bitte geben Sie eine Adresse an!</small>
\t \t \t </div>
\t \t \t <div class="large-4 columns">
\t \t \t \t <label>eMail <small>benötigt</small>
\t \t \t \t \t <input type="eMail" name="email" placeholder="eMail" required/>
\t \t \t \t </label>
\t \t \t \t <small class="error">Bitte geben Sie eine gültige eMail-Adresse an!</small>
\t \t \t </div>
\t \t \t <div class="large-4 columns">
\t \t \t \t <label>Telefon <small>benötigt</small>
\t \t \t \t \t <input type="text" name="phoneno" placeholder="..." required/>
\t \t \t \t </label>
\t \t \t \t <small class="error">Bitte geben Sie eine gültige Telefonnummer an!</small>
\t \t \t </div>
\t \t </div>
\t \t <div class="row">
\t \t \t <div class="large-6 columns">
\t \t \t \t <label>Art der Anfrage</label>
\t \t \t \t <input type="radio" name="radio" id="dryhire" value="Vermietung"><label for="dryhire">Vermietung</label>
\t \t \t \t <input type="radio" name="radio" id="event" value="Veranstaltung"><label for="event">Veranstaltung</label>
\t \t \t \t <input type="radio" name="radio" id="consultation" value ="Beratung"><label for="consultation">Beratung</label>
\t \t \t </div>
\t \t </div>
\t \t <div class="row">
\t \t \t <div class="large-12 columns">
\t \t \t \t <label>Was können wir für Sie tun?<small>benötigt</small>
\t \t \t \t \t <textarea name="text" placeholder="Erläutern Sie uns kurz was Sie wann und wo benötigen." required pattern=""></textarea>
\t \t \t \t </label>
\t \t \t \t <small class="error">Bitte erläutern Sie kurz Ihr Anliegen!</small>
\t \t \t </div>
\t \t </div>
\t \t <div class="antispam">Wenn Sie kein Roboter sind lassen sie diesen Bereich einfach leer: <input type="text" name="url" /></div>
\t \t <button class="large-12 columns button" type="submit">ANFRAGEN</button>
\t </fieldset>
</form>
anfrage.php
은 다음과 같습니다 : 이럴 빈 이메일 내게 통해 얻을해야하지만
<?php
$to = "[email protected]";
$subject = $_POST["radio"];
$email = $_POST["email"];
$returnPage = 'http://myhomepage.de#success';
$returnErrorPage = 'http://myhomepage.de#error';
$dodgy_strings = array(
"content-type:"
,"mime-version:"
,"multipart/mixed"
,"bcc:"
);
function is_valid_email($email) {
return preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~][email protected]([0-9.]+|([^\s]+\.+
[a-z]{2,6}))$#si', $email);
}
function contains_bad_str($str_to_test) {
$bad_strings = array(
"content-type:"
,"mime-version:"
,"multipart/mixed"
,"Content-Transfer-Encoding:"
,"bcc:"
,"cc:"
,"to:"
);
foreach($bad_strings as $bad_string) {
if(eregi($bad_string, strtolower($str_to_test))) {
header("Location: " . $returnErrorPage);
exit;
}
}
}
function contains_newlines($str_to_test) {
if(preg_match("/(%0A|%0D|\\n+|\\r+)/i", $str_to_test) != 0) {
header("Location: " . $returnErrorPage);
exit;
}
}
function isEmpty($str_to_test){
return preg_match('/\S/', $str_to_test);
}
function checkFormCompletion($str_to_test){
contains_bad_str($str_to_test);
if(isEmpty($str_totest)){
header("Location: " . $returnErrorPage);
exit;
}
else
return $str_to_test;
}
if($_SERVER['REQUEST_METHOD'] != "POST"){
header("Location: " . $returnErrorPage);
exit;
}
if (!is_valid_email($email)) {
header("Location: " . $returnErrorPage);
exit;
}
$body .= "Firma: " .checkFormCompletion($_POST['firm']);
$body .= "\n";
$body .= "Ansprechpartner: " .checkFormCompletion($_POST['salutation']) ." "
.checkFormCompletion($_POST['name']);
$body .= "\n";
$body .= "Adresse: " .checkFormCompletion($_POST['address']);
$body .= "\n";
$body .= "Telefonnummer: " .checkFormCompletion($_POST['phoneno']);
$body .= "\n";
$body .= "\n";
$body .= "Anfrage: " .checkFormCompletion($_POST['text']);
contains_bad_str($email);
contains_bad_str($subject);
contains_newlines($email);
contains_newlines($subject);
checkFormCompletion($subject);
if(isset($_POST['url']) && $_POST['url'] == ''){
$mailSent = @mail($to, $subject, $body, "From: ".$email);
}
else {
header("Location: " . $returnErrorPage);
}
if($mailSent == TRUE) {
header("Location: " . $returnPage);
} else {
header("Location: " . $returnErrorPage);
}
exit();
?>
, 내가 점점 계속
이
양식입니다 다음과 같은 이메일 :To: [email protected]
From: [email protected]
Subject:
Body:
Firma:
Ansprechpartner: Herr 59d4f7714f4d7
Adresse:
Telefonnummer:
Anfrage:
Someties 하루에 단지 하나의 이메일입니다. 때로는 30 이상입니다.
나는 왜 나는 그 전자 메일을 계속 받고 있는지 잘 모른다. 피하는 방법을 알고 있습니까? 또는 anfrage.php에 보안 문제가있는 곳을 알고 계십니까?
미리 감사드립니다.
어쨌든 스팸이라는 것을 알기에 첫 번째 시도는 보안 문자 (기본 사항) 여야합니다. - 양식 검사 논리는 따라 가기가 조금 어렵습니다. 너무 많은 로컬 바. '$ _POST'에서 직접 작업하고 함수를 통해 /을 실행하고 최종 템플릿을 생성하기 위해 일부 해시를 사용해야합니다. - 그렇지 않으면 : POST 값과 최종 $ body 결과로 로그 파일을 만들도록하십시오. – mario