39 lines
997 B
PHP
Executable File
39 lines
997 B
PHP
Executable File
<?php
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
|
|
exit("Invalid request");
|
|
}
|
|
|
|
/* Honeypot spam protection */
|
|
if (!empty($_POST['website'])) {
|
|
exit; // silently drop bot submission
|
|
}
|
|
|
|
/* Safely read form fields */
|
|
$first_name = htmlspecialchars($_POST['first_name'] ?? '');
|
|
$last_name = htmlspecialchars($_POST['last_name'] ?? '');
|
|
|
|
$drinks = isset($_POST['drinks']) ? implode(", ", $_POST['drinks']) : "None";
|
|
$allergies = htmlspecialchars($_POST['allergies'] ?? '');
|
|
|
|
if (!$first_name || !$last_name) {
|
|
exit("Missing required fields");
|
|
}
|
|
|
|
/* Email setup */
|
|
$to = "hochzeit@markinstefan.xyz";
|
|
$subject = "New Wedding RSVP from $first_name $last_name";
|
|
|
|
$message = "Name: $first_name $last_name\n";
|
|
$message .= "Drinks: $drinks\n";
|
|
$message .= "Allergies: $allergies\n";
|
|
|
|
$headers = "From: no-reply@markinstefan.xyz\r\n";
|
|
$headers .= "Reply-To: no-reply@markinstefan.xyz\r\n";
|
|
|
|
/* Send mail */
|
|
mail($to, $subject, $message, $headers);
|
|
|
|
echo "Thank you! Your RSVP has been sent.";
|
|
?>
|