Files
markinstefan.xyz/public/rsvp-submit.php
T
2026-05-16 22:22:24 +02:00

39 lines
993 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@yourdomain.com\r\n";
$headers .= "Reply-To: no-reply@yourdomain.com\r\n";
/* Send mail */
mail($to, $subject, $message, $headers);
echo "Thank you! Your RSVP has been sent.";
?>