diff --git a/.gitignore b/.gitignore index 8c3dc162..dcb0bc62 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .env /vendor/ +.htaccess +/uploads/pop/ \ No newline at end of file diff --git a/admin_efts.php b/admin_efts.php index 7be8135e..14a3c522 100644 --- a/admin_efts.php +++ b/admin_efts.php @@ -198,6 +198,10 @@ if (!empty($bannerImages)) { echo " " . htmlspecialchars($row['status']) . " "; + } elseif (($row['status']) == 'PROCESSING') { + echo " + PROCESS + "; } else { echo "" . htmlspecialchars($row['status']) . ""; } diff --git a/functions.php b/functions.php index 54240ef7..7050e9a6 100644 --- a/functions.php +++ b/functions.php @@ -236,7 +236,7 @@ function sendAdminNotification($subject, $message) { global $mailjet; - $message = [ + $mail = [ 'Messages' => [ [ 'From' => [ @@ -265,7 +265,7 @@ function sendAdminNotification($subject, $message) ]); $response = $client->request('POST', 'send', [ - 'json' => $message, + 'json' => $mail, 'auth' => ['1a44f8d5e847537dbb8d3c76fe73a93c', 'ec98b45c53a7694c4f30d09eee9ad280'] ]); diff --git a/header01.php b/header01.php index 53bdce98..d6ad8dcf 100644 --- a/header01.php +++ b/header01.php @@ -210,6 +210,7 @@ logVisitor();
  • EFT Payments
  • +
  • Process Payments
  • Visitor Log
  • @@ -231,6 +232,7 @@ logVisitor();
  • Account Settings
  • Membership
  • My Bookings
  • +
  • Submit P.O.P
  • Log Out
  • diff --git a/header02.php b/header02.php index a9633138..17bb2814 100644 --- a/header02.php +++ b/header02.php @@ -223,6 +223,7 @@ logVisitor();
  • EFT Payments
  • +
  • Process Payments
  • Visitor Log
  • @@ -237,6 +238,7 @@ logVisitor();
  • Account Settings
  • Membership
  • My Bookings
  • +
  • Submit P.O.P
  • Log Out
  • diff --git a/membership_payment.php b/membership_payment.php index 5776082f..e5119b00 100644 --- a/membership_payment.php +++ b/membership_payment.php @@ -105,9 +105,13 @@ if (!empty($bannerImages)) { Membership Start Date: ' . $membership_start_date . '
    Membership Renewal Date: ' . $membership_end_date . ''; ?> -

    Your invoice has been sent to . Please send your proof of payment to info@4wdcsa.co.za.

    +

    Your invoice has been sent to . Please upload your proof of payment below.

    Payment Details:

    The Four Wheel Drive Club of Southern Africa
    FNB
    Account Number: 58810022334
    Branch code: 250655
    Reference:
    Amount: R

    + + Submit Proof of Payment + +
    diff --git a/payment_confirmation.php b/payment_confirmation.php index 78a333f6..86481fd6 100644 --- a/payment_confirmation.php +++ b/payment_confirmation.php @@ -131,10 +131,14 @@ if (!empty($bannerImages)) {
    -

    Your invoice has been sent to . Please send your proof of payment to info@4wdcsa.co.za.

    +

    Your invoice has been sent to . Please upload your proof of payment below.

    Bookings not paid for within 24 hours will be forfeited.

    Payment Details:

    The Four Wheel Drive Club of Southern Africa
    FNB
    Account Number: 58810022334
    Branch code: 250655
    Reference:
    Amount: R

    + + Submit Proof of Payment + + diff --git a/process_payments.php b/process_payments.php new file mode 100644 index 00000000..2bea93cc --- /dev/null +++ b/process_payments.php @@ -0,0 +1,148 @@ + + + + +
    + +
    + +
    +
    + + +
    +
    +
    + +
    + +
    + + × +
    + + + prepare($sql); + $stmt->bind_param("s", $status); + $stmt->execute(); + $result = $stmt->get_result(); + + if ($result->num_rows > 0) { + // Loop through each row + while ($row = $result->fetch_assoc()) { + $eft_id = $row['eft_id']; + $eft_user = $row['user_id']; + $eft_amount = $row['amount']; + $eft_description = $row['description']; + + // Output the HTML structure with dynamic data + echo ' +
    +
    + +

    View Full PDF

    + +
    +
    +
    ' . htmlspecialchars($eft_description) . '
    +
    ' . getFullName($eft_user) . '
    + +
    '; + } + } else { + echo '

    There are no pending payments for processing.

    '; + } + // Close connection + $conn->close(); + ?> + + +
    +
    +
    +
    + + + + + + \ No newline at end of file diff --git a/submit_pop.php b/submit_pop.php new file mode 100644 index 00000000..f294d756 --- /dev/null +++ b/submit_pop.php @@ -0,0 +1,219 @@ +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: + + +
    • +
    +
  • + +
  • +
    +
    + +
    + +
    + +
    +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/uploads/signatures/index.html b/uploads/signatures/index.html deleted file mode 100644 index 20690f80..00000000 --- a/uploads/signatures/index.html +++ /dev/null @@ -1,1065 +0,0 @@ - - - - - - - - - - - Ravelo - Travel & Tour Booking HTML Template - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - - - - - - -
    - - -
    -
    -
    -
    -

    Get Appointment

    -
    - - -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    - - - -
    -
    - - - - -
    -
    -

    tour & Travel

    -
    -
    -
    -
    -
    -
    - Destinations - -
    -
    -
    - All Activity - -
    -
    -
    - Departure Date - -
    -
    -
    - Guests - -
    -
    - -
    -
    -
    -
    - - - - -
    -
    -
    -
    -
    -

    Discover the World's Treasures with Ravelo

    -

    One site 0 most popular experience you’ll remember

    -
    -
    -
    -
    -
    -
    -
    -
    4.8
    - - Destination -
    -
    - Tours, France -
    Brown Concrete Building Basilica St Martin
    - 3 days 2 nights - Couple -
    - -
    -
    -
    -
    -
    -
    4.8
    - - Destination -
    -
    - Wildest, Italy -
    Blue lake water view taken travel with daytime
    - 3 days 2 nights - Couple -
    - -
    -
    -
    -
    -
    -
    4.8
    - - Destination -
    -
    - Rome, Italy -
    Woman standing near Colosseum, Rome
    - 3 days 2 nights - Couple -
    - -
    -
    -
    -
    -
    -
    4.8
    - - Destination -
    -
    - Rome, Italy -
    Woman standing near Colosseum, Rome
    - 3 days 2 nights - Couple -
    - -
    -
    -
    -
    -
    - - - - -
    -
    -
    -
    -
    -
    -

    Travel with Confidence Top Reasons to Choose Our Agency

    -
    -

    We go above and beyond to make your travel dreams reality hidden gems and must-see attractions

    -
    We have 0 Years of experience
    -
    -
    -
    - 0 - Popular Destination -
    -
    -
    -
    - 0 - Satisfied Clients -
    -
    -
    - - Explore Destinations - - -
    -
    -
    -
    -
    Shape
    -
    Shape
    -
    Shape
    -
    Shape
    -
    Shape
    -
    Shape
    -
    Shape
    - About -
    -
    -
    -
    -
    - - - - - - - - - -
    -
    -
    -
    -
    -
    -

    The Ultimate Travel Experience Features That Set Our Agency Apart

    -
    -
    -
    - Features -
    -
    -
    - Author - Author - Author - 4k+ -
    -
    850K+ Happy Customer
    -
    0 Years
    -

    We pride ourselves offering personalized itineraries

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    Tent Camping
    -

    Tent camping is wonderful way to connect with nature

    -
    -
    -
    -
    -
    -
    Kayaking
    -

    Kayaking is a thrilling outdoor activity that adventure

    -
    -
    -
    -
    -
    -
    -
    -
    Mountain Biking
    -

    Mountain biking is exhilarating sport that physical fitness

    -
    -
    -
    -
    -
    -
    Fishing & Boat
    -

    Fishing and boat bring joy quintessential activities that

    -
    -
    -
    -
    -
    -
    -
    -
    - - - - -
    -
    -
    -
    -
    -

    Discover the World's Class Top Hotel

    -

    One site 0 most popular experience you’ll remember

    -
    -
    -
    -
    -
    -
    -
    -
    4.8
    - - Hotel -
    -
    - Ao Nang, Thailand -
    The brown bench near swimming pool Hotel
    -
      -
    • 2 Bed room
    • -
    • 1 kitchen
    • -
    • 2 Wash room
    • -
    • Internet
    • -
    - -
    -
    -
    -
    -
    -
    -
    4.8
    - - Hotel -
    -
    - Kigali, Rwanda -
    Green trees and body of water Marriott Hotel
    -
      -
    • 2 Bed room
    • -
    • 1 kitchen
    • -
    • 2 Wash room
    • -
    • Internet
    • -
    - -
    -
    -
    -
    -
    -
    - Ao Nang, Thailand -
    Painted house surrounded with trees Hotel
    -
      -
    • 2 Bed room
    • -
    • 1 kitchen
    • -
    • 2 Wash room
    • -
    • Internet
    • -
    - -
    -
    -
    4.8
    - - Hotel -
    -
    -
    -
    -
    -
    - Ao Nang, Thailand -
    house pool Jungle Pool Indonesia Hotel
    -
      -
    • 2 Bed room
    • -
    • 1 kitchen
    • -
    • 2 Wash room
    • -
    • Internet
    • -
    - -
    -
    -
    4.8
    - - Hotel -
    -
    -
    -
    - -
    -
    - - - - -
    -
    -
    -
    -
    -
    -

    We Are Available On the Store Get Our Mobile Apps Very Easily

    -
    -

    We go above and beyond to make your travel dreams a reality. Trust us to handle the details so you can creating unforgettable memories. Explore the world with confidence

    -
      -
    • Experience Agency
    • -
    • Professional Team
    • -
    • Low Cost Travel
    • -
    • Online Support 24/7
    • -
    -
    - Google Play - App Store -
    -
    -
    -
    -
    -
    BG
    -
    - Phone - Phone - Phone -
    -
    -
    -
    -
    -
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    5280 Global Clients Say About Us Services

    -
    -
    -
    -
    -
    -

    Quality Services

    -
    - - - - - -
    -
    -
    "Our trip was absolutely a perfect, thanks this travel agency! They took care of every detail, from to accommodations, and even suggested incredible experiences"
    -
    -
    Author
    -
    -
    Randall V. Vasquez
    - Graphics Designer -
    -
    -
    -
    -
    -
    -

    Quality Services

    -
    - - - - - -
    -
    -
    "Our trip was absolutely a perfect, thanks this travel agency! They took care of every detail, from to accommodations, and even suggested incredible experiences"
    -
    -
    Author
    -
    -
    Randall V. Vasquez
    - Graphics Designer -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - -
    -
    -
    -
    -
    - Tent Camping -

    Explore the world best tourism

    - - Explore Tours - - -
    -
    -
    -
    - Sea Beach -

    World largest Sea Beach in Thailand

    - - Explore Tours - - -
    -
    -
    -
    - Water Falls -

    Largest Water falls Bali, Indonesia

    - - Explore Tours - - -
    -
    -
    -
    -
    - - - - -
    - -
    - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file