| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/thelittlebigshow/vendor-reg/ |
Upload File : |
<?php
session_start();
require_once 'config.php';
$error_message = '';
function phone_last_four($phone) {
$digits = preg_replace('/\D+/', '', (string)$phone);
return substr($digits, -4);
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = trim($_POST['email'] ?? '');
$phone_last4 = preg_replace('/\D+/', '', $_POST['phone_last4'] ?? '');
if (!filter_var($email, FILTER_VALIDATE_EMAIL) || strlen($phone_last4) !== 4) {
$error_message = 'Enter the email used to register and the last 4 digits of your phone number.';
} else {
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($conn->connect_error) {
die('Connection failed: ' . $conn->connect_error);
}
$sql = "SELECT id, name, email, phone, spots FROM vendors WHERE LOWER(email) = LOWER(?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param('s', $email);
$stmt->execute();
$result = $stmt->get_result();
$matches = [];
while ($row = $result->fetch_assoc()) {
if (phone_last_four($row['phone']) === $phone_last4) {
$matches[] = $row;
}
}
$stmt->close();
$conn->close();
if (count($matches) === 1) {
$_SESSION['vendor_spot_vendor_id'] = (int)$matches[0]['id'];
header('Location: vendor_spot_map.php');
exit();
} elseif (count($matches) > 1) {
$error_message = 'That email and phone match more than one registration. Please contact the event organizer to pick spots.';
} else {
$error_message = 'No vendor registration matched that email and phone number.';
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Vendor Spot Login</title>
<link rel="stylesheet" href="vendor_spot_assets/vendor_spots.css">
</head>
<body class="login-page">
<main class="login-card">
<h1>Pick Your Vendor Spot</h1>
<p>Use the email and phone number from your vendor registration.</p>
<?php if ($error_message): ?>
<div class="message error"><?php echo htmlspecialchars($error_message); ?></div>
<?php endif; ?>
<form method="post" action="vendor_spot_login.php">
<label>
Email
<input type="email" name="email" required autocomplete="email">
</label>
<label>
Phone Last 4
<input type="text" name="phone_last4" required inputmode="numeric" maxlength="4" pattern="\d{4}">
</label>
<button type="submit">Continue</button>
</form>
<a class="small-link" href="index.php">Back to car show site</a>
</main>
</body>
</html>