Invalid submission: missing eft_id or file."; echo "
";
        echo "POST data: " . print_r($_POST, true);
        echo "FILES data: " . print_r($_FILES, true);
        echo "
"; } else { $file = $_FILES['pop_file']; $target_dir = "uploads/pop/"; $target_file = $target_dir . $file_name . ".pdf"; // Check for upload errors first if ($file['error'] !== UPLOAD_ERR_OK) { echo "
Upload error code: " . $file['error'] . "
"; // You can decode error code if needed: // https://www.php.net/manual/en/features.file-upload.errors.php exit; } // Check for PDF extension $file_type = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION)); if ($file_type !== "pdf") { echo "
Only PDF files allowed. You tried uploading: .$file_type
"; exit; } // Make sure target directory exists and writable if (!is_dir($target_dir)) { echo "
Upload directory does not exist: $target_dir
"; exit; } if (!is_writable($target_dir)) { echo "
Upload directory is not writable: $target_dir
"; exit; } if (move_uploaded_file($file['tmp_name'], $target_file)) { // Update EFT and booking status $payment_type = $_POST['payment_type'] ?? 'booking'; if ($payment_type === 'membership') { // Update EFT and booking status $stmt1 = $conn->prepare("UPDATE efts SET status = 'PROCESSING' WHERE eft_id = ?"); $stmt1->bind_param("s", $eft_id); $stmt1->execute(); // Update membership fee status $stmt = $conn->prepare("UPDATE membership_fees SET payment_status = 'PROCESSING' WHERE payment_id = ?"); $stmt->bind_param("s", $eft_id); $stmt->execute(); } else { // Update EFT and booking status $stmt1 = $conn->prepare("UPDATE efts SET status = 'PROCESSING' WHERE eft_id = ?"); $stmt1->bind_param("s", $eft_id); $stmt1->execute(); $stmt2 = $conn->prepare("UPDATE bookings SET status = 'PROCESSING' WHERE eft_id = ?"); $stmt2->bind_param("s", $eft_id); $stmt2->execute(); } // Notify n8n and send the path to the uploaded file $webhook_url = 'https://n8n.4wdcsa.co.za/webhook/process-pop'; $postData = [ 'eft_id' => $eft_id, 'payment_type' => $payment_type, ]; $ch = curl_init($webhook_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData)); $response = curl_exec($ch); $error = curl_error($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($error) { error_log("Webhook Error: $error"); $_SESSION['message'] = $error; header("Location: bookings.php"); } else { $_SESSION['message'] = "Thank you! We are busy processing your payment!"; header("Location: bookings.php"); } exit; } else { echo "
Unable to move uploaded file.
"; echo "
Tmp file exists? " . (file_exists($file['tmp_name']) ? "Yes" : "No") . "
"; echo "
Tmp file path: " . htmlspecialchars($file['tmp_name']) . "
"; exit; } } } // Fetch bookings for dropdown $stmt = $conn->prepare(" SELECT eft_id AS id, 'booking' AS type FROM bookings WHERE user_id = ? AND status = 'AWAITING PAYMENT' UNION SELECT payment_id AS id, 'membership' AS type FROM membership_fees WHERE user_id = ? AND payment_status = 'PENDING' "); $stmt->bind_param("ii", $user_id, $user_id); $stmt->execute(); $result = $stmt->get_result(); $items = $result->fetch_all(MYSQLI_ASSOC); $bannerFolder = 'assets/images/banners/'; $bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE); $randomBanner = 'assets/images/base4/camping.jpg'; // default fallback if (!empty($bannerImages)) { $randomBanner = $bannerImages[array_rand($bannerImages)]; } ?>

Submit Proof of Payment

To finalise your booking/membership, select the payment reference below, and then upload your PDF proof of payment.

0) {?>
  • Select Payment Reference: