Compare commits
2 Commits
c618fd4506
...
9653443c09
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9653443c09 | ||
|
|
782d343243 |
@@ -30,6 +30,7 @@ RewriteRule ^membership$ src/pages/memberships/membership.php [L]
|
|||||||
RewriteRule ^membership_details$ src/pages/memberships/membership_details.php [L]
|
RewriteRule ^membership_details$ src/pages/memberships/membership_details.php [L]
|
||||||
RewriteRule ^membership_application$ src/pages/memberships/membership_application.php [L]
|
RewriteRule ^membership_application$ src/pages/memberships/membership_application.php [L]
|
||||||
RewriteRule ^membership_payment$ src/pages/memberships/membership_payment.php [L]
|
RewriteRule ^membership_payment$ src/pages/memberships/membership_payment.php [L]
|
||||||
|
RewriteRule ^renewal_payment$ src/pages/memberships/renewal_payment.php [L]
|
||||||
RewriteRule ^renew_membership$ src/pages/memberships/renew_membership.php [L]
|
RewriteRule ^renew_membership$ src/pages/memberships/renew_membership.php [L]
|
||||||
RewriteRule ^member_info$ src/pages/memberships/member_info.php [L]
|
RewriteRule ^member_info$ src/pages/memberships/member_info.php [L]
|
||||||
|
|
||||||
@@ -164,7 +165,7 @@ RewriteRule ^autosave$ src/processors/blog/autosave.php [L]
|
|||||||
|
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
php_flag display_errors Off
|
php_flag display_errors On
|
||||||
# php_value error_reporting -1
|
# php_value error_reporting -1
|
||||||
RedirectMatch 403 ^/\.well-known
|
RedirectMatch 403 ^/\.well-known
|
||||||
Options -Indexes
|
Options -Indexes
|
||||||
|
|||||||
39
index.php
39
index.php
@@ -27,16 +27,37 @@ if ($showRenewModal) {
|
|||||||
} else {
|
} else {
|
||||||
$showRenewModal = false;
|
$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;
|
$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;
|
||||||
|
}
|
||||||
|
if (isMembershipExpiringSoon($user_id)) {
|
||||||
|
$showRenewModal = true;
|
||||||
|
} else {
|
||||||
|
$showRenewModal = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,7 +747,7 @@ if (countUpcomingTrips() > 0) { ?>
|
|||||||
</div> -->
|
</div> -->
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
Your membership will be expiring soon. Click below to renew now.
|
Your membership will be expiring soon. Click below to renew now.
|
||||||
<a style="width:100%; display:block;" href="renew_membership" class="theme-btn style-two style-three mt-3">Renew Now</a>
|
<a style="width:100%; display:block;" href="renewal_payment" class="theme-btn style-two style-three mt-3">Renew Now</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" style="width:100%; display:block;" class="theme-btn" data-bs-dismiss="modal">Remind Me Later</button>
|
<button type="button" style="width:100%; display:block;" class="theme-btn" data-bs-dismiss="modal">Remind Me Later</button>
|
||||||
|
|||||||
@@ -29,6 +29,106 @@ function openDatabaseConnection()
|
|||||||
return $conn;
|
return $conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//function to determine whether membership_end_date is within 3 months from current date where user_id = ?, if so return true, else false
|
||||||
|
function isMembershipExpiringSoon($user_id)
|
||||||
|
{
|
||||||
|
$conn = openDatabaseConnection();
|
||||||
|
if ($conn === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $conn->prepare("SELECT membership_end_date FROM membership_fees WHERE user_id = ? LIMIT 1");
|
||||||
|
if (!$stmt) {
|
||||||
|
$conn->close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->bind_param('i', $user_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows === 0) {
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
$membership_end_date = new DateTime($row['membership_end_date']);
|
||||||
|
$current_date = new DateTime();
|
||||||
|
$interval = $current_date->diff($membership_end_date);
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
|
||||||
|
return ($interval->days <= 90 && $membership_end_date > $current_date);
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeName($name) {
|
||||||
|
$name = strtolower($name);
|
||||||
|
$name = preg_replace("/[^a-z\s]/", "", $name); // remove punctuation
|
||||||
|
$name = preg_replace("/\s+/", " ", $name); // normalize spaces
|
||||||
|
return trim($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// function to checkif first name + last name matches names in an array. names may have slight variations or spelling mistakes.
|
||||||
|
function validateHonoraryMemberName($first_name, $last_name)
|
||||||
|
{
|
||||||
|
$honorary_names = [
|
||||||
|
"robin hood",
|
||||||
|
"marc rademaker",
|
||||||
|
"clive robinson",
|
||||||
|
"joern kuebler",
|
||||||
|
"maurice compton",
|
||||||
|
"jenny cole",
|
||||||
|
"geoff joubert",
|
||||||
|
"alan exton",
|
||||||
|
"dave bell",
|
||||||
|
"karl hoffman",
|
||||||
|
"gerald obrian"
|
||||||
|
// Add more honorary member names as needed
|
||||||
|
];
|
||||||
|
|
||||||
|
$full_name = normalizeName($first_name . ' ' . $last_name);
|
||||||
|
$full_name = strtolower($full_name);
|
||||||
|
foreach ($honorary_names as $name) {
|
||||||
|
similar_text($full_name, strtolower(normalizeName($name)), $percent);
|
||||||
|
if ($percent >= 80) { // 80% similarity threshold
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get membership_type from membership_applications table for user_id = ?
|
||||||
|
function getMembershipType($user_id)
|
||||||
|
{
|
||||||
|
$conn = openDatabaseConnection();
|
||||||
|
if ($conn === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $conn->prepare("SELECT membership_type FROM membership_applications WHERE user_id = ? ORDER BY id DESC LIMIT 1");
|
||||||
|
if (!$stmt) {
|
||||||
|
$conn->close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->bind_param('i', $user_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($membership_type);
|
||||||
|
if ($stmt->fetch()) {
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
return $membership_type;
|
||||||
|
} else {
|
||||||
|
$stmt->close();
|
||||||
|
$conn->close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function progress_log($message, $context = null)
|
function progress_log($message, $context = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ checkUserSession();
|
|||||||
// Assuming you have the user ID stored in the session
|
// Assuming you have the user ID stored in the session
|
||||||
if (isset($_SESSION['user_id'])) {
|
if (isset($_SESSION['user_id'])) {
|
||||||
$user_id = $_SESSION['user_id'];
|
$user_id = $_SESSION['user_id'];
|
||||||
}else{
|
} else {
|
||||||
header('Location: login.php');
|
header('Location: login.php');
|
||||||
exit(); // Stop further script execution
|
exit(); // Stop further script execution
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ $user = $result->fetch_assoc();
|
|||||||
$pageTitle = 'Membership Application';
|
$pageTitle = 'Membership Application';
|
||||||
$breadcrumbs = [['Home' => 'index.php'], ['Membership' => 'membership.php']];
|
$breadcrumbs = [['Home' => 'index.php'], ['Membership' => 'membership.php']];
|
||||||
require_once($rootPath . '/components/banner.php');
|
require_once($rootPath . '/components/banner.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -39,6 +39,31 @@ $user = $result->fetch_assoc();
|
|||||||
<div class="section-title">
|
<div class="section-title">
|
||||||
<div id="responseMessage"></div> <!-- Message display area -->
|
<div id="responseMessage"></div> <!-- Message display area -->
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Membership Type -->
|
||||||
|
<h3>Membership Type</h3>
|
||||||
|
<div class="row mt-35">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group mb-3">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" id="country_membership" name="country_membership" value="1">
|
||||||
|
<label style="margin-left:20px;" for="country_membership">Country Membership - if you reside more than 150km from BASE4 and qualify for country membership.</label>
|
||||||
|
</div>
|
||||||
|
<div class="mt-2">
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input type="radio" name="membership_type" id="membership_full" value="full" checked>
|
||||||
|
<label style="margin-left:20px;" for="membership_full">Full Membership</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input type="radio" name="membership_type" id="membership_single" value="single">
|
||||||
|
<label style="margin-left:20px;" for="membership_single">Single Membership</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Personal Details Section -->
|
<!-- Personal Details Section -->
|
||||||
<h3>Main Member</h3>
|
<h3>Main Member</h3>
|
||||||
<div class="row mt-35">
|
<div class="row mt-35">
|
||||||
@@ -88,193 +113,199 @@ $user = $result->fetch_assoc();
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Spouse / Partner Details Section -->
|
<!-- Spouse / Partner Details Section -->
|
||||||
<h3>Spouse / Life Partner / Other Details</h3>
|
<div id="spouseSection">
|
||||||
<div class="row mt-35">
|
<h3>Spouse / Life Partner / Other Details</h3>
|
||||||
<div class="col-md-6">
|
<div class="row mt-35">
|
||||||
<div class="form-group">
|
<div class="col-md-6">
|
||||||
<label for="spouse_first_name">First Name</label>
|
<div class="form-group">
|
||||||
<input type="text" id="spouse_first_name" name="spouse_first_name" class="form-control" placeholder="Jane">
|
<label for="spouse_first_name">First Name</label>
|
||||||
|
<input type="text" id="spouse_first_name" name="spouse_first_name" class="form-control" placeholder="Jane">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-md-6">
|
||||||
<div class="col-md-6">
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<label for="spouse_last_name">Surname</label>
|
||||||
<label for="spouse_last_name">Surname</label>
|
<input type="text" id="spouse_last_name" name="spouse_last_name" class="form-control" placeholder="Smith">
|
||||||
<input type="text" id="spouse_last_name" name="spouse_last_name" class="form-control" placeholder="Smith">
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="spouse_id_number">ID Number / Passport Number</label>
|
||||||
|
<input type="text" id="spouse_id_number" name="spouse_id_number" class="form-control" placeholder="1234567890">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="spouse_dob">Date of Birth</label>
|
||||||
|
<input type="date" id="spouse_dob" name="spouse_dob" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="spouse_occupation">Occupation</label>
|
||||||
|
<input type="text" id="spouse_occupation" name="spouse_occupation" class="form-control" placeholder="Occupation">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="spouse_phone_numbers">Cell Phone</label>
|
||||||
|
<input type="text" id="spouse_tel_cell" name="spouse_tel_cell" class="form-control" placeholder="Cell Phone">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="spouse_email">Email Address</label>
|
||||||
|
<input type="email" id="spouse_email" name="spouse_email" class="form-control" placeholder="Enter email">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
</div> <!-- end spouse row -->
|
||||||
<div class="form-group">
|
<!-- </div> end spouseSection -->
|
||||||
<label for="spouse_id_number">ID Number / Passport Number</label>
|
|
||||||
<input type="text" id="spouse_id_number" name="spouse_id_number" class="form-control" placeholder="1234567890">
|
<!-- Children Section -->
|
||||||
</div>
|
<div id="childrenSection">
|
||||||
</div>
|
<h3>Children's Names</h3>
|
||||||
<div class="col-md-6">
|
<div class="row mt-35">
|
||||||
<div class="form-group">
|
<div class="col-md-6">
|
||||||
<label for="spouse_dob">Date of Birth</label>
|
<div class="form-group">
|
||||||
<input type="date" id="spouse_dob" name="spouse_dob" class="form-control">
|
<label for="child_name1">Child 1 Name</label>
|
||||||
</div>
|
<input type="text" id="child_name1" name="child_name1" class="form-control" placeholder="Child 1 Name">
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="spouse_occupation">Occupation</label>
|
|
||||||
<input type="text" id="spouse_occupation" name="spouse_occupation" class="form-control" placeholder="Occupation">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="spouse_phone_numbers">Cell Phone</label>
|
|
||||||
<input type="text" id="spouse_tel_cell" name="spouse_tel_cell" class="form-control" placeholder="Cell Phone">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="spouse_email">Email Address</label>
|
|
||||||
<input type="email" id="spouse_email" name="spouse_email" class="form-control" placeholder="Enter email">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
<!-- Children Section -->
|
<div class="form-group">
|
||||||
<h3>Children's Names</h3>
|
<label for="child_dob1">Child 1 DOB</label>
|
||||||
<div class="row mt-35">
|
<input type="date" id="child_dob1" name="child_dob1" class="form-control">
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="child_name1">Child 1 Name</label>
|
|
||||||
<input type="text" id="child_name1" name="child_name1" class="form-control" placeholder="Child 1 Name">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="child_dob1">Child 1 DOB</label>
|
|
||||||
<input type="date" id="child_dob1" name="child_dob1" class="form-control">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="child_name2">Child 2 Name</label>
|
|
||||||
<input type="text" id="child_name2" name="child_name2" class="form-control" placeholder="Child 2 Name">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="child_dob2">Child 2 DOB</label>
|
|
||||||
<input type="date" id="child_dob2" name="child_dob2" class="form-control">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="child_name3">Child 3 Name</label>
|
|
||||||
<input type="text" id="child_name3" name="child_name3" class="form-control" placeholder="Child 3 Name">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="child_dob3">Child 3 DOB</label>
|
|
||||||
<input type="date" id="child_dob3" name="child_dob3" class="form-control">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Repeat for other children if needed -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Address Section -->
|
|
||||||
<h3>Address</h3>
|
|
||||||
<div class="row mt-35">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="physical_address">Physical Address</label>
|
|
||||||
<textarea id="physical_address" name="physical_address" class="form-control" placeholder="Enter physical address"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="postal_address">Postal Address</label>
|
|
||||||
<textarea id="postal_address" name="postal_address" class="form-control" placeholder="Enter postal address"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
<!-- Interests Section -->
|
<div class="form-group">
|
||||||
<h3>Interests and Hobbies</h3>
|
<label for="child_name2">Child 2 Name</label>
|
||||||
<div class="row mt-35">
|
<input type="text" id="child_name2" name="child_name2" class="form-control" placeholder="Child 2 Name">
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<textarea id="interests_hobbies" name="interests_hobbies" class="form-control" placeholder="Enter interests and hobbies"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
<!-- Vehicle Section -->
|
<div class="form-group">
|
||||||
<h3>Primary Vehicle</h3>
|
<label for="child_dob2">Child 2 DOB</label>
|
||||||
<div class="row mt-35">
|
<input type="date" id="child_dob2" name="child_dob2" class="form-control">
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="vehicle_make">Make</label>
|
|
||||||
<input type="text" id="vehicle_make" name="vehicle_make" class="form-control" placeholder="Vehicle Make">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="vehicle_model">Model</label>
|
|
||||||
<input type="text" id="vehicle_model" name="vehicle_model" class="form-control" placeholder="Vehicle Model">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="vehicle_year">Year</label>
|
|
||||||
<input type="text" id="vehicle_year" name="vehicle_year" class="form-control" placeholder="Vehicle Year">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="vehicle_registration">Registration</label>
|
|
||||||
<input type="text" id="vehicle_registration" name="vehicle_registration" class="form-control" placeholder="Vehicle Registration">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h3>Secondary Vehicle</h3>
|
<div class="col-md-6">
|
||||||
<div class="row mt-35">
|
<div class="form-group">
|
||||||
<div class="col-md-3">
|
<label for="child_name3">Child 3 Name</label>
|
||||||
<div class="form-group">
|
<input type="text" id="child_name3" name="child_name3" class="form-control" placeholder="Child 3 Name">
|
||||||
<label for="secondary_vehicle_make">Make</label>
|
|
||||||
<input type="text" id="secondary_vehicle_make" name="secondary_vehicle_make" class="form-control" placeholder="Vehicle Make">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="secondary_vehicle_model">Model</label>
|
|
||||||
<input type="text" id="secondary_vehicle_model" name="secondary_vehicle_model" class="form-control" placeholder="Vehicle Model">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="secondary_vehicle_year">Year</label>
|
|
||||||
<input type="text" id="secondary_vehicle_year" name="secondary_vehicle_year" class="form-control" placeholder="Vehicle Year">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="secondary_vehicle_registration">Registration</label>
|
|
||||||
<input type="text" id="secondary_vehicle_registration" name="secondary_vehicle_registration" class="form-control" placeholder="Vehicle Registration">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="child_dob3">Child 3 DOB</label>
|
||||||
|
<input type="date" id="child_dob3" name="child_dob3" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Repeat for other children if needed -->
|
||||||
|
</div>
|
||||||
|
</div> <!-- end childrenSection -->
|
||||||
|
|
||||||
</div>
|
<!-- Address Section -->
|
||||||
|
<h3>Address</h3>
|
||||||
<!-- Submit Section -->
|
<div class="row mt-35">
|
||||||
<div class="col-md-12">
|
<div class="col-md-6">
|
||||||
<div class="form-group mb-0">
|
<div class="form-group">
|
||||||
<button type="submit" class="theme-btn style-two" style="width:100%;">Next</button>
|
<label for="physical_address">Physical Address</label>
|
||||||
<div id="msgSubmit" class="hidden"></div>
|
<textarea id="physical_address" name="physical_address" class="form-control" placeholder="Enter physical address"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="postal_address">Postal Address</label>
|
||||||
|
<textarea id="postal_address" name="postal_address" class="form-control" placeholder="Enter postal address"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Interests Section -->
|
||||||
|
<h3>Interests and Hobbies</h3>
|
||||||
|
<div class="row mt-35">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea id="interests_hobbies" name="interests_hobbies" class="form-control" placeholder="Enter interests and hobbies"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Vehicle Section -->
|
||||||
|
<h3>Primary Vehicle</h3>
|
||||||
|
<div class="row mt-35">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="vehicle_make">Make</label>
|
||||||
|
<input type="text" id="vehicle_make" name="vehicle_make" class="form-control" placeholder="Vehicle Make">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="vehicle_model">Model</label>
|
||||||
|
<input type="text" id="vehicle_model" name="vehicle_model" class="form-control" placeholder="Vehicle Model">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="vehicle_year">Year</label>
|
||||||
|
<input type="text" id="vehicle_year" name="vehicle_year" class="form-control" placeholder="Vehicle Year">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="vehicle_registration">Registration</label>
|
||||||
|
<input type="text" id="vehicle_registration" name="vehicle_registration" class="form-control" placeholder="Vehicle Registration">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h3>Secondary Vehicle</h3>
|
||||||
|
<div class="row mt-35">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="secondary_vehicle_make">Make</label>
|
||||||
|
<input type="text" id="secondary_vehicle_make" name="secondary_vehicle_make" class="form-control" placeholder="Vehicle Make">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="secondary_vehicle_model">Model</label>
|
||||||
|
<input type="text" id="secondary_vehicle_model" name="secondary_vehicle_model" class="form-control" placeholder="Vehicle Model">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="secondary_vehicle_year">Year</label>
|
||||||
|
<input type="text" id="secondary_vehicle_year" name="secondary_vehicle_year" class="form-control" placeholder="Vehicle Year">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="secondary_vehicle_registration">Registration</label>
|
||||||
|
<input type="text" id="secondary_vehicle_registration" name="secondary_vehicle_registration" class="form-control" placeholder="Vehicle Registration">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Submit Section -->
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group mb-0">
|
||||||
|
<button type="submit" class="theme-btn style-two" style="width:100%;">Next</button>
|
||||||
|
<div id="msgSubmit" class="hidden"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<!-- Contact Form Area end -->
|
<!-- Contact Form Area end -->
|
||||||
|
|
||||||
@@ -282,3 +313,43 @@ $user = $result->fetch_assoc();
|
|||||||
|
|
||||||
|
|
||||||
<?php include_once(dirname(dirname(dirname(__DIR__))) . '/components/insta_footer.php'); ?>
|
<?php include_once(dirname(dirname(dirname(__DIR__))) . '/components/insta_footer.php'); ?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Toggle spouse and children sections when 'Single Membership' is selected
|
||||||
|
(function() {
|
||||||
|
function setSectionState(isSingle) {
|
||||||
|
var spouse = document.getElementById('spouseSection');
|
||||||
|
var children = document.getElementById('childrenSection');
|
||||||
|
[spouse, children].forEach(function(sec) {
|
||||||
|
if (!sec) return;
|
||||||
|
var inputs = sec.querySelectorAll('input, select, textarea, button');
|
||||||
|
if (isSingle) {
|
||||||
|
sec.style.display = 'none';
|
||||||
|
inputs.forEach(function(i) {
|
||||||
|
i.disabled = true;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
sec.style.display = '';
|
||||||
|
inputs.forEach(function(i) {
|
||||||
|
i.disabled = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
var full = document.getElementById('membership_full');
|
||||||
|
var single = document.getElementById('membership_single');
|
||||||
|
|
||||||
|
// initialize state
|
||||||
|
setSectionState(single && single.checked);
|
||||||
|
|
||||||
|
if (full) full.addEventListener('change', function() {
|
||||||
|
if (this.checked) setSectionState(false);
|
||||||
|
});
|
||||||
|
if (single) single.addEventListener('change', function() {
|
||||||
|
if (this.checked) setSectionState(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
@@ -189,7 +189,7 @@ if (empty($application['id_number'])) {
|
|||||||
<td><?php echo htmlspecialchars($membership['payment_amount']); ?></td>
|
<td><?php echo htmlspecialchars($membership['payment_amount']); ?></td>
|
||||||
<td><?php echo htmlspecialchars($membership['payment_id']); ?></td>
|
<td><?php echo htmlspecialchars($membership['payment_id']); ?></td>
|
||||||
<?php if ($membership['payment_status'] == "AWAITING PAYMENT" || $membership['payment_status'] == "PENDING RENEWAL") { ?>
|
<?php if ($membership['payment_status'] == "AWAITING PAYMENT" || $membership['payment_status'] == "PENDING RENEWAL") { ?>
|
||||||
<td><a href='<?= $payment_link; ?>' class='theme-btn style-two style-three' style='padding: 0px 14px;'><span data-hover='PAY NOW'>PENDING RENEWAL</span></a></td>
|
<td><a href='<?= $payment_link; ?>' class='theme-btn style-two style-three' style='padding: 0px 14px;'><span data-hover='<?= $membership['payment_status'] ?>'><?= $membership['payment_status'] ?></span></a></td>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<td><?php echo htmlspecialchars($membership['payment_status']); ?></td>
|
<td><?php echo htmlspecialchars($membership['payment_status']); ?></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -221,7 +221,7 @@ if (empty($application['id_number'])) {
|
|||||||
|
|
||||||
if (strtotime($today) >= strtotime($threeMonthsBefore)) {
|
if (strtotime($today) >= strtotime($threeMonthsBefore)) {
|
||||||
echo '
|
echo '
|
||||||
<a href="renew_membership" class="theme-btn style-two bgc-secondary" style="width:100%; margin-top: 20px; background-color: #63ab45; padding: 10px 20px; color: white; text-decoration: none; border-radius: 25px;">
|
<a href="renewal_payment" class="theme-btn style-two bgc-secondary" style="width:100%; margin-top: 20px; background-color: #63ab45; padding: 10px 20px; color: white; text-decoration: none; border-radius: 25px;">
|
||||||
<span data-hover="Renew Membership">Renew Membership</span>
|
<span data-hover="Renew Membership">Renew Membership</span>
|
||||||
<i class="fal fa-arrow-right"></i>
|
<i class="fal fa-arrow-right"></i>
|
||||||
</a>';
|
</a>';
|
||||||
|
|||||||
@@ -14,6 +14,37 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
|
|
||||||
$full_name = getFullName($user_id);
|
$full_name = getFullName($user_id);
|
||||||
|
|
||||||
|
if (isset($_POST['membership_type'])) {
|
||||||
|
$membership_type = $_POST['membership_type'];
|
||||||
|
echo $membership_type;
|
||||||
|
//update membership_type in membership_application
|
||||||
|
$stmt = $conn->prepare("UPDATE membership_application SET membership_type = ? WHERE user_id = ? ");
|
||||||
|
$stmt->bind_param("si", $membership_type, $user_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
} else {
|
||||||
|
//get user membership type from membership_applications
|
||||||
|
$stmt = $conn->prepare("SELECT membership_type FROM membership_application WHERE user_id = ? ");
|
||||||
|
$stmt->bind_param("i", $user_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($membership_type);
|
||||||
|
$stmt->fetch();
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
//check memberhsip_applications for user_id, if 0 rows, redirect to membership_application.php
|
||||||
|
$stmt = $conn->prepare("SELECT COUNT(*) AS cnt FROM membership_application WHERE user_id = ? LIMIT 1");
|
||||||
|
$stmt->bind_param("i", $user_id);
|
||||||
|
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($application_count);
|
||||||
|
$stmt->fetch();
|
||||||
|
$stmt->close();
|
||||||
|
if ($application_count == 0) {
|
||||||
|
header("Location: membership_application.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
//if membership_fees payment_status is PENDING RENEWAL, redirect to membership_details.php
|
//if membership_fees payment_status is PENDING RENEWAL, redirect to membership_details.php
|
||||||
$stmt = $conn->prepare("SELECT payment_status FROM membership_fees WHERE user_id = ? LIMIT 1");
|
$stmt = $conn->prepare("SELECT payment_status FROM membership_fees WHERE user_id = ? LIMIT 1");
|
||||||
$stmt->bind_param("i", $user_id);
|
$stmt->bind_param("i", $user_id);
|
||||||
@@ -27,8 +58,25 @@ if ($payment_status === 'PENDING RENEWAL') {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($membership_type === 'country') {
|
||||||
|
$payment_amount = getPriceByDescription('country_membership');
|
||||||
|
} elseif ($membership_type === 'single') {
|
||||||
|
$payment_amount = getPriceByDescription('single');
|
||||||
|
} else {
|
||||||
|
$payment_amount = getPriceByDescription('membership_fees');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($membership_type === 'honorary') {
|
||||||
|
// Honorary members do not pay fees, redirect to membership details
|
||||||
|
header("Location: membership_details.php");
|
||||||
|
exit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$payment_id = generatePaymentRef('SUBS', null, $user_id);
|
$payment_id = generatePaymentRef('SUBS', null, $user_id);
|
||||||
$payment_amount = getPriceByDescription('membership_fees');
|
|
||||||
$payment_date = date('Y-m-d');
|
$payment_date = date('Y-m-d');
|
||||||
$renewal_period_end = getMembershipEndDate($user_id);
|
$renewal_period_end = getMembershipEndDate($user_id);
|
||||||
// Hardcode membership start date to 2026-03-01 per request
|
// Hardcode membership start date to 2026-03-01 per request
|
||||||
|
|||||||
182
src/pages/memberships/renewal_payment.php
Normal file
182
src/pages/memberships/renewal_payment.php
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
$rootPath = dirname(dirname(dirname(__DIR__)));
|
||||||
|
include_once($rootPath . '/header.php');
|
||||||
|
// Assuming you have the user ID stored in the session
|
||||||
|
if (isset($_SESSION['user_id'])) {
|
||||||
|
$user_id = $_SESSION['user_id'];
|
||||||
|
} else {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit(); // Stop further script execution
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize variables
|
||||||
|
$payment_amount = null;
|
||||||
|
$membership_start_date = null;
|
||||||
|
$membership_end_date = null;
|
||||||
|
|
||||||
|
$continue_processing = isMembershipExpiringSoon($user_id);
|
||||||
|
if (!$continue_processing) {
|
||||||
|
header("Location: membership_details.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine current membership type (default) and available renewal prices
|
||||||
|
$membership_type = getMembershipType($user_id);
|
||||||
|
if ($membership_type === 'honorary') {
|
||||||
|
// Honorary members do not renew
|
||||||
|
header("Location: membership_details.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch prices for all types so we can show dynamic updates client-side
|
||||||
|
$price_full = getPriceByDescription('membership_fees');
|
||||||
|
$price_single = getPriceByDescription('single');
|
||||||
|
$price_country = getPriceByDescription('country_membership');
|
||||||
|
|
||||||
|
// Set the initially displayed renewal amount based on current membership type
|
||||||
|
switch ($membership_type) {
|
||||||
|
case 'country':
|
||||||
|
$current_renewal_amount = $price_country;
|
||||||
|
break;
|
||||||
|
case 'single':
|
||||||
|
$current_renewal_amount = $price_single;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$current_renewal_amount = $price_full;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Get the user_id from the session
|
||||||
|
$user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : null;
|
||||||
|
|
||||||
|
if ($user_id) {
|
||||||
|
// Prepare the SQL query to fetch data
|
||||||
|
$query = "SELECT payment_amount, membership_start_date, membership_end_date, payment_id
|
||||||
|
FROM membership_fees
|
||||||
|
WHERE user_id = ?";
|
||||||
|
|
||||||
|
if ($stmt = $conn->prepare($query)) {
|
||||||
|
// Bind the user_id parameter to the query
|
||||||
|
$stmt->bind_param("i", $user_id);
|
||||||
|
|
||||||
|
// Execute the query
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
// Bind the results to variables
|
||||||
|
$stmt->bind_result($payment_amount, $membership_start_date, $membership_end_date, $eft_id);
|
||||||
|
|
||||||
|
// Fetch the data
|
||||||
|
if ($stmt->fetch()) {
|
||||||
|
// Values are now assigned to $payment_amount, $membership_start_date, and $membership_end_date
|
||||||
|
} else {
|
||||||
|
// Handle case where no records are found
|
||||||
|
$error_message = "No records found for the given user ID.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the statement
|
||||||
|
$stmt->close();
|
||||||
|
} else {
|
||||||
|
// Handle query preparation failure
|
||||||
|
$error_message = "Query preparation failed: " . $conn->error;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Handle case where user_id is not found in session
|
||||||
|
$error_message = "User ID not found in session.";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$pageTitle = 'Membership Renewal';
|
||||||
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
|
require_once($rootPath . '/components/banner.php');
|
||||||
|
?>
|
||||||
|
<!-- Contact Form Area start -->
|
||||||
|
<section class="about-us-area py-100 rpb-90 rel z-1">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="section-title mb-25">
|
||||||
|
<span class="h2 mb-15">Membership Renewal:</span>
|
||||||
|
<?php echo
|
||||||
|
'<h5>Membership Expiration Date: ' . $membership_end_date . '</h5>'; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h5>Renewal Amount:</h5>
|
||||||
|
|
||||||
|
<form method="post" action="renew_membership" id="renewForm">
|
||||||
|
<input type="hidden" name="csrf_token" value="<?php echo generateCSRFToken(); ?>">
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="radio" name="membership_type" id="radio_full" value="full" <?php echo ($membership_type === 'full' || $membership_type === 'member' || $membership_type === null) ? 'checked' : ''; ?>>
|
||||||
|
<label class="form-check-label" for="radio_full">Family Membership</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="radio" name="membership_type" id="radio_single" value="single" <?php echo ($membership_type === 'single') ? 'checked' : ''; ?>>
|
||||||
|
<label class="form-check-label" for="radio_single">Single Membership</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="radio" name="membership_type" id="radio_country" value="country" <?php echo ($membership_type === 'country') ? 'checked' : ''; ?>>
|
||||||
|
<label class="form-check-label" for="radio_country">Country Membership</label>
|
||||||
|
<small>You need to reside more than 150km from BASE4 to qualify.</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h5>Amount:</h5>
|
||||||
|
|
||||||
|
<h2>R <span id="renewAmount"><?php echo number_format($current_renewal_amount, 2); ?></span></h2>
|
||||||
|
|
||||||
|
<button type="submit" class="theme-btn style-two style-three" style="width:100%;">
|
||||||
|
<span data-hover="Renew Membership">Renew Membership</span>
|
||||||
|
<i class="fal fa-arrow-right"></i>
|
||||||
|
</button>
|
||||||
|
<div class="text-center mt-2">
|
||||||
|
<p>You will be redirected to iKhokha's Secure payment gateway.</p>
|
||||||
|
</div>
|
||||||
|
<img src="assets/images/logos/ikhokha.png" alt="Secure Payment Badges" style="max-width: 200px; display: block; margin: 10px auto 0;">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function(){
|
||||||
|
// Prices from server
|
||||||
|
var prices = {
|
||||||
|
full: <?php echo json_encode((float)$price_full); ?>,
|
||||||
|
single: <?php echo json_encode((float)$price_single); ?>,
|
||||||
|
country: <?php echo json_encode((float)$price_country); ?>
|
||||||
|
};
|
||||||
|
|
||||||
|
function updateAmount(type){
|
||||||
|
var amt = prices[type] !== undefined ? prices[type] : prices.full;
|
||||||
|
document.getElementById('renewAmount').textContent = amt.toFixed(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function(){
|
||||||
|
var radios = document.querySelectorAll('input[name="membership_type"]');
|
||||||
|
radios.forEach(function(r){
|
||||||
|
r.addEventListener('change', function(){
|
||||||
|
updateAmount(this.value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// initialize
|
||||||
|
var checked = document.querySelector('input[name="membership_type"]:checked');
|
||||||
|
if(checked) updateAmount(checked.value);
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6" data-aos="fade-right" data-aos-duration="1500" data-aos-offset="50">
|
||||||
|
<div class="about-us-image">
|
||||||
|
<img src="assets/images/logos/weblogo.png" alt="About">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<?php include_once(dirname(dirname(dirname(__DIR__))) . '/components/insta_footer.php'); ?>
|
||||||
@@ -141,6 +141,17 @@ include_once($rootPath . '/header.php');
|
|||||||
margin: 50px;
|
margin: 50px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-radius: 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 {
|
.obstacle-popup h4 {
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ require_once($rootPath . "/src/config/env.php");
|
|||||||
require_once($rootPath . "/src/config/session.php");
|
require_once($rootPath . "/src/config/session.php");
|
||||||
require_once($rootPath . "/src/config/connection.php");
|
require_once($rootPath . "/src/config/connection.php");
|
||||||
require_once($rootPath . "/src/config/functions.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;
|
$user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : null;
|
||||||
$payment_id = generatePaymentRef('SUBS', null, $user_id);
|
$payment_id = generatePaymentRef('SUBS', null, $user_id);
|
||||||
$status = 'AWAITING PAYMENT';
|
|
||||||
// If current month is December, attribute the membership year to the next year
|
// If current month is December, attribute the membership year to the next year
|
||||||
$currentYear = intval(date('Y'));
|
$currentYear = intval(date('Y'));
|
||||||
$month = intval(date('n'));
|
$month = intval(date('n'));
|
||||||
@@ -92,6 +93,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
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';
|
||||||
|
$honorary_member = validateHonoraryMemberName($first_name, $last_name);
|
||||||
|
if ($honorary_member) {
|
||||||
|
$membership_type = 'honorary';
|
||||||
|
} elseif ($country_membership) {
|
||||||
|
$membership_type = 'country';
|
||||||
|
} else {
|
||||||
|
$membership_type = $membership_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Spouse or Partner details (optional)
|
// Spouse or Partner details (optional)
|
||||||
$spouse_first_name = !empty($_POST['spouse_first_name']) ? validateName($_POST['spouse_first_name']) : null;
|
$spouse_first_name = !empty($_POST['spouse_first_name']) ? validateName($_POST['spouse_first_name']) : null;
|
||||||
$spouse_last_name = !empty($_POST['spouse_last_name']) ? validateName($_POST['spouse_last_name']) : null;
|
$spouse_last_name = !empty($_POST['spouse_last_name']) ? validateName($_POST['spouse_last_name']) : null;
|
||||||
@@ -136,8 +151,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
spouse_first_name, spouse_last_name, spouse_id_number, spouse_dob, spouse_occupation, spouse_tel_cell, spouse_email,
|
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,
|
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,
|
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
|
secondary_vehicle_make, secondary_vehicle_model, secondary_vehicle_year, secondary_vehicle_registration, membership_type
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
// Check if preparation was successful
|
// Check if preparation was successful
|
||||||
if (!$stmt) {
|
if (!$stmt) {
|
||||||
@@ -145,7 +160,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$stmt->bind_param(
|
$stmt->bind_param(
|
||||||
"isssssssssssssssssssssssssssssss",
|
"issssssssssssssssssssssssssssssss",
|
||||||
$user_id,
|
$user_id,
|
||||||
$first_name,
|
$first_name,
|
||||||
$last_name,
|
$last_name,
|
||||||
@@ -177,7 +192,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$secondary_vehicle_make,
|
$secondary_vehicle_make,
|
||||||
$secondary_vehicle_model,
|
$secondary_vehicle_model,
|
||||||
$secondary_vehicle_year,
|
$secondary_vehicle_year,
|
||||||
$secondary_vehicle_registration
|
$secondary_vehicle_registration,
|
||||||
|
$membership_type
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($stmt->execute()) {
|
if ($stmt->execute()) {
|
||||||
@@ -187,10 +203,27 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$year = (int)$today->format('Y');
|
$year = (int)$today->format('Y');
|
||||||
$payment_date = $today->format('Y-m-d');
|
$payment_date = $today->format('Y-m-d');
|
||||||
$membership_start_date = $payment_date;
|
$membership_start_date = $payment_date;
|
||||||
|
$status = 'AWAITING PAYMENT';
|
||||||
|
if ($membership_type === 'honorary') {
|
||||||
|
// Honorary members do not pay fees, set amount to 0 and end date far in future
|
||||||
|
$payment_amount = 0.00;
|
||||||
|
$status = 'PAID';
|
||||||
|
} elseif ($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) {
|
if ($month == 12 || $month == 1 || $month == 2) {
|
||||||
// December, January, February: charge full fee, valid till end of next Feb
|
// 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
|
// If Dec, Jan, Feb, set end to next year's Feb
|
||||||
$end_year = ($month == 12) ? $year + 2 : $year + 1;
|
$end_year = ($month == 12) ? $year + 2 : $year + 1;
|
||||||
$membership_end_date = (new DateTime("$end_year-02-01"))
|
$membership_end_date = (new DateTime("$end_year-02-01"))
|
||||||
@@ -198,7 +231,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
->format('Y-m-d');
|
->format('Y-m-d');
|
||||||
} else {
|
} else {
|
||||||
// Prorata for Mar-Nov
|
// Prorata for Mar-Nov
|
||||||
$payment_amount = calculateProrata(getPriceByDescription('pro_rata'));
|
$payment_amount = $prorata_amount;
|
||||||
// End of next Feb if after Feb, else this Feb
|
// End of next Feb if after Feb, else this Feb
|
||||||
if ($month > 2) {
|
if ($month > 2) {
|
||||||
$end_year = $year + 1;
|
$end_year = $year + 1;
|
||||||
@@ -209,10 +242,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
->modify('last day of this month')
|
->modify('last day of this month')
|
||||||
->format('Y-m-d');
|
->format('Y-m-d');
|
||||||
}
|
}
|
||||||
|
if ($membership_type === 'honorary') {
|
||||||
|
// Honorary members do not pay fees, set amount to 0 and end date far in future
|
||||||
|
$membership_end_date = '2099-12-31';
|
||||||
|
}
|
||||||
|
|
||||||
$stmt = $conn->prepare("INSERT INTO membership_fees (user_id, payment_amount, payment_date, membership_start_date, membership_end_date, renewal_period_end, payment_status, payment_id)
|
$stmt = $conn->prepare("INSERT INTO membership_fees (user_id, payment_amount, payment_date, membership_start_date, membership_end_date, renewal_period_end, payment_status, payment_id)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, 'AWAITING PAYMENT', ?)");
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
$stmt->bind_param("idsssss", $user_id, $payment_amount, $payment_date, $membership_start_date, $membership_end_date, $membership_end_date, $payment_id);
|
$stmt->bind_param("idssssss", $user_id, $payment_amount, $payment_date, $membership_start_date, $membership_end_date, $membership_end_date, $status, $payment_id);
|
||||||
|
|
||||||
if ($stmt->execute()) {
|
if ($stmt->execute()) {
|
||||||
// Commit the transaction
|
// Commit the transaction
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 4.9 KiB |
Reference in New Issue
Block a user