34116-vm/sponsor.php
2025-09-16 21:02:18 +00:00

210 lines
11 KiB
PHP

<?php
require_once __DIR__ . '/mail/MailService.php';
$form_submitted = false;
$form_error = '';
$form_success = '';
// Basic form processing
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Sanitize and validate inputs
$name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$amount = filter_input(INPUT_POST, 'amount', FILTER_SANITIZE_STRING);
$coc = filter_input(INPUT_POST, 'coc', FILTER_SANITIZE_STRING);
if (empty($name) || empty($email) || empty($amount) || empty($coc)) {
$form_error = 'Please fill out all required fields and agree to the Code of Conduct.';
} elseif (!$email) {
$form_error = 'Please provide a valid email address.';
} else {
// Prepare email content
$subject = "New Sponsorship Submission: {$name}";
$htmlBody = "
<h1>New Sponsorship Submission</h1>
<p>A new sponsorship form has been submitted on the website.</p>
<ul>
<li><strong>Name/Company:</strong> " . htmlspecialchars($name) . "</li>
<li><strong>Email:</strong> " . htmlspecialchars($email) . "</li>
<li><strong>Sponsorship Tier/Amount:</strong> " . htmlspecialchars($amount) . "</li>
<li><strong>Agreed to CoC:</strong> Yes</li>
</ul>
<p>Please follow up with them to confirm payment and sponsorship details.</p>
";
$textBody = "
New Sponsorship Submission
Name/Company: {$name}
Email: {$email}
Sponsorship Tier/Amount: {$amount}
Agreed to CoC: Yes
";
// Send email
$to = null; // Use MAIL_TO from .env
$options = ['reply_to' => $email];
$result = MailService::sendMail($to, $subject, $htmlBody, $textBody, $options);
if (!empty($result['success'])) {
// Redirect to 'thanks' page on success
header("Location: thanks.php");
exit;
} else {
// Log error and show a generic message
error_log("MailService Error: " . ($result['error'] ?? 'Unknown error'));
$form_error = 'Sorry, there was an error sending your message. Please try again later or contact us directly.';
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sponsor the Pavilion | Belarusians Worldwide</title>
<meta name="description" content="Become a sponsor for the first Belarusian pavilion at Web Summit 2025.">
<meta name="robots" content="noindex, nofollow"> <!-- Discourage indexing of form pages -->
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500&family=Inter:wght@600;700&display=swap" rel="stylesheet">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand fw-bold" href="/">Belarusians Worldwide</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link" href="/#why">Why</a></li>
<li class="nav-item"><a class="nav-link active" href="sponsor.php">Sponsor</a></li>
<li class="nav-item"><a class="nav-link" href="apply.php">Apply</a></li>
<li class="nav-item"><a class="nav-link" href="volunteer.php">Volunteer</a></li>
<li class="nav-item"><a class="nav-link" href="media.php">Media</a></li>
</ul>
</div>
</div>
</nav>
</header>
<main class="container my-5">
<div class="row">
<div class="col-lg-8 mx-auto">
<h1 class="mb-4">Sponsor the Pavilion</h1>
<p class="lead mb-5">Your contribution directly funds the first-ever Belarusian pavilion at Web Summit. Please fill out the form below and follow the payment instructions. We'll be in touch to confirm your sponsorship.</p>
<div class="row">
<!-- Form Section -->
<div class="col-md-6">
<div class="card">
<div class="card-body">
<h5 class="card-title mb-4">Sponsorship Details</h5>
<?php if ($form_error): ?>
<div class="alert alert-danger"><?php echo $form_error; ?></div>
<?php endif; ?>
<div class="alert alert-info small">
<p>This is for testing purposes only — Flatlogic does not guarantee usage of the mail server. Please set up your own SMTP in <code>.env</code> (MAIL_/SMTP_ vars).</p>
<p class="mb-0">If you do not receive a confirmation, please check your spam folder.</p>
</div>
<form action="sponsor.php" method="POST">
<div class="mb-3">
<label for="name" class="form-label">Your Name or Company</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="mb-3">
<label for="email" class="form-label">Contact Email</label>
<input type="email" class="form-control" id="email" name="email" required>
<div class="form-text">For receipts and communication.</div>
</div>
<div class="mb-3">
<label for="amount" class="form-label">Sponsorship Amount (€)</label>
<select class="form-select" id="amount" name="amount" required>
<option value="" selected disabled>Choose a tier or enter amount...</option>
<option value="500">€500 - Booth Handouts</option>
<option value="1000">€1,000 - Logo on Backdrop</option>
<option value="2500">€2,500 - Co-Exhibitor</option>
<option value="5000">€5,000 - Hero Sponsor</option>
<option value="custom">Other Amount</option>
</select>
</div>
<div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="coc" name="coc" value="1" required>
<label class="form-check-label" for="coc">I agree to the <a href="code-of-conduct.php" target="_blank">Code of Conduct</a>.</label>
</div>
<button type="submit" class="btn btn-primary w-100">Submit & Proceed to Payment</button>
</form>
</div>
</div>
</div>
<!-- Payment Instructions Section -->
<div class="col-md-6 mt-4 mt-md-0">
<div class="card bg-light border-dashed">
<div class="card-body">
<h5 class="card-title mb-3">Payment Instructions</h5>
<p>After submitting the form, please use one of the methods below. Make sure the name on the transfer matches the name in the form.</p>
<hr>
<h6><strong>Option 1: Bank Transfer (SEPA)</strong></h6>
<ul class="list-unstyled">
<li><strong>Beneficiary:</strong> VSI "IMAGURU"</li>
<li><strong>IBAN:</strong> LTXX XXXX XXXX XXXX XXXX</li>
<li><strong>Bank:</strong> Revolut Bank UAB</li>
<li><strong>SWIFT/BIC:</strong> REVOLT21</li>
<li><strong>Reference:</strong> WS25 Pavilion - [Your Name]</li>
</ul>
<hr>
<h6><strong>Option 2: Cryptocurrency (USDT)</strong></h6>
<p class="small">For crypto contributions, please send us an email after the transfer with the transaction hash.</p>
<ul class="list-unstyled">
<li><strong>Network:</strong> TRC20 (Tron)</li>
<li><strong>Address:</strong> <code>TYourWalletAddressHere...</code></li>
</ul>
<hr>
<p class="small text-muted mt-3">For questions or alternative payment methods, please contact us at <a href="mailto:pavalion@belarusiansworldwide.com">pavalion@belarusiansworldwide.com</a>.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<footer class="footer mt-5">
<div class="container text-center">
<p class="mb-1">&copy; <?php echo date("Y"); ?> Belarusians Worldwide. A self-funded, non-state initiative.</p>
<ul class="list-inline">
<li class="list-inline-item"><a href="privacy.php">Privacy</a></li>
<li class="list-inline-item"><a href="code-of-conduct.php">Code of Conduct</a></li>
<li class="list-inline-item"><a href="media.php">Press</a></li>
</ul>
</div>
</footer>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<!-- Custom JS -->
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>