diff --git a/.gitignore b/.gitignore index bf4148b..73e6db3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ AGENTS.md in-dir/ out-dir/ +contact.php thumbs/ *.log cache/ diff --git a/contact.php.example b/contact.php.example new file mode 100644 index 0000000..08da800 --- /dev/null +++ b/contact.php.example @@ -0,0 +1,89 @@ +'; + +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $form_name = trim((string)($_POST['name'] ?? '')); + $form_email = trim((string)($_POST['email'] ?? '')); + $form_message = trim((string)($_POST['message'] ?? '')); + $honeypot = trim((string)($_POST['website'] ?? '')); + + if ($honeypot !== '') { + // This was likely a bot, fail silently but look like a success. + $msg = "Thank you for your message!"; + } elseif ($form_name === '' || $form_email === '' || $form_message === '') { + $err = "Please fill out all required fields."; + } elseif (!filter_var($form_email, FILTER_VALIDATE_EMAIL)) { + $err = "Please provide a valid email address."; + } else { + $subject = "MVLog Contact Form Submission from " . $form_name; + $body = "Name: " . $form_name . "\n"; + $body .= "Email: " . $form_email . "\n\n"; + $body .= "Message:\n" . str_replace(["\r\n", "\r"], "\n", $form_message); + + $headers = "From: " . $form_name . " <" . $form_email . ">\r\n"; + $headers .= "Reply-To: " . $form_email . "\r\n"; + $headers .= "X-Mailer: PHP/" . phpversion(); + + if (mail($to_email, $subject, $body, $headers)) { + $msg = "Thank you for your message! I will get back to you shortly."; + $form_name = $form_email = $form_message = ''; // Clear form on success + } else { + $err = "Sorry, there was an error sending your message. Please try again later."; + } + } +} + +$headerTitles = [ 'Moto Vlog', 'Multiple Voices Log', 'Multi-Version Log', 'MultiVerse Log', 'Miles & Views Log', 'Moving Vistas Log', 'Motorcycle Voyage Log', 'Mapped Vagabond Log', 'Mountain Valley Log', 'Miles Versus Logic', 'Motorcycle Voyage Log', 'Mapped Vagabond Log', 'Multiple Viewpoints Log', 'Multiple Versions of Life', 'Motion, Velocity & Luck', 'Miles, Views & Life', 'Many Voices of Life', 'Many Views of Life', 'Modern Vagabond Log', 'Motorcycle Wanderlust Log', 'Mapped Wanderings Log', 'Miles Beyond Reason', 'Miles Beyond Reality', 'Motion, Velocity & Lunacy', 'Miles, Wind & Luck', 'Maps, Villages & Legends', 'Multi-Vision Log', 'Multi-Vista Log', 'Mutable View Log', 'Mistakes, Victories & Lessons', 'Mostly Verified Legends', 'Mostly Vague Logistics', 'Marginally Viable Leadership', 'Mileage Versus Luck', 'Mechanical Violence Log', 'Moderately Violent Leisure', 'Mistakes Validated Later', ]; +$siteHeaderTitle = $headerTitles[array_rand($headerTitles)]; +?> + + +
+ + +