나는 PHP 메일 양식으로 작업하고 있으며 지금까지는 모두 잘 작동하고 있습니다. 그것은 체크 박스 결과를 제외한 폼에서 모든 것을 반환합니다. 그들을 위해, 그것은 단지 '배열'을 말한다. 수정 프로그램을 찾기 위해 높거나 낮은 항목을 검색했지만 온라인에서 찾은 솔루션을 사용하여 작동시키지 못하는 것 같습니다. 문제의 일부는 내가 메일 양식에 코드를 넣을 위치를 100 % 확신하지 못한다는 것입니다. 내 PHP 메일 양식은 다음과 같습니다 :체크 박스 결과를 표시하는 PHP 메일 양식
<?php
// OPTIONS - PLEASE CONFIGURE THESE BEFORE USE!
$yourEmail = "[email protected]"; // the email address you wish to receive these mails through
$yourWebsite = "My Website name"; // the name of your website
$thanksPage = 'thanks.php'; // URL to 'thanks for sending mail' page; leave empty to keep message on the same page
$maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4
// --- DO NOT EDIT BELOW HERE -----------------------
$error_msg = null;
$result = null;
function isBot()
{
$bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot");
$isBot = false;
foreach ($bots as $bot) {
if (strpos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) $isBot = true;
}
if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ") $isBot = true;
exit("Bots not allowed.</p>");
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
function clean($data)
{
$data = trim(stripslashes(strip_tags($data)));
return $data;
}
$points = (int)0;
$badwords = array("adult", "beastial", "bestial", "blowjob", "clit", "cum", "cunilingus", "cunillingus", "cunnilingus", "####", "ejaculate", "fag", "felatio", "fellatio", "####", "fuk", "fuks", "gangbang", "gangbanged", "gangbangs", "hotsex", "hardcode", "jism", "jiz", "orgasim", "orgasims", "orgasm", "orgasms", "phonesex", "phuk", "phuq", "porn", "pussies", "pussy", "spunk", "xxx", "viagra", "phentermine", "tramadol", "adipex", "advai", "alprazolam", "ambien", "ambian", "amoxicillin", "antivert", "blackjack", "backgammon", "texas", "holdem", "poker", "carisoprodol", "ciara", "ciprofloxacin", "debt", "dating", "porn", "link=", "voyeur");
$exploits = array("content-type", "bcc:", "cc:", "document.cookie", "onclick", "onload", "javascript");
foreach ($badwords as $word) {
if (strpos($_POST['message'], $word) !== false) $points += 2;
}
foreach ($exploits as $exploit) {
if (strpos($_POST['message'], $exploit) !== false) $points += 2;
}
if (strpos($_POST['message'], "http://") !== false || strpos($_POST['message'], "www.") !== false) $points += 2;
if (isset($_POST['nojs'])) $points += 1;
if (preg_match("/(<.*>)/i", $_POST['message'])) $points += 2;
if (strlen($_POST['name']) < 3) $points += 1;
if (strlen($_POST['message']) < 15 || strlen($_POST['message'] > 1500)) $points += 2;
foreach ($_POST as $key => $value) {
$_POST[$key] = trim($value);
}
if (empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) {
$error_msg .= "Name, e-mail and comments are required fields. \n";
} elseif (strlen($_POST['name']) > 15) {
$error_msg .= "The name field is limited at 15 characters. Your first name or nickname will do! \n";
} elseif (!preg_match("/^[a-zA-Z-'\s]*$/", stripslashes($_POST['name']))) {
$error_msg .= "The name field must not contain special characters. \n";
} elseif (!preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email']))) {
$error_msg .= "That is not a valid e-mail address. \n";
} elseif (!empty($_POST['url']) && !preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i', $_POST['url'])) {
$error_msg .= "Invalid website url.";
}
if ($error_msg == NULL && $points <= $maxPoints) {
$subject = "Desktop Support Form Email";
$message = "You received this e-mail message through your website: \n\n";
foreach ($_POST as $key => $val) {
$message .= ucwords($key) . ": " . clean($val) . "\r\n";
}
$message .= 'IP: ' . $_SERVER['REMOTE_ADDR'] . "\r\n";
if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
$headers = "From: $yourEmail \r\n";
$headers .= "Reply-To: {$_POST['email']}";
} else {
$headers = "From: $yourWebsite <$yourEmail> \r\n";
$headers .= "Reply-To: {$_POST['email']}";
}
if (mail($yourEmail, $subject, $message, $headers)) {
if (!empty($thanksPage)) {
header("Location: $thanksPage");
exit;
} else {
$result = 'Your mail was successfully sent.';
}
} else {
$error_msg = 'Your mail could not be sent this time.';
}
} else {
if (empty($error_msg)) {
$error_msg = 'Your mail looks too much like spam, and could not be sent this time. [' . $points . ']';
}
}
}
function get_data($var)
{
if (isset($_POST[$var])) echo htmlspecialchars($_POST[$var]);
}
내 HTML은 표준 요금입니다. 체크 박스에 'name = "feedback []"'을 지정했습니다. 이름을 동일하게 지정하고 대괄호를 사용하면 체크 상자 정보를 쉽게 전달할 수 있습니다. 나는 위 우편물 양식에 그것을 입력하는 방법을 모른다. 당신이 줄 수있는 도움에 미리 감사드립니다.
어떤'$ _POST' 변수 (들) 다음은 간단한 예입니다? –
양식을 보내기 위해 HTML, JS/jQuery를 사용한 다음 PHP에 print_r ($ _ POST)을 표시하면 우리에게 HTML, 모든 JS/jQuery를 표시 할 수 있습니까? –