Compare commits
1 Commits
feature/bl
...
062dc46ffd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
062dc46ffd |
@@ -2,7 +2,7 @@
|
||||
checkAdmin();
|
||||
|
||||
// Fetch all trips
|
||||
$courseSql = "SELECT date, course_id, course_type FROM courses WHERE DATE(date) >= CURDATE()";
|
||||
$courseSql = "SELECT date, course_id, course_type FROM courses";
|
||||
|
||||
$courseResult = $conn->query($courseSql);
|
||||
if (!$courseResult) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
assets/images/promo/KaiBroom.jpg
Normal file
BIN
assets/images/promo/KaiBroom.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
BIN
assets/images/promo/Nov_promo.jpg
Normal file
BIN
assets/images/promo/Nov_promo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 340 KiB |
Binary file not shown.
BIN
assets/images/promo/october_openday.jpg
Normal file
BIN
assets/images/promo/october_openday.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 374 KiB |
BIN
assets/images/promo/september_openday.jpg
Normal file
BIN
assets/images/promo/september_openday.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 482 KiB |
2
blog.php
2
blog.php
@@ -64,7 +64,7 @@ if (!empty($bannerImages)) {
|
||||
<div class="col-lg-8">
|
||||
<?php
|
||||
// Query to retrieve data from the trips table
|
||||
$sql = "SELECT blog_id, title, date, category, image, description, author, members_only, link FROM blogs ORDER BY date DESC";
|
||||
$sql = "SELECT blog_id, title, date, category, image, description, author, members_only, link FROM blogs WHERE status = 'published' ORDER BY date DESC";
|
||||
$result = $conn->query($sql);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
checkUserSession();
|
||||
|
||||
// SQL query to fetch dates for driver training
|
||||
$sql = "SELECT course_id, date FROM courses WHERE course_type = 'bush_mechanics'";
|
||||
$sql = "SELECT course_id, date FROM courses WHERE course_type = 'bush_mechanics' AND date >= CURDATE()";
|
||||
$result = $conn->query($sql);
|
||||
$page_id = 'bush_mechanics';
|
||||
?>
|
||||
@@ -114,7 +114,7 @@ if (!empty($bannerImages)) {
|
||||
</select>
|
||||
</li>
|
||||
<?php
|
||||
if ($is_member) {
|
||||
if ($is_member || $pending_member) {
|
||||
echo '
|
||||
<li>
|
||||
Additional Members <span class="price"></span>
|
||||
@@ -169,8 +169,16 @@ if (!empty($bannerImages)) {
|
||||
<label for="agreeCheckbox" id="agreeLabel" style="color: #888;">I have read and agree to the indemnity terms</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="theme-btn style-two w-100 mt-15 mb-5">
|
||||
<span data-hover="Book Now">Book Now</span>
|
||||
<?php
|
||||
$button_text = "Book Now";
|
||||
$button_disabled = "";
|
||||
if (!$result || $result->num_rows == 0) {
|
||||
$button_text = "No booking dates available";
|
||||
$button_disabled = "disabled";
|
||||
}
|
||||
?>
|
||||
<button type="submit" class="theme-btn style-two w-100 mt-15 mb-5" <?php echo $button_disabled; ?>>
|
||||
<span data-hover="<?php echo $button_text; ?>"><?php echo $button_text; ?></span>
|
||||
<i class="fal fa-arrow-right"></i>
|
||||
</button>
|
||||
<div class="text-center">
|
||||
@@ -357,6 +365,7 @@ if (!empty($bannerImages)) {
|
||||
|
||||
// Fetch PHP variables
|
||||
var isMember = <?php echo $is_member ? 'true' : 'false'; ?>;
|
||||
var pendingMember = <?php echo $pending_member ? 'true' : 'false'; ?>;
|
||||
var cost_members = <?= getPrice('bush_mechanics', 'member');?>;
|
||||
var cost_nonmembers = <?= getPrice('bush_mechanics', 'nonmember');?>;
|
||||
|
||||
@@ -364,7 +373,7 @@ if (!empty($bannerImages)) {
|
||||
var total = 0;
|
||||
|
||||
// Calculate cost for members
|
||||
if (isMember) {
|
||||
if (isMember || pendingMember) {
|
||||
total = (cost_members) + (members * cost_members) + (nonmembers * cost_nonmembers);
|
||||
} else {
|
||||
// Calculate cost for non-members
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
checkUserSession();
|
||||
|
||||
// SQL query to fetch dates for driver training
|
||||
$sql = "SELECT course_id, date FROM courses WHERE course_type = 'driver_training'";
|
||||
$sql = "SELECT course_id, date
|
||||
FROM courses
|
||||
WHERE course_type = 'driver_training'
|
||||
AND date >= CURDATE()";
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$page_id = 'driver_training';
|
||||
|
||||
?>
|
||||
|
||||
<style>
|
||||
@@ -99,11 +104,11 @@ if (!empty($bannerImages)) {
|
||||
Select Date
|
||||
<select name="course_id" id="course_id" required>
|
||||
<?php
|
||||
if ($result->num_rows > 0) {
|
||||
if ($result && $result->num_rows > 0) {
|
||||
// Output each course as an option
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$course_id = htmlspecialchars($row['course_id']); // Escape output for security
|
||||
$date = htmlspecialchars($row['date']); // Escape output for security
|
||||
$date = htmlspecialchars($row['date']); // Escape output for security
|
||||
echo "<option value='$course_id'>$date</option>";
|
||||
}
|
||||
} else {
|
||||
@@ -111,9 +116,10 @@ if (!empty($bannerImages)) {
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
</li>
|
||||
<?php
|
||||
if ($is_member) {
|
||||
if ($is_member || $pending_member) {
|
||||
echo '
|
||||
<li>
|
||||
Additional Members <span class="price"></span>
|
||||
@@ -136,6 +142,7 @@ if (!empty($bannerImages)) {
|
||||
<option value="3">03</option>
|
||||
</select>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<hr class="mb-25">
|
||||
|
||||
@@ -168,8 +175,16 @@ if (!empty($bannerImages)) {
|
||||
<label for="agreeCheckbox" id="agreeLabel" style="color: #888;">I have read and agree to the indemnity terms</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="theme-btn style-two w-100 mt-15 mb-5">
|
||||
<span data-hover="Book Now">Book Now</span>
|
||||
<?php
|
||||
$button_text = "Book Now";
|
||||
$button_disabled = "";
|
||||
if (!$result || $result->num_rows == 0) {
|
||||
$button_text = "No booking dates available";
|
||||
$button_disabled = "disabled";
|
||||
}
|
||||
?>
|
||||
<button type="submit" class="theme-btn style-two w-100 mt-15 mb-5" <?php echo $button_disabled; ?>>
|
||||
<span data-hover="<?php echo $button_text; ?>"><?php echo $button_text; ?></span>
|
||||
<i class="fal fa-arrow-right"></i>
|
||||
</button>
|
||||
<div class="text-center">
|
||||
@@ -355,6 +370,7 @@ if (!empty($bannerImages)) {
|
||||
|
||||
// Fetch PHP variables
|
||||
var isMember = <?php echo $is_member ? 'true' : 'false'; ?>;
|
||||
var pendingMember = <?php echo $pending_member ? 'true' : 'false'; ?>;
|
||||
var cost_members = <?= getPrice('driver_training', 'member'); ?>;
|
||||
var cost_nonmembers = <?= getPrice('driver_training', 'nonmember'); ?>;
|
||||
|
||||
@@ -362,7 +378,7 @@ if (!empty($bannerImages)) {
|
||||
var total = 0;
|
||||
|
||||
// Calculate cost for members
|
||||
if (isMember) {
|
||||
if (isMember || pendingMember) {
|
||||
total = (cost_members) + (members * cost_members) + (nonmembers * cost_nonmembers);
|
||||
} else {
|
||||
// Calculate cost for non-members
|
||||
|
||||
193
functions.php
193
functions.php
@@ -189,6 +189,83 @@ function sendInvoice($email, $name, $eft_id, $amount, $description)
|
||||
}
|
||||
}
|
||||
|
||||
function getEFTDetails($eft_id) {
|
||||
$conn = openDatabaseConnection();
|
||||
$stmt = $conn->prepare("SELECT amount, description FROM efts WHERE eft_id = ? LIMIT 1");
|
||||
$stmt->bind_param("s", $eft_id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
if ($row = $result->fetch_assoc()) {
|
||||
return [
|
||||
'amount' => $row['amount'],
|
||||
'description' => $row['description']
|
||||
];
|
||||
} else {
|
||||
return false; // EFT not found
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function sendPOP($fullname, $eft_id, $amount, $description)
|
||||
{
|
||||
global $mailjet;
|
||||
|
||||
$message = [
|
||||
'Messages' => [
|
||||
[
|
||||
'From' => [
|
||||
'Email' => "info@4wdcsa.co.za",
|
||||
'Name' => "4WDCSA Web Admin"
|
||||
],
|
||||
'To' => [
|
||||
[
|
||||
'Email' => 'chrispintoza@gmail.com',
|
||||
'Name' => 'Chris Pinto'
|
||||
],
|
||||
[
|
||||
'Email' => 'info@4wdcsa.co.za',
|
||||
'Name' => 'Jacqui Boshoff'
|
||||
],
|
||||
[
|
||||
'Email' => 'louiseb@global.co.za',
|
||||
'Name' => 'Louise Blignault'
|
||||
]
|
||||
],
|
||||
'TemplateID' => 7054062,
|
||||
'TemplateLanguage' => true,
|
||||
'Subject' => "4WDCSA - Proof of Payment Received",
|
||||
'Variables' => [
|
||||
'fullname' => $fullname,
|
||||
'eft_id' => $eft_id,
|
||||
'amount' => $amount,
|
||||
'description' => $description,
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$client = new Client([
|
||||
// Base URI is used with relative requests
|
||||
'base_uri' => 'https://api.mailjet.com/v3.1/',
|
||||
]);
|
||||
|
||||
$response = $client->request('POST', 'send', [
|
||||
'json' => $message,
|
||||
'auth' => ['1a44f8d5e847537dbb8d3c76fe73a93c', 'ec98b45c53a7694c4f30d09eee9ad280']
|
||||
]);
|
||||
|
||||
if ($response->getStatusCode() == 200) {
|
||||
$body = $response->getBody();
|
||||
$response = json_decode($body);
|
||||
if ($response->Messages[0]->Status == 'success') {
|
||||
return True;
|
||||
} else {
|
||||
return False;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function sendEmail($email, $subject, $message)
|
||||
{
|
||||
global $mailjet;
|
||||
@@ -414,6 +491,91 @@ function getUserMemberStatus($user_id)
|
||||
return false; // Membership is not active
|
||||
}
|
||||
|
||||
function getUserMemberStatusPending($user_id)
|
||||
{
|
||||
|
||||
$conn = openDatabaseConnection();
|
||||
|
||||
// Step 1: Check if the user is a member
|
||||
$queryUser = "SELECT member FROM users WHERE user_id = ?";
|
||||
$stmtUser = $conn->prepare($queryUser);
|
||||
if (!$stmtUser) {
|
||||
error_log("Failed to prepare user query: " . $conn->error);
|
||||
return false;
|
||||
}
|
||||
|
||||
$stmtUser->bind_param('i', $user_id);
|
||||
$stmtUser->execute();
|
||||
$resultUser = $stmtUser->get_result();
|
||||
$stmtUser->close();
|
||||
|
||||
if ($resultUser->num_rows === 0) {
|
||||
error_log("User not found for user_id: $user_id");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Step 3: Check the membership_application table for accept_indemnity status
|
||||
$queryApplication = "SELECT accept_indemnity FROM membership_application WHERE user_id = ?";
|
||||
$stmtApplication = $conn->prepare($queryApplication);
|
||||
if (!$stmtApplication) {
|
||||
error_log("Failed to prepare application query: " . $conn->error);
|
||||
return false;
|
||||
}
|
||||
|
||||
$stmtApplication->bind_param('i', $user_id);
|
||||
$stmtApplication->execute();
|
||||
$resultApplication = $stmtApplication->get_result();
|
||||
$stmtApplication->close();
|
||||
|
||||
if ($resultApplication->num_rows === 0) {
|
||||
error_log("No membership application found for user_id: $user_id");
|
||||
return false;
|
||||
}
|
||||
|
||||
$application = $resultApplication->fetch_assoc();
|
||||
$accept_indemnity = $application['accept_indemnity'];
|
||||
|
||||
// Validate accept_indemnity
|
||||
if ($accept_indemnity !== 1) {
|
||||
error_log("User has not accepted indemnity for user_id: $user_id");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Step 2: Check membership fees table for valid payment status and membership_end_date
|
||||
$queryFees = "SELECT payment_status, membership_end_date FROM membership_fees WHERE user_id = ?";
|
||||
$stmtFees = $conn->prepare($queryFees);
|
||||
if (!$stmtFees) {
|
||||
error_log("Failed to prepare fees query: " . $conn->error);
|
||||
return false;
|
||||
}
|
||||
|
||||
$stmtFees->bind_param('i', $user_id);
|
||||
$stmtFees->execute();
|
||||
$resultFees = $stmtFees->get_result();
|
||||
$stmtFees->close();
|
||||
|
||||
if ($resultFees->num_rows === 0) {
|
||||
error_log("Membership fees not found for user_id: $user_id");
|
||||
return false;
|
||||
}
|
||||
|
||||
$fees = $resultFees->fetch_assoc();
|
||||
$payment_status = $fees['payment_status'];
|
||||
$membership_end_date = $fees['membership_end_date'];
|
||||
|
||||
// Validate payment status and membership_end_date
|
||||
$current_date = new DateTime();
|
||||
$membership_end_date_obj = DateTime::createFromFormat('Y-m-d', $membership_end_date);
|
||||
|
||||
if ($payment_status === "AWAITING PAYMENT" && $current_date <= $membership_end_date_obj) {
|
||||
return true; // Membership is pending
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false; // Membership is not pending
|
||||
}
|
||||
|
||||
function checkUserSession()
|
||||
{
|
||||
|
||||
@@ -961,19 +1123,21 @@ function checkSuperAdmin()
|
||||
|
||||
function calculateProrata($prorata)
|
||||
{
|
||||
// Get the current month as a number (1 = January, 12 = December)
|
||||
// Get current month number (1 = January, 12 = December)
|
||||
$currentMonth = date('n');
|
||||
|
||||
// Total months in a year
|
||||
// Shift months so March becomes month 1 in the cycle
|
||||
// (March=1, April=2, ..., February=12)
|
||||
$shiftedMonth = ($currentMonth - 3 + 12) % 12 + 1;
|
||||
|
||||
// Total months in a "March to February" year
|
||||
$totalMonths = 12;
|
||||
|
||||
// Calculate the remaining months including the current month
|
||||
$remainingMonths = $totalMonths - $currentMonth + 1;
|
||||
// Calculate remaining months including the current month
|
||||
$remainingMonths = $totalMonths - $shiftedMonth + 1;
|
||||
|
||||
// Multiply by prorata value
|
||||
$prorataAmount = $remainingMonths * $prorata;
|
||||
|
||||
return $prorataAmount;
|
||||
return $remainingMonths * $prorata;
|
||||
}
|
||||
|
||||
function getFullName($user_id)
|
||||
@@ -1798,3 +1962,18 @@ function getCommentCount($page_id) {
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
function hasPhoneNumber($user_id) {
|
||||
|
||||
$conn = openDatabaseConnection();
|
||||
// Prepare SQL
|
||||
$stmt = $conn->prepare("SELECT phone_number FROM users WHERE id = ? LIMIT 1");
|
||||
$stmt->bind_param("i", $user_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($phone_number);
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
// Return true only if a phone number exists and is not empty
|
||||
return !empty($phone_number);
|
||||
}
|
||||
|
||||
@@ -7,12 +7,14 @@ require_once("functions.php");
|
||||
$is_logged_in = isset($_SESSION['user_id']);
|
||||
if (isset($_SESSION['user_id'])) {
|
||||
$is_member = getUserMemberStatus($_SESSION['user_id']);
|
||||
$pending_member = getUserMemberStatusPending($_SESSION['user_id']);
|
||||
$user_id = $_SESSION['user_id'];
|
||||
} else {
|
||||
$is_member = false;
|
||||
}
|
||||
$role = getUserRole();
|
||||
logVisitor();
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
@@ -8,6 +8,7 @@ $is_logged_in = isset($_SESSION['user_id']);
|
||||
$role = getUserRole();
|
||||
if (isset($_SESSION['user_id'])) {
|
||||
$is_member = getUserMemberStatus($_SESSION['user_id']);
|
||||
$pending_member = getUserMemberStatusPending($_SESSION['user_id']);
|
||||
$user_id = $_SESSION['user_id'];
|
||||
}
|
||||
logVisitor();
|
||||
|
||||
184
index.php
184
index.php
@@ -112,7 +112,7 @@ if (countUpcomingTrips() > 0) { ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<span class="location"><i class="fal fa-map-marker-alt"></i> ' . $location . '</span>
|
||||
<h5><a href="trip-details.php?trip_id=' . $trip_id . '">' . $trip_name . '</a></h5>
|
||||
<h5><a href="trip-details.php?token=' . encryptData($trip_id, $salt) . '">' . $trip_name . '</a></h5>
|
||||
<span class="time">' . convertDate($start_date) . ' - ' . convertDate($end_date) . '</span><br>
|
||||
<span class="time">' . calculateDaysAndNights($start_date, $end_date) . '</span>
|
||||
</div>
|
||||
@@ -190,105 +190,6 @@ if (countUpcomingTrips() > 0) { ?>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
<!-- Popular Destinations Area start -->
|
||||
<!-- <section class="popular-destinations-area rel z-1">
|
||||
<div class="container-fluid">
|
||||
<div class="popular-destinations-wrap br-20 bgc-lighter pt-100 pb-70">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-12">
|
||||
<div class="section-title text-center counter-text-wrap mb-70" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
|
||||
<h2>Explore Popular Destinations</h2>
|
||||
<p>One site <span class="count-text plus" data-speed="3000" data-stop="34500">0</span> most popular experience</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xl-3 col-md-6">
|
||||
<div class="destination-item style-two" data-aos="flip-up" data-aos-duration="1500" data-aos-offset="50">
|
||||
<div class="image">
|
||||
<a href="#" class="heart"><i class="fas fa-heart"></i></a>
|
||||
<img src="assets/images/destinations/destination1.jpg" alt="Destination">
|
||||
</div>
|
||||
<div class="content">
|
||||
<h6><a href="destination-details.html">Thailand beach</a></h6>
|
||||
<span class="time">5352+ tours & 856+ Activity</span>
|
||||
<a href="#" class="more"><i class="fas fa-chevron-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-3 col-md-6">
|
||||
<div class="destination-item style-two" data-aos="flip-up" data-aos-delay="100" data-aos-duration="1500" data-aos-offset="50">
|
||||
<div class="image">
|
||||
<a href="#" class="heart"><i class="fas fa-heart"></i></a>
|
||||
<img src="assets/images/destinations/destination2.jpg" alt="Destination">
|
||||
</div>
|
||||
<div class="content">
|
||||
<h6><a href="destination-details.html">Parga, Greece</a></h6>
|
||||
<span class="time">5352+ tours & 856+ Activity</span>
|
||||
<a href="#" class="more"><i class="fas fa-chevron-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="destination-item style-two" data-aos="flip-up" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
||||
<div class="image">
|
||||
<a href="#" class="heart"><i class="fas fa-heart"></i></a>
|
||||
<img src="assets/images/destinations/destination3.jpg" alt="Destination">
|
||||
</div>
|
||||
<div class="content">
|
||||
<h6><a href="destination-details.html">Castellammare del Golfo, Italy</a></h6>
|
||||
<span class="time">5352+ tours & 856+ Activity</span>
|
||||
<a href="#" class="more"><i class="fas fa-chevron-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="destination-item style-two" data-aos="flip-up" data-aos-duration="1500" data-aos-offset="50">
|
||||
<div class="image">
|
||||
<a href="#" class="heart"><i class="fas fa-heart"></i></a>
|
||||
<img src="assets/images/destinations/destination4.jpg" alt="Destination">
|
||||
</div>
|
||||
<div class="content">
|
||||
<h6><a href="destination-details.html">Reserve of Canada, Canada</a></h6>
|
||||
<span class="time">5352+ tours & 856+ Activity</span>
|
||||
<a href="#" class="more"><i class="fas fa-chevron-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-3 col-md-6">
|
||||
<div class="destination-item style-two" data-aos="flip-up" data-aos-delay="100" data-aos-duration="1500" data-aos-offset="50">
|
||||
<div class="image">
|
||||
<a href="#" class="heart"><i class="fas fa-heart"></i></a>
|
||||
<img src="assets/images/destinations/destination5.jpg" alt="Destination">
|
||||
</div>
|
||||
<div class="content">
|
||||
<h6><a href="destination-details.html">Dubai united states</a></h6>
|
||||
<span class="time">5352+ tours & 856+ Activity</span>
|
||||
<a href="#" class="more"><i class="fas fa-chevron-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-3 col-md-6">
|
||||
<div class="destination-item style-two" data-aos="flip-up" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
||||
<div class="image">
|
||||
<a href="#" class="heart"><i class="fas fa-heart"></i></a>
|
||||
<img src="assets/images/destinations/destination6.jpg" alt="Destination">
|
||||
</div>
|
||||
<div class="content">
|
||||
<h6><a href="destination-details.html">Milos, Greece</a></h6>
|
||||
<span class="time">5352+ tours & 856+ Activity</span>
|
||||
<a href="#" class="more"><i class="fas fa-chevron-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section> -->
|
||||
<!-- Popular Destinations Area end -->
|
||||
|
||||
|
||||
<!-- Features Area start -->
|
||||
<section class="features-area pt-100 pb-45 rel z-1">
|
||||
@@ -311,31 +212,6 @@ if (countUpcomingTrips() > 0) { ?>
|
||||
<i class="fal fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
<!-- <div class="menu-btns py-10">
|
||||
<a href="campsite_booking.php" class="theme-btn style-two bgc-secondary">
|
||||
<span data-hover="Book a Campsite">Book a Campsite</span>
|
||||
<i class="fal fa-arrow-right"></i>
|
||||
</a>
|
||||
</div> -->
|
||||
|
||||
|
||||
|
||||
<!-- <div class="features-customer-box">
|
||||
<div class="image">
|
||||
<img src="assets/images/features/features-box.jpg" alt="Features">
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="feature-authors mb-15">
|
||||
<img src="assets/images/features/feature-author1.jpg" alt="Author">
|
||||
<img src="assets/images/features/feature-author2.jpg" alt="Author">
|
||||
<img src="assets/images/features/feature-author3.jpg" alt="Author">
|
||||
<span>4k+</span>
|
||||
</div>
|
||||
<h6>850K+ Happy Customer</h6>
|
||||
<div class="divider style-two counter-text-wrap my-25"><span><span class="count-text plus" data-speed="3000" data-stop="25">0</span> Years</span></div>
|
||||
<p>We pride ourselves offering personalized itineraries</p>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-6" data-aos="fade-right" data-aos-duration="1500" data-aos-offset="50">
|
||||
@@ -478,56 +354,10 @@ if (countUpcomingTrips() > 0) { ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="hotel-more-btn text-center mt-40">
|
||||
<a href="destination2.html" class="theme-btn style-four">
|
||||
<span data-hover="Explore More Hotel">Explore More Hotel</span>
|
||||
<i class="fal fa-arrow-right"></i>
|
||||
</a>
|
||||
</div> -->
|
||||
</div>
|
||||
</section>
|
||||
<!-- Hotel Area end -->
|
||||
|
||||
<!-- CTA Area start -->
|
||||
<!-- <section class="cta-area pt-100 rel z-1">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xl-4 col-md-6" data-aos="zoom-in-down" data-aos-duration="1500" data-aos-offset="50">
|
||||
<div class="cta-item" style="background-image: url(assets/images/cta/cta1.jpg);">
|
||||
<span class="category">Tent Camping</span>
|
||||
<h2>Explore the world best tourism</h2>
|
||||
<a href="trip-details.php" class="theme-btn style-two bgc-secondary">
|
||||
<span data-hover="Explore Tours">Explore Tours</span>
|
||||
<i class="fal fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-md-6" data-aos="zoom-in-down" data-aos-delay="50" data-aos-duration="1500" data-aos-offset="50">
|
||||
<div class="cta-item" style="background-image: url(assets/images/cta/cta2.jpg);">
|
||||
<span class="category">Sea Beach</span>
|
||||
<h2>World largest Sea Beach in Thailand</h2>
|
||||
<a href="trip-details.php" class="theme-btn style-two">
|
||||
<span data-hover="Explore Tours">Explore Tours</span>
|
||||
<i class="fal fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-md-6" data-aos="zoom-in-down" data-aos-delay="100" data-aos-duration="1500" data-aos-offset="50">
|
||||
<div class="cta-item" style="background-image: url(assets/images/cta/cta3.jpg);">
|
||||
<span class="category">Water Falls</span>
|
||||
<h2>Largest Water falls Bali, Indonesia</h2>
|
||||
<a href="trip-details.php" class="theme-btn style-two bgc-secondary">
|
||||
<span data-hover="Explore Tours">Explore Tours</span>
|
||||
<i class="fal fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section> -->
|
||||
<!-- CTA Area end -->
|
||||
|
||||
|
||||
<!-- Blog Area start -->
|
||||
<section class="blog-area py-70 rel z-1">
|
||||
<div class="container">
|
||||
@@ -541,7 +371,7 @@ if (countUpcomingTrips() > 0) { ?>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<?php
|
||||
$sql = "SELECT blog_id, title, date, category, image, description, author, link, members_only FROM blogs ORDER BY date DESC LIMIT 3";
|
||||
$sql = "SELECT blog_id, title, date, category, image, description, author, link, members_only FROM blogs WHERE status = 'published' ORDER BY date DESC LIMIT 3";
|
||||
$result = $conn->query($sql);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
@@ -664,16 +494,6 @@ if (countUpcomingTrips() > 0) { ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--
|
||||
<form class="newsletter-form mb-50" action="#">
|
||||
<input id="news-email" type="email" placeholder="Email Address" required>
|
||||
<button type="submit" class="theme-btn bgc-secondary style-two">
|
||||
<span data-hover="Subscribe">Subscribe</span>
|
||||
<i class="fal fa-arrow-right"></i>
|
||||
</button>
|
||||
</form> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
3
phpinfo.php
Normal file
3
phpinfo.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
echo phpinfo();
|
||||
@@ -113,7 +113,24 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$payment_amount = calculateProrata(210); // Assuming a fixed membership fee, adjust as needed
|
||||
$payment_date = date('Y-m-d');
|
||||
$membership_start_date = $payment_date;
|
||||
$membership_end_date = date('Y-12-31');
|
||||
// $membership_end_date = date('Y-12-31');
|
||||
|
||||
// Get today's date
|
||||
$today = new DateTime();
|
||||
|
||||
// Determine the target February
|
||||
if ($today->format('n') > 2) {
|
||||
// If we're past February, target is next year's Feb 28/29
|
||||
$year = $today->format('Y') + 1;
|
||||
} else {
|
||||
// Otherwise, this year's February
|
||||
$year = $today->format('Y');
|
||||
}
|
||||
|
||||
// Handle leap year (Feb 29) automatically
|
||||
$membership_end_date = (new DateTime("$year-02-01"))
|
||||
->modify('last day of this month')
|
||||
->format('Y-m-d');
|
||||
|
||||
$stmt = $conn->prepare("INSERT INTO membership_fees (user_id, payment_amount, payment_date, membership_start_date, membership_end_date, payment_status, payment_id)
|
||||
VALUES (?, ?, ?, ?, ?, 'PENDING', ?)");
|
||||
|
||||
@@ -14,11 +14,12 @@ if (!$user_id) {
|
||||
exit();
|
||||
}
|
||||
$is_member = getUserMemberStatus($user_id);
|
||||
$pending_member = getUserMemberStatusPending($user_id);
|
||||
|
||||
// Check if the form has been submitted
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// Input variables from the form (use default values if not provided)
|
||||
$members = isset($_POST['members']) ? intval($_POST['members']) : 0; // Default to 1 vehicle
|
||||
$additional_members = isset($_POST['members']) ? intval($_POST['members']) : 0; // Default to 1 vehicle
|
||||
$num_adults = isset($_POST['non-members']) ? intval($_POST['non-members']) : 0; // Default to 1 adult
|
||||
$course_id = isset($_POST['course_id']) ? intval($_POST['course_id']) : 0; // Default to 0 children
|
||||
checkAndRedirectCourseBooking($course_id);
|
||||
@@ -54,16 +55,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$description = "General Course " . $date; // Default fallback description
|
||||
}
|
||||
|
||||
// Assume the membership status is determined elsewhere
|
||||
$is_member = getUserMemberStatus($user_id);
|
||||
|
||||
// Initialize total and discount amount
|
||||
$total = 0;
|
||||
|
||||
// Calculate total based on membership
|
||||
if ($is_member) {
|
||||
$num_members = 1 + $members;
|
||||
$total = (($cost_members) + ($members * $cost_members) + ($num_adults * $cost_nonmembers));
|
||||
if ($is_member || $pending_member) {
|
||||
$num_members = 1 + $additional_members;
|
||||
$total = ($num_members * $cost_members) + ($num_adults * $cost_nonmembers);
|
||||
$payment_amount = $total;
|
||||
} else {
|
||||
$num_members = 0;
|
||||
@@ -78,18 +76,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$num_vehicles = 1;
|
||||
$discountAmount = 0;
|
||||
$eft_id = strtoupper("COURSE ".date("m-d", strtotime($date))." ".getInitialSurname($user_id));
|
||||
$notes = "";
|
||||
if ($pending_member){
|
||||
$notes = "Membership Payment pending at time of booking. Please confirm payment has been received.";
|
||||
}
|
||||
|
||||
|
||||
// Insert booking into the database
|
||||
$sql = "INSERT INTO bookings (booking_type, user_id, from_date, to_date, num_vehicles, num_adults, total_amount, discount_amount, status, payment_id, course_id, course_non_members, eft_id)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
$sql = "INSERT INTO bookings (booking_type, user_id, from_date, to_date, num_vehicles, num_adults, total_amount, discount_amount, status, payment_id, course_id, course_non_members, eft_id, notes)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
$stmt = $conn->prepare($sql);
|
||||
|
||||
if (!$stmt) {
|
||||
die("Preparation failed: " . $conn->error);
|
||||
}
|
||||
|
||||
$stmt->bind_param('sissiiddssiis', $type, $user_id, $date, $date, $num_vehicles, $num_members, $total, $discountAmount, $status, $payment_id, $course_id, $num_adults, $eft_id);
|
||||
$stmt->bind_param('sissiiddssiiss', $type, $user_id, $date, $date, $num_vehicles, $num_members, $total, $discountAmount, $status, $payment_id, $course_id, $num_adults, $eft_id, $notes);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
$booking_id = $conn->insert_id;
|
||||
@@ -114,28 +116,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
echo "Error processing booking: $error_message";
|
||||
}
|
||||
|
||||
// if ($stmt->execute()) {
|
||||
// if ($payment_amount < 1) {
|
||||
// if (processZeroPayment($payment_id, $payment_amount, $description)) {
|
||||
// echo "<script>alert('Booking successfully created!'); window.location.href = 'bookings.php';</script>";
|
||||
// } else {
|
||||
// $error_message = $stmt->error;
|
||||
// echo "Error processing booking: $error_message";
|
||||
// }
|
||||
// } else {
|
||||
// if (processPayment($payment_id, $payment_amount, $description)) {
|
||||
// echo "<script>alert('Booking successfully created!'); window.location.href = 'bookings.php';</script>";
|
||||
// } else {
|
||||
// $error_message = $stmt->error;
|
||||
// echo "Error processing booking: $error_message";
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// // Handle error if insert fails and echo the MySQL error
|
||||
// $error_message = $stmt->error;
|
||||
// echo "Error processing booking: $error_message";
|
||||
// }
|
||||
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
checkUserSession();
|
||||
|
||||
// SQL query to fetch dates for driver training
|
||||
$sql = "SELECT course_id, date FROM courses WHERE course_type = 'rescue_recovery'";
|
||||
$sql = "SELECT course_id, date FROM courses WHERE course_type = 'rescue_recovery' AND date >= CURDATE()";
|
||||
$result = $conn->query($sql);
|
||||
$page_id = 'rescue_recovery';
|
||||
?>
|
||||
@@ -113,7 +113,7 @@ if (!empty($bannerImages)) {
|
||||
</select>
|
||||
</li>
|
||||
<?php
|
||||
if ($is_member) {
|
||||
if ($is_member || $pending_member) {
|
||||
echo '
|
||||
<li>
|
||||
Additional Members <span class="price"></span>
|
||||
@@ -168,8 +168,16 @@ if (!empty($bannerImages)) {
|
||||
<label for="agreeCheckbox" id="agreeLabel" style="color: #888;">I have read and agree to the indemnity terms</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="theme-btn style-two w-100 mt-15 mb-5">
|
||||
<span data-hover="Book Now">Book Now</span>
|
||||
<?php
|
||||
$button_text = "Book Now";
|
||||
$button_disabled = "";
|
||||
if (!$result || $result->num_rows == 0) {
|
||||
$button_text = "No booking dates available";
|
||||
$button_disabled = "disabled";
|
||||
}
|
||||
?>
|
||||
<button type="submit" class="theme-btn style-two w-100 mt-15 mb-5" <?php echo $button_disabled; ?>>
|
||||
<span data-hover="<?php echo $button_text; ?>"><?php echo $button_text; ?></span>
|
||||
<i class="fal fa-arrow-right"></i>
|
||||
</button>
|
||||
<div class="text-center">
|
||||
@@ -290,6 +298,7 @@ if (!empty($bannerImages)) {
|
||||
|
||||
// Fetch PHP variables
|
||||
var isMember = <?php echo $is_member ? 'true' : 'false'; ?>;
|
||||
var pendingMember = <?php echo $pending_member ? 'true' : 'false'; ?>;
|
||||
var cost_members = <?= getPrice('rescue_recovery', 'member'); ?>;
|
||||
var cost_nonmembers = <?= getPrice('rescue_recovery', 'nonmember'); ?>;
|
||||
|
||||
@@ -297,7 +306,7 @@ if (!empty($bannerImages)) {
|
||||
var total = 0;
|
||||
|
||||
// Calculate cost for members
|
||||
if (isMember) {
|
||||
if (isMember || pendingMember) {
|
||||
total = (cost_members) + (members * cost_members) + (nonmembers * cost_nonmembers);
|
||||
} else {
|
||||
// Calculate cost for non-members
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php include_once('header02.php');
|
||||
checkUserSession();
|
||||
umask(002); // At the top of the PHP script, before move_uploaded_file()
|
||||
|
||||
|
||||
$user_id = $_SESSION['user_id'] ?? null;
|
||||
|
||||
@@ -50,6 +52,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
|
||||
if (move_uploaded_file($file['tmp_name'], $target_file)) {
|
||||
chmod($target_file, 0664);
|
||||
// Update EFT and booking status
|
||||
$payment_type = $_POST['payment_type'] ?? 'booking';
|
||||
|
||||
@@ -73,43 +76,33 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$stmt2->execute();
|
||||
}
|
||||
|
||||
// Notify n8n and send the path to the uploaded file
|
||||
$webhook_url = 'https://n8n.4wdcsa.co.za/webhook/process-pop';
|
||||
// Send notification email using sendPOP()
|
||||
$fullname = getFullName($user_id); // Assuming this returns "First Last"
|
||||
|
||||
$eftDetails = getEFTDetails($eft_id);
|
||||
$modified = str_replace(' ', '_', $eft_id);
|
||||
|
||||
$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;
|
||||
if ($eftDetails) {
|
||||
$amount = "R" . number_format($eftDetails['amount'], 2);
|
||||
$description = $eftDetails['description'];
|
||||
} else {
|
||||
echo "<div class='alert alert-danger'>Unable to move uploaded file.</div>";
|
||||
echo "<pre>Tmp file exists? " . (file_exists($file['tmp_name']) ? "Yes" : "No") . "</pre>";
|
||||
echo "<pre>Tmp file path: " . htmlspecialchars($file['tmp_name']) . "</pre>";
|
||||
exit;
|
||||
$amount = "R0.00";
|
||||
$description = "Payment"; // fallback
|
||||
}
|
||||
|
||||
|
||||
if (sendPOP($fullname, $modified, $amount, $description)) {
|
||||
$_SESSION['message'] = "Thank you! Your payment proof has been uploaded and notification sent.";
|
||||
} else {
|
||||
$_SESSION['message'] = "Payment uploaded, but notification email could not be sent.";
|
||||
}
|
||||
|
||||
header("Location: bookings.php");
|
||||
exit;
|
||||
|
||||
} else {
|
||||
echo "<div class='alert alert-danger'>Unable to move uploaded file.</div>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user