잘가던 폼메일이 갑자기 안날라가네요.. 왜 그럴까요? 채택완료
지음ad
7년 전
조회 1,891
</p>
<p><meta charset="utf-8">
<?php
if(isset($_POST['first_name'])) {
$email_to = "test@naver.com";
$email_subject = "[폼메일] 카카오톡 DB입니다.";
$email_subject = '=?UTF-8?B?'.base64_encode($email_subject).'?=';</p>
<p> function died($error)
{echo "<script> alert('".$error."');";
echo "history.go(-1);";
echo "</script>";
die();}
if (!isset($_POST['first_name']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])
)
{died('We are sorry, but there appears to be a problem with the form you submitted.');}
$first_name = $_POST['first_name'];
$telephone = $_POST['telephone'];
$comments = $_POST['comments'];
$error_message = "";</p>
<p>$brake = "http";
if(strpos($comments, $brake) !== false)
{$error_message = "잘못된 문자열이 포함되어 있습니다";
echo $error_message;}
if(strlen($first_name) < 1)
{$error_message .= '이름을 입력해 주십시오.\n';}</p>
<p> $telephone_exp = '/^[0-9]{9,11}$/';
if(!preg_match($telephone_exp,$telephone))
{$error_message .= '-를 제외한 9-11자리의 연락처를 입력해 주십시오.\n';}
if(strlen($comments) < 1)
{$error_message .= '문의내용을 입력해 주십시오.';}</p>
<p> $chk = $_POST['chk'];
if (!$chk)
{$error_message = '개인정보수집에 동의해 주십시오.';}</p>
<p> if(strlen($error_message) > 0)
{died($error_message);}
$email_message = "";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "이름 : ".clean_string($first_name)."\n\n";
$email_message .= "연락처 : ".clean_string($telephone)."\n\n";
$email_message .= "문의사항 : ".clean_string($comments)."\n\n";
// create email headers
$headers = 'From: '.$email_from;
// 제목이 깨질경우 아래 캐릭터셋 적용</p>
<p>@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
<script>
alert ("견적상담 접수가 완료되었습니다.\n빠른 시간 내에 확인 후 \n연락드리겠습니다. 감사합니다.");
window.open("test");
</script>
<?php
}
?></p>
<p>
잘가던 폼메일이 갑자기 안날라가네요.. 왜 그럴까요?
도움부탁드립니다...
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
답변을 작성하려면 로그인이 필요합니다.
로그인