<?php
/**
* Don Bosco Catholic Church Upper Hill, Nairobi
* process_booking.php - Handles Sacramental & Appointment Bookings
*/
// REPLACE WITH YOUR OFFICIAL PARISH EMAIL ADDRESS BELOW
$recipient_email = "YOUR_EMAIL_HERE@example.com";
$site_name = "Don Bosco Upper Hill Parish";
// Set JSON Header
header('Content-Type: application/json');
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
echo json_encode(['status' => 'error', 'message' => 'Invalid request method.']);
exit;
}
// Sanitize input values
$category = filter_input(INPUT_POST, 'category', FILTER_SANITIZE_SPECIAL_CHARS);
$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_SPECIAL_CHARS);
$time = filter_input(INPUT_POST, 'time', FILTER_SANITIZE_SPECIAL_CHARS);
$name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_SPECIAL_CHARS);
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$mobile = filter_input(INPUT_POST, 'mobile', FILTER_SANITIZE_SPECIAL_CHARS);
$notes = filter_input(INPUT_POST, 'notes', FILTER_SANITIZE_SPECIAL_CHARS);
// Validate Required Fields
if (!$category || !$date || !$time || !$name || !$email || !$mobile) {
echo json_encode(['status' => 'error', 'message' => 'Please complete all required fields correctly.']);
exit;
}
// Prepare Email Subject & Body
$subject = "New Booking Request [$category] - $name";
$email_content = "NEW SACRAMENTAL / PARISH APPOINTMENT BOOKING\n";
$email_content .= "===========================================\n\n";
$email_content .= "Category: $category\n";
$email_content .= "Requested Date: $date\n";
$email_content .= "Requested Time: $time\n\n";
$email_content .= "Applicant Name: $name\n";
$email_content .= "Email Address: $email\n";
$email_content .= "Mobile Number: $mobile\n\n";
$email_content .= "Additional Notes:\n" . ($notes ? $notes : "None provided.") . "\n\n";
$email_content .= "Submitted on: " . date("Y-m-d H:i:s") . "\n";
// Email Headers
$headers = "From: $site_name <noreply@donboscochurch.org>\r\n";
$headers .= "Reply-To: $name <$email>\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
// Send Email
if (mail($recipient_email, $subject, $email_content, $headers)) {
echo json_encode([
'status' => 'success',
'message' => 'Thank you! Your booking request for ' . htmlspecialchars($category) . ' has been sent to our parish office.'
]);
} else {
echo json_encode([
'status' => 'error',
'message' => 'Server mail error. Please contact the parish office directly via telephone.'
]);
}
?>
<?php
/**
* Don Bosco Catholic Church Upper Hill, Nairobi
* process_contact.php - Handles General Inquiries & Messages
*/
// REPLACE WITH YOUR OFFICIAL PARISH EMAIL ADDRESS BELOW
$recipient_email = "YOUR_EMAIL_HERE@example.com";
$site_name = "Don Bosco Upper Hill Parish";
// Set JSON Header
header('Content-Type: application/json');
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
echo json_encode(['status' => 'error', 'message' => 'Invalid request method.']);
exit;
}
// Sanitize input values
$name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_SPECIAL_CHARS);
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$mobile = filter_input(INPUT_POST, 'mobile', FILTER_SANITIZE_SPECIAL_CHARS);
$query = filter_input(INPUT_POST, 'query', FILTER_SANITIZE_SPECIAL_CHARS);
// Validate Required Fields
if (!$name || !$email || !$mobile || !$query) {
echo json_encode(['status' => 'error', 'message' => 'Please fill in all required fields.']);
exit;
}
// Prepare Email Subject & Body
$subject = "Parish Contact Inquiry from $name";
$email_content = "DON BOSCO PARISH WEBSITE INQUIRY\n";
$email_content .= "=================================\n\n";
$email_content .= "Full Name: $name\n";
$email_content .= "Email Address: $email\n";
$email_content .= "Mobile Phone: $mobile\n\n";
$email_content .= "Message / Query:\n$query\n\n";
$email_content .= "Sent via Website: " . date("Y-m-d H:i:s") . "\n";
// Email Headers
$headers = "From: $site_name <info@donboscochurch.org>\r\n";
$headers .= "Reply-To: $name <$email>\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
// Send Email
if (mail($recipient_email, $subject, $email_content, $headers)) {
echo json_encode([
'status' => 'success',
'message' => 'Thank you ' . htmlspecialchars($name) . '! Your message has been delivered to the parish secretary.'
]);
} else {
echo json_encode([
'status' => 'error',
'message' => 'Failed to send message. Please reach out to us via phone.'
]);
}
?>
<!--
DON BOSCO CATHOLIC CHURCH (UPPER HILL, NAIROBI)
Complete Single-File Web Application (HTML5, Tailwind CSS, FontAwesome, JavaScript)
Features:
- Responsive Top Navigation with direct section rendering
- Hero sanctuary banner & Salesian charism presentation
- Mass schedule cards (Daily 6:15am/6:00pm, Sat 7:00am, Sun 7:00/9:15/11:00am)
- Interactive Sacramental Bookings (Weddings, Baptism, Counseling, Priest)
- Integrated contact form & Google Map (Upper Hill, Nairobi)
- PHP Backend Mail integration ready (process_booking.php & process_contact.php)
-->