안녕하세요 저는 초보자 용 웹 코더이며 최근에 클라이언트 용 사이트를 설계하고 코딩했습니다. 그들은 연락처 페이지의 양식에 파일 첨부 파일 업로드 기능이 있는지 묻습니다. 저는 PHP에 너무 익숙하지 않지만 약간의 조사를했고, 온라인으로 코딩을 찾아 내 사이트에서 구현했습니다. 수신자로 전자 메일을 삽입하고 양식을 실시간으로 테스트했으며 첨부 파일이 정상적으로 작동하여 파일이 통과 할 수 있도록했습니다. 그러나 내 이메일 계정 (gmail)에 메시지가 나타날 때 경고 메시지가 표시되는 것 같습니다.첨부 파일이있는 양식 첨부 된 결과가
"이 메시지에주의하십시오. 유사한 메시지가 사람의 개인 정보를 도용하는 데 사용되었습니다. 링크를 클릭하거나 개인 정보를 회신하지 마십시오. "
제 질문은이 경고를 피하는 방법입니다. 전자 메일을 수신자로 변경하면 고객이이 경고를 처리하지 않아도됩니다. 또한 나는 이미 비디오 게임 - 스팸을 재생하도록 요청하는 임의의 사람으로부터 이메일을 받았습니다. 어떻게 이것을 피할 수 있습니까? (나는 recaptcha를 구현하려고 시도했지만 읽는 것이 매우 어렵 기 때문에이 팬이 아닙니다.)
또한 수신 이메일에 "name"과 "email"을 입력하라는 입력 필드가 표시되지 않는 이유는 무엇입니까? ? 내 "이메일"필드 정보 만 내 이메일로 전달됩니다.
도움을 주시면 대단히 감사하겠습니다. 미리 감사드립니다.
내가 현재 가지고있는 PHP 파일은 어느 정도 작동하고있는 것으로 보인다.
<?php
if(isset($_POST['submit']))
{
//The form has been submitted, prep a nice thank you message
$output = '<h1>Thanks for your file and message!</h1>';
//Set the form flag to no display (cheap way!)
$flags = 'style="display:none;"';
//Deal with the email
$to = '[email protected]';
$subject = 'a file for you';
$message = strip_tags($_POST['message']);
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$attachment = chunk_split(base64_encode(file_get_contents($_FILES['file']['tmp_name'])));
$filename = $_FILES['file']['name'];
$boundary =md5(date('r', time()));
$headers = "From: netzeroliving.ca\r\nReply-To: netzeroliving.ca";
$headers .= "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"_1_$boundary\"";
$message="This is a multi-part message in MIME format.
--_1_$boundary
Content-Type: multipart/alternative; boundary=\"_2_$boundary\"
--_2_$boundary
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
$message
--_2_$boundary--
--_1_$boundary
Content-Type: application/octet-stream; name=\"$filename\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
$attachment
--_1_$boundary--";
mail($to, $subject, $message, $headers);
}
?>
^^^ 나는이는 body 태그 내에 배치 또는 ^^^하지 할 필요가있는 경우 위의 PHP 코딩이 ... body 태그의 외부 확실하지 배치되는 점에 유의해야한다
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" <?php echo $flags;?>>
<p class="name">
<input type="text" name="name" id="name" />
<label for="name">Name</label>
</p>
<p class="email">
<input type="text" name="email" id="email" />
<label for="email">E-mail</label>
</p>
<p>
<label for="message">Message</label>
<textarea name="message" id="message" cols="20" rows="8"></textarea>
</p>
<p>
<label for="file">File</label>
<input type="file" name="file" id="file">
</p>
<p>
<input type="submit" name="submit" id="submit" value="send">
</p>
</form>
^^^ 위의 코드는 body 태그 내에 있습니다. ^^^