diff --git a/.htaccess b/.htaccess index a0bc9ffc..361dcb19 100644 --- a/.htaccess +++ b/.htaccess @@ -164,7 +164,7 @@ RewriteRule ^autosave$ src/processors/blog/autosave.php [L] -php_flag display_errors Off +php_flag display_errors On # php_value error_reporting -1 RedirectMatch 403 ^/\.well-known Options -Indexes diff --git a/index.php b/index.php index a29aec91..5a4487cf 100644 --- a/index.php +++ b/index.php @@ -27,16 +27,32 @@ if ($showRenewModal) { } else { $showRenewModal = false; } - $user_id = $_SESSION['user_id']; - $stmt = $conn->prepare("SELECT payment_status FROM membership_fees WHERE user_id = ? LIMIT 1"); - $stmt->bind_param("i", $user_id); - $stmt->execute(); - $stmt->bind_result($payment_status); - $stmt->fetch(); - $stmt->close(); - if ($payment_status === 'PENDING RENEWAL') { + $user_id = $_SESSION['user_id']; + + // Ensure we have a DB connection + if (!isset($conn) || $conn === null) { $showRenewModal = false; + } else { + $stmt = $conn->prepare("SELECT payment_status FROM membership_fees WHERE user_id = ? LIMIT 1"); + $stmt->bind_param("i", $user_id); + $stmt->execute(); + // store_result so we can check num_rows + $stmt->store_result(); + + // If there's no membership_fees record for this user, don't show the renew modal + if ($stmt->num_rows === 0) { + $showRenewModal = false; + } else { + $stmt->bind_result($payment_status); + $stmt->fetch(); + + if ($payment_status === 'PENDING RENEWAL') { + $showRenewModal = false; + } + } + + $stmt->close(); } } diff --git a/src/pages/memberships/membership_application.php b/src/pages/memberships/membership_application.php index a0703cee..4cc35f5e 100644 --- a/src/pages/memberships/membership_application.php +++ b/src/pages/memberships/membership_application.php @@ -7,7 +7,7 @@ checkUserSession(); // Assuming you have the user ID stored in the session if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; -}else{ +} else { header('Location: login.php'); exit(); // Stop further script execution } @@ -25,7 +25,7 @@ $user = $result->fetch_assoc(); $pageTitle = 'Membership Application'; $breadcrumbs = [['Home' => 'index.php'], ['Membership' => 'membership.php']]; require_once($rootPath . '/components/banner.php'); -?> + ?> @@ -39,6 +39,31 @@ $user = $result->fetch_assoc();
+ +

Membership Type

+
+
+
+
+ + +
+
+
+ + +
+
+ + +
+
+
+
+
+ + +

Main Member

@@ -88,193 +113,199 @@ $user = $result->fetch_assoc();
-

Spouse / Life Partner / Other Details

-
-
-
- - +
+

Spouse / Life Partner / Other Details

+
+
+
+ + +
-
-
-
- - +
+
+ + +
+
+ +
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
+
+ + + +
+

Children's Names

+
+
+
+ +
- - -

Children's Names

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

Address

-
-
-
- - -
-
-
-
- - -
+
+
+ +
- - -

Interests and Hobbies

-
-
-
- -
+
+
+ +
- - -

Primary Vehicle

-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
+
+
+ +
-

Secondary Vehicle

-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
+
+
+ +
+
+
+ + +
+
+ +
+
-
- - -
-
- - + +

Address

+
+
+
+ + +
+
+
+
+ + +
+
+
+ + +

Interests and Hobbies

+
+
+
+ +
+
+
+ + +

Primary Vehicle

+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+

Secondary Vehicle

+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
-
+ + +
+
+ + +
+
+ +
+
@@ -282,3 +313,43 @@ $user = $result->fetch_assoc(); + + \ No newline at end of file diff --git a/src/pages/memberships/membership_details.php b/src/pages/memberships/membership_details.php index 8a5c39d2..d3abaff9 100644 --- a/src/pages/memberships/membership_details.php +++ b/src/pages/memberships/membership_details.php @@ -189,7 +189,7 @@ if (empty($application['id_number'])) { - PENDING RENEWAL + '> diff --git a/src/pages/other/base4.php b/src/pages/other/base4.php index 7b5f101f..75fc9d39 100644 --- a/src/pages/other/base4.php +++ b/src/pages/other/base4.php @@ -141,6 +141,17 @@ include_once($rootPath . '/header.php'); margin: 50px; padding: 20px; border-radius: 20px; + box-sizing: border-box; + } + + @media (max-width: 768px) { + #map { + margin: 0 !important; + padding: 0 !important; + width: 100% !important; + height: 500px !important; + border-radius: 0 !important; + } } .obstacle-popup h4 { diff --git a/src/processors/process_application.php b/src/processors/process_application.php index 8e073398..eb22fab0 100644 --- a/src/processors/process_application.php +++ b/src/processors/process_application.php @@ -4,6 +4,7 @@ require_once($rootPath . "/src/config/env.php"); require_once($rootPath . "/src/config/session.php"); require_once($rootPath . "/src/config/connection.php"); require_once($rootPath . "/src/config/functions.php"); +require_once($rootPath . "/src/helpers/notification_helper.php"); $user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : null; $payment_id = generatePaymentRef('SUBS', null, $user_id); @@ -89,7 +90,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $email = validateEmail($_POST['email'] ?? ''); if ($email === false) { - die('Invalid email format.'); + die('Invalid email format.'); + } + + //MEMBERSHIP TYPE + $country_membership = isset($_POST['country_membership']) ? 1 : 0; + $membership_type = in_array($_POST['membership_type'] ?? '', ['full', 'single']) ? $_POST['membership_type'] : 'full'; + + if ($country_membership) { + $membership_type = 'country'; + }else{ + $membership_type = $membership_type; } // Spouse or Partner details (optional) @@ -136,8 +147,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { spouse_first_name, spouse_last_name, spouse_id_number, spouse_dob, spouse_occupation, spouse_tel_cell, spouse_email, child_name1, child_dob1, child_name2, child_dob2, child_name3, child_dob3, physical_address, postal_address, interests_hobbies, vehicle_make, vehicle_model, vehicle_year, vehicle_registration, - secondary_vehicle_make, secondary_vehicle_model, secondary_vehicle_year, secondary_vehicle_registration - ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + secondary_vehicle_make, secondary_vehicle_model, secondary_vehicle_year, secondary_vehicle_registration, membership_type + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); // Check if preparation was successful if (!$stmt) { @@ -145,7 +156,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } $stmt->bind_param( - "isssssssssssssssssssssssssssssss", + "issssssssssssssssssssssssssssssss", $user_id, $first_name, $last_name, @@ -177,7 +188,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $secondary_vehicle_make, $secondary_vehicle_model, $secondary_vehicle_year, - $secondary_vehicle_registration + $secondary_vehicle_registration, + $membership_type ); if ($stmt->execute()) { @@ -187,10 +199,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $year = (int)$today->format('Y'); $payment_date = $today->format('Y-m-d'); $membership_start_date = $payment_date; + if ($membership_type === 'country') { + $payment_amount = getPriceByDescription('country_membership'); + $prorata_amount = calculateProrata(getPriceByDescription('country_prorata')); + } elseif ($membership_type === 'single') { + $payment_amount = getPriceByDescription('single'); + $prorata_amount = calculateProrata(getPriceByDescription('single_prorata')); + } else { + $payment_amount = getPriceByDescription('membership_fees'); + $prorata_amount = calculateProrata(getPriceByDescription('pro_rata')); + } + + if ($month == 12 || $month == 1 || $month == 2) { // December, January, February: charge full fee, valid till end of next Feb - $payment_amount = getPriceByDescription('membership_fees'); + $payment_amount = $payment_amount; // If Dec, Jan, Feb, set end to next year's Feb $end_year = ($month == 12) ? $year + 2 : $year + 1; $membership_end_date = (new DateTime("$end_year-02-01")) @@ -198,7 +222,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ->format('Y-m-d'); } else { // Prorata for Mar-Nov - $payment_amount = calculateProrata(getPriceByDescription('pro_rata')); + $payment_amount = $prorata_amount; // End of next Feb if after Feb, else this Feb if ($month > 2) { $end_year = $year + 1; diff --git a/uploads/signatures/signature_163.png b/uploads/signatures/signature_163.png index 27bcf4f9..48a14509 100644 Binary files a/uploads/signatures/signature_163.png and b/uploads/signatures/signature_163.png differ