Compare commits
12 Commits
feature/si
...
1d7a50709e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d7a50709e | ||
|
|
7e544311e3 | ||
|
|
0143f5dd12 | ||
|
|
45523720ea | ||
|
|
4c839d02c0 | ||
|
|
cbb52cda35 | ||
|
|
2544676685 | ||
|
|
84dc35c8d5 | ||
|
|
2f94c17c28 | ||
|
|
110c853945 | ||
|
|
0d01c7da90 | ||
|
|
938ce4e15e |
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
$page_id = 'agm_minutes';
|
$page_id = 'agm_minutes';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -65,28 +67,15 @@ $page_id = 'agm_minutes';
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clearfix {
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('assets/images/blog/2/agm.jpg');">
|
<?php
|
||||||
<div class="banner-overlay"></div>
|
$pageTitle = '2025 AGM Minutes';
|
||||||
<div class="container">
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
<div class="banner-inner text-white">
|
require_once('components/banner.php');
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">2025 AGM Minutes & Chairman's Report</h2>
|
?>
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">2025 AGM Minutes & Chairman's Report</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Blog Detaisl Area start -->
|
<!-- Blog Detaisl Area start -->
|
||||||
<section class="blog-detaisl-page py-100 rel z-1">
|
<section class="blog-detaisl-page py-100 rel z-1">
|
||||||
|
|||||||
4
404.php
4
404.php
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
368
DATABASE_SERVICE_EXAMPLES.md
Normal file
368
DATABASE_SERVICE_EXAMPLES.md
Normal file
@@ -0,0 +1,368 @@
|
|||||||
|
# DatabaseService Usage Examples
|
||||||
|
|
||||||
|
This document shows how to refactor existing code to use the new `DatabaseService` class for cleaner, more maintainable database operations.
|
||||||
|
|
||||||
|
## Current State
|
||||||
|
|
||||||
|
Files are using the procedural MySQLi pattern:
|
||||||
|
```php
|
||||||
|
$stmt = $conn->prepare("SELECT * FROM users WHERE email = ?");
|
||||||
|
$stmt->bind_param("s", $email);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
$stmt->close();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 1: Simple SELECT (admin_members.php)
|
||||||
|
|
||||||
|
### Current Code
|
||||||
|
```php
|
||||||
|
$stmt = $conn->prepare("SELECT user_id, first_name, last_name, tel_cell, email, dob, accept_indemnity FROM membership_application");
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
// Then in HTML/JS loop:
|
||||||
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
// display row
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using DatabaseService
|
||||||
|
```php
|
||||||
|
// Simple - get all records
|
||||||
|
$members = $db->select("SELECT user_id, first_name, last_name, tel_cell, email, dob, accept_indemnity FROM membership_application");
|
||||||
|
|
||||||
|
// In HTML/JS loop:
|
||||||
|
foreach ($members as $row) {
|
||||||
|
// display row
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Benefits:**
|
||||||
|
- No manual `bind_param()`, `execute()`, `close()` needed
|
||||||
|
- Returns array directly
|
||||||
|
- Automatic error tracking via `$db->getLastError()`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Example 2: SELECT with Parameters (validate_login.php)
|
||||||
|
|
||||||
|
### Current Code
|
||||||
|
```php
|
||||||
|
$query = "SELECT * FROM users WHERE email = ?";
|
||||||
|
$stmt = $conn->prepare($query);
|
||||||
|
$stmt->bind_param("s", $email);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows == 1) {
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
// use $row
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using DatabaseService
|
||||||
|
```php
|
||||||
|
$user = $db->selectOne(
|
||||||
|
"SELECT * FROM users WHERE email = ?",
|
||||||
|
[$email],
|
||||||
|
"s" // s = string type
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($user) {
|
||||||
|
// use $user - returns false if no row found
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Benefits:**
|
||||||
|
- One-liner for single row
|
||||||
|
- Handles null checks automatically
|
||||||
|
- Type specification clear in parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Example 3: INSERT (validate_login.php)
|
||||||
|
|
||||||
|
### Current Code
|
||||||
|
```php
|
||||||
|
$query = "INSERT INTO users (email, first_name, last_name, profile_pic, password, is_verified) VALUES (?, ?, ?, ?, ?, ?)";
|
||||||
|
$stmt = $conn->prepare($query);
|
||||||
|
$is_verified = 1;
|
||||||
|
$stmt->bind_param("sssssi", $email, $first_name, $last_name, $picture, $password, $is_verified);
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$user_id = $conn->insert_id; // ❌ Bug: insert_id from $conn, not $stmt
|
||||||
|
// use $user_id
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using DatabaseService
|
||||||
|
```php
|
||||||
|
$user_id = $db->insert(
|
||||||
|
"INSERT INTO users (email, first_name, last_name, profile_pic, password, is_verified) VALUES (?, ?, ?, ?, ?, ?)",
|
||||||
|
[$email, $first_name, $last_name, $picture, $password, 1],
|
||||||
|
"sssssi"
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($user_id) {
|
||||||
|
// $user_id contains the auto-increment ID
|
||||||
|
} else {
|
||||||
|
$error = $db->getLastError();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Benefits:**
|
||||||
|
- Returns insert ID directly
|
||||||
|
- Automatic error handling
|
||||||
|
- Cleaner parameter list
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Example 4: UPDATE (admin_members.php)
|
||||||
|
|
||||||
|
### Current Code
|
||||||
|
```php
|
||||||
|
$user_id = intval($_POST['user_id']);
|
||||||
|
$stmt = $conn->prepare("UPDATE membership_application SET accept_indemnity = 1 WHERE user_id = ?");
|
||||||
|
if ($stmt) {
|
||||||
|
$stmt->bind_param("i", $user_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using DatabaseService
|
||||||
|
```php
|
||||||
|
$user_id = intval($_POST['user_id']);
|
||||||
|
$affectedRows = $db->update(
|
||||||
|
"UPDATE membership_application SET accept_indemnity = 1 WHERE user_id = ?",
|
||||||
|
[$user_id],
|
||||||
|
"i"
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($affectedRows !== false) {
|
||||||
|
// Updated successfully, $affectedRows = number of rows changed
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Benefits:**
|
||||||
|
- Returns affected row count
|
||||||
|
- No manual statement closing
|
||||||
|
- Error available via `$db->getLastError()`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Example 5: COUNT / EXISTS
|
||||||
|
|
||||||
|
### Current Pattern (Need 3 lines)
|
||||||
|
```php
|
||||||
|
$stmt = $conn->prepare("SELECT COUNT(*) as count FROM users WHERE email = ?");
|
||||||
|
$stmt->bind_param("s", $email);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
if ($row['count'] > 0) { /* exists */ }
|
||||||
|
$stmt->close();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using DatabaseService (One line)
|
||||||
|
```php
|
||||||
|
$exists = $db->exists("users", "email = ?", [$email], "s");
|
||||||
|
if ($exists) {
|
||||||
|
// User exists
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Benefits:**
|
||||||
|
- Boolean result
|
||||||
|
- Intent is clear
|
||||||
|
- One-liner
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Example 6: Multiple Rows with Filtering
|
||||||
|
|
||||||
|
### Current Code
|
||||||
|
```php
|
||||||
|
$status = 'active';
|
||||||
|
$stmt = $conn->prepare("SELECT * FROM members WHERE status = ? ORDER BY last_name ASC");
|
||||||
|
$stmt->bind_param("s", $status);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
$members = [];
|
||||||
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
$members[] = $row;
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using DatabaseService
|
||||||
|
```php
|
||||||
|
$members = $db->select(
|
||||||
|
"SELECT * FROM members WHERE status = ? ORDER BY last_name ASC",
|
||||||
|
['active'],
|
||||||
|
"s"
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
**Benefits:**
|
||||||
|
- Returns array directly
|
||||||
|
- No loop needed
|
||||||
|
- 2 lines vs 8 lines
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Example 7: Error Handling
|
||||||
|
|
||||||
|
### Current Pattern
|
||||||
|
```php
|
||||||
|
$stmt = $conn->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
if (!$stmt) {
|
||||||
|
echo "Prepare failed: " . $conn->error;
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$stmt->bind_param("i", $id);
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
echo "Execute failed: " . $stmt->error;
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using DatabaseService
|
||||||
|
```php
|
||||||
|
$user = $db->selectOne("SELECT * FROM users WHERE id = ?", [$id], "i");
|
||||||
|
if ($user === false) {
|
||||||
|
$error = $db->getLastError();
|
||||||
|
error_log("Database error: " . $error);
|
||||||
|
// handle error
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Benefits:**
|
||||||
|
- Error handling centralized
|
||||||
|
- No null checks for each step
|
||||||
|
- Debug via `$db->getLastQuery()`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Example 8: Transactions
|
||||||
|
|
||||||
|
### Current Pattern
|
||||||
|
```php
|
||||||
|
$conn->begin_transaction();
|
||||||
|
try {
|
||||||
|
$stmt = $conn->prepare("INSERT INTO orders ...");
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
$stmt = $conn->prepare("UPDATE inventory ...");
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
$conn->commit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$conn->rollback();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using DatabaseService
|
||||||
|
```php
|
||||||
|
$db->beginTransaction();
|
||||||
|
|
||||||
|
$order_id = $db->insert("INSERT INTO orders ...", [...], "...");
|
||||||
|
if ($order_id === false) {
|
||||||
|
$db->rollback();
|
||||||
|
exit("Order creation failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
$updated = $db->update("UPDATE inventory ...", [...], "...");
|
||||||
|
if ($updated === false) {
|
||||||
|
$db->rollback();
|
||||||
|
exit("Inventory update failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->commit();
|
||||||
|
```
|
||||||
|
|
||||||
|
**Benefits:**
|
||||||
|
- Unified transaction API
|
||||||
|
- Built-in error checking
|
||||||
|
- Clean rollback on failure
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Type Specification Reference
|
||||||
|
|
||||||
|
When using DatabaseService methods, specify parameter types:
|
||||||
|
|
||||||
|
| Type | Meaning | Example |
|
||||||
|
|------|---------|---------|
|
||||||
|
| `"i"` | Integer | `user_id = 5` |
|
||||||
|
| `"d"` | Double/Float | `price = 19.99` |
|
||||||
|
| `"s"` | String | `email = 'test@example.com'` |
|
||||||
|
| `"b"` | Blob | Binary data |
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```php
|
||||||
|
// Single parameter
|
||||||
|
$db->select("SELECT * FROM users WHERE id = ?", [123], "i");
|
||||||
|
|
||||||
|
// Multiple parameters
|
||||||
|
$db->select(
|
||||||
|
"SELECT * FROM users WHERE email = ? AND status = ?",
|
||||||
|
["test@example.com", "active"],
|
||||||
|
"ss"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Mixed types
|
||||||
|
$db->select(
|
||||||
|
"SELECT * FROM orders WHERE user_id = ? AND total > ? AND date = ?",
|
||||||
|
[5, 100.50, "2025-01-01"],
|
||||||
|
"ids" // integer, double, string
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Migration Path
|
||||||
|
|
||||||
|
### Phase 1: New Code
|
||||||
|
Start using `$db` for all new features and AJAX endpoints.
|
||||||
|
|
||||||
|
### Phase 2: High-Traffic Files
|
||||||
|
Refactor popular files:
|
||||||
|
1. `validate_login.php` - Login is critical
|
||||||
|
2. `functions.php` - Helper functions
|
||||||
|
3. `admin_members.php`, `admin_payments.php` - Admin pages
|
||||||
|
|
||||||
|
### Phase 3: Gradual Rollout
|
||||||
|
As each file is refactored, commit and test thoroughly before moving to next.
|
||||||
|
|
||||||
|
### Phase 4: Full Migration
|
||||||
|
Eventually all procedural `$conn->prepare()` patterns replaced.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Benefits Summary
|
||||||
|
|
||||||
|
| Aspect | Before | After |
|
||||||
|
|--------|--------|-------|
|
||||||
|
| Lines per query | 5-8 | 1-3 |
|
||||||
|
| Error handling | Manual checks | Automatic |
|
||||||
|
| Type safety | bind_param() | Parameter array |
|
||||||
|
| Statement closing | Manual | Automatic |
|
||||||
|
| Insert ID handling | `$conn->insert_id` (buggy) | Direct return |
|
||||||
|
| Debugging | Check multiple vars | `getLastError()`, `getLastQuery()` |
|
||||||
|
| Consistency | Varies | Unified API |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
1. Start with one file (e.g., `admin_members.php`)
|
||||||
|
2. Convert simple queries first
|
||||||
|
3. Test thoroughly
|
||||||
|
4. Commit and move to next file
|
||||||
|
5. Keep `$conn` available for complex queries that don't fit the standard patterns
|
||||||
|
|
||||||
|
The `$db` service makes your code **cleaner, safer, and easier to maintain**.
|
||||||
30
about.php
30
about.php
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -37,31 +39,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<!-- Page Banner Start -->
|
|
||||||
<?php
|
<?php
|
||||||
$bannerFolder = 'assets/images/banners/';
|
$pageTitle = 'About';
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<!-- Overlay PNG -->
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white mb-50">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">About</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">About</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Benefit Area start -->
|
<!-- Benefit Area start -->
|
||||||
<section class="benefit-area mt-100 rel z-1">
|
<section class="benefit-area mt-100 rel z-1">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkAdmin();
|
checkAdmin();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkAdmin();
|
checkAdmin();
|
||||||
|
|
||||||
// Fetch all trips
|
// Fetch all trips
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkAdmin();
|
checkAdmin();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkAdmin();
|
checkAdmin();
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['accept_indemnity'])) {
|
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['accept_indemnity'])) {
|
||||||
@@ -11,10 +13,10 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['accept_indemnity']))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SQL query to fetch data
|
// SQL query to fetch membership applications
|
||||||
$sql = "SELECT user_id, first_name, last_name, tel_cell, email, dob, accept_indemnity FROM membership_application";
|
$stmt = $conn->prepare("SELECT user_id, first_name, last_name, tel_cell, email, dob, accept_indemnity FROM membership_application");
|
||||||
|
$stmt->execute();
|
||||||
$result = $conn->query($sql);
|
$result = $stmt->get_result();
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
table {
|
table {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkAdmin();
|
checkAdmin();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkAdmin();
|
checkAdmin();
|
||||||
|
|
||||||
// Fetch all trips
|
// Fetch all trips
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkAdmin();
|
checkAdmin();
|
||||||
// SQL query to fetch data
|
// SQL query to fetch data
|
||||||
$sql = "SELECT ip_address, user_id, page_url, referrer_url, visit_time, country FROM visitor_logs WHERE NOT (ip_address = '185.203.122.69' OR ip_address = '156.155.29.213') ORDER BY visit_time DESC";
|
$sql = "SELECT ip_address, user_id, page_url, referrer_url, visit_time, country FROM visitor_logs WHERE NOT (ip_address = '185.203.122.69' OR ip_address = '156.155.29.213') ORDER BY visit_time DESC";
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkSuperAdmin();
|
checkSuperAdmin();
|
||||||
// SQL query to fetch data
|
// SQL query to fetch data
|
||||||
$sql = "SELECT user_id, first_name, last_name, email, member, date_joined, token, is_verified, profile_pic FROM users";
|
$sql = "SELECT user_id, first_name, last_name, email, member, date_joined, token, is_verified, profile_pic FROM users";
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
$user_id = $_SESSION['user_id'];
|
$user_id = $_SESSION['user_id'];
|
||||||
unset($_SESSION['cart']);
|
unset($_SESSION['cart']);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
// 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'];
|
||||||
@@ -36,33 +38,11 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<!-- Page Banner Start -->
|
|
||||||
<?php
|
<?php
|
||||||
$bannerFolder = 'assets/images/banners/';
|
$pageTitle = 'Indemnity';
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Indemnity</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item ">Membership</li>
|
|
||||||
<li class="breadcrumb-item ">Application</li>
|
|
||||||
<li class="breadcrumb-item active">Indemnity</li>
|
|
||||||
<li class="breadcrumb-item ">Payment</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
<!-- Page Banner End -->
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
$page_id = 'best_0f_ec';
|
$page_id = 'best_0f_ec';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -65,31 +67,15 @@ $page_id = 'best_0f_ec';
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clearfix {
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$pageTitle = 'Best of the Eastern Cape 2024';
|
||||||
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('assets/images/blog/1/cover.jpg');">
|
require_once('components/banner.php');
|
||||||
<div class="banner-overlay"></div>
|
?>
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Best of the Eastern Cape 2024</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">Best of the Eastern Cape 2024</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Blog Detaisl Area start -->
|
<!-- Blog Detaisl Area start -->
|
||||||
<section class="blog-detaisl-page py-100 rel z-1">
|
<section class="blog-detaisl-page py-100 rel z-1">
|
||||||
|
|||||||
45
blog.php
45
blog.php
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php') ?>
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php') ?>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.image {
|
.image {
|
||||||
@@ -26,35 +28,11 @@
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style><?php
|
||||||
|
$pageTitle = 'Blogs';
|
||||||
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
<?php
|
|
||||||
$bannerFolder = 'assets/images/banners/';
|
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
|
||||||
|
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<!-- Overlay PNG -->
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Blogs</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">Blogs</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Blog List Area start -->
|
<!-- Blog List Area start -->
|
||||||
@@ -63,9 +41,12 @@ if (!empty($bannerImages)) {
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
<?php
|
<?php
|
||||||
// Query to retrieve data from the trips table
|
// Query to retrieve data from blogs table
|
||||||
$sql = "SELECT blog_id, title, date, category, image, description, author, members_only, link FROM blogs WHERE status = 'published' ORDER BY date DESC";
|
$status = 'published';
|
||||||
$result = $conn->query($sql);
|
$stmt = $conn->prepare("SELECT blog_id, title, date, category, image, description, author, members_only, link FROM blogs WHERE status = ? ORDER BY date DESC");
|
||||||
|
$stmt->bind_param("s", $status);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
// Loop through each row
|
// Loop through each row
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php') ?>
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php') ?>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.image {
|
.image {
|
||||||
@@ -29,20 +31,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('assets/images/blog/1/cover.jpg');">
|
<?php
|
||||||
<div class="container">
|
$pageTitle = 'Blog Details';
|
||||||
<div class="banner-inner text-white">
|
$breadcrumbs = [['Home' => 'index.php'], ['Blogs' => 'blog.php']];
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Best of the Eastern Cape 2024</h2>
|
require_once('components/banner.php');
|
||||||
<nav aria-label="breadcrumb">
|
?>
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">Best of the Eastern Cape 2024</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Blog Detaisl Area start -->
|
<!-- Blog Detaisl Area start -->
|
||||||
|
|||||||
28
bookings.php
28
bookings.php
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
$user_id = $_SESSION['user_id'];
|
$user_id = $_SESSION['user_id'];
|
||||||
|
|
||||||
@@ -57,28 +59,10 @@ $user_id = $_SESSION['user_id'];
|
|||||||
</style>
|
</style>
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
$bannerFolder = 'assets/images/banners/';
|
$pageTitle = 'My Bookings';
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white mb-50">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">My Bookings</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">My bookings</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<!-- Tour List Area start -->
|
<!-- Tour List Area start -->
|
||||||
<section class="tour-list-page py-100 rel z-1">
|
<section class="tour-list-page py-100 rel z-1">
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
|
|
||||||
// SQL query to fetch dates for driver training
|
// SQL query to fetch dates for bush mechanics
|
||||||
$sql = "SELECT course_id, date FROM courses WHERE course_type = 'bush_mechanics' AND date >= CURDATE()";
|
$stmt = $conn->prepare("SELECT course_id, date FROM courses WHERE course_type = ? AND date >= CURDATE()");
|
||||||
$result = $conn->query($sql);
|
$course_type = 'bush_mechanics';
|
||||||
|
$stmt->bind_param("s", $course_type);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
$page_id = 'bush_mechanics';
|
$page_id = 'bush_mechanics';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -18,32 +23,11 @@ $page_id = 'bush_mechanics';
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style><?php
|
||||||
|
$pageTitle = 'Bush Mechanics';
|
||||||
<?php
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
$bannerFolder = 'assets/images/banners/';
|
require_once('components/banner.php');
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
|
||||||
|
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Bush Mechanics</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">Bush Mechanics</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
|
|
||||||
<!-- Product Details Start -->
|
<!-- Product Details Start -->
|
||||||
<section class="product-details pt-100">
|
<section class="product-details pt-100">
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
|
|
||||||
$conn = openDatabaseConnection();
|
$conn = openDatabaseConnection();
|
||||||
$result = $conn->query("SELECT * FROM campsites");
|
$stmt = $conn->prepare("SELECT * FROM campsites");
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
$campsites = [];
|
$campsites = [];
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
$campsites[] = $row;
|
$campsites[] = $row;
|
||||||
@@ -20,33 +24,14 @@ while ($row = $result->fetch_assoc()) {
|
|||||||
|
|
||||||
.info-box img {
|
.info-box img {
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$bannerFolder = 'assets/images/banners/';
|
$pageTitle = 'Campsites';
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white mb-50">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Campsites</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">Campsites</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<!-- Tour List Area start -->
|
<!-- Tour List Area start -->
|
||||||
<section class="tour-list-page py-100 rel z-1">
|
<section class="tour-list-page py-100 rel z-1">
|
||||||
|
|||||||
320
classes/DatabaseService.php
Normal file
320
classes/DatabaseService.php
Normal file
@@ -0,0 +1,320 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* DatabaseService Class
|
||||||
|
*
|
||||||
|
* Provides a centralized database abstraction layer for all database operations.
|
||||||
|
* Enforces prepared statements, proper error handling, and type safety.
|
||||||
|
*
|
||||||
|
* @package 4WDCSA
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
class DatabaseService {
|
||||||
|
private $conn;
|
||||||
|
private $lastError = null;
|
||||||
|
private $lastQuery = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor - Initialize database connection
|
||||||
|
*
|
||||||
|
* @param mysqli $connection The MySQLi connection object
|
||||||
|
*/
|
||||||
|
public function __construct($connection) {
|
||||||
|
if (!$connection) {
|
||||||
|
throw new Exception("Database connection failed");
|
||||||
|
}
|
||||||
|
$this->conn = $connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the last error message
|
||||||
|
*
|
||||||
|
* @return string|null The last error or null if no error
|
||||||
|
*/
|
||||||
|
public function getLastError() {
|
||||||
|
return $this->lastError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the last executed query
|
||||||
|
*
|
||||||
|
* @return string|null The last query or null
|
||||||
|
*/
|
||||||
|
public function getLastQuery() {
|
||||||
|
return $this->lastQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute a SELECT query with parameter binding
|
||||||
|
*
|
||||||
|
* @param string $query SQL query with ? placeholders
|
||||||
|
* @param array $params Parameters to bind
|
||||||
|
* @param string $types Type specification string (e.g., "isi" for int, string, int)
|
||||||
|
* @return array|false Array of results or false on error
|
||||||
|
*/
|
||||||
|
public function select($query, $params = [], $types = "") {
|
||||||
|
try {
|
||||||
|
$this->lastQuery = $query;
|
||||||
|
$stmt = $this->conn->prepare($query);
|
||||||
|
|
||||||
|
if (!$stmt) {
|
||||||
|
$this->lastError = "Prepare failed: " . $this->conn->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($params) && !empty($types)) {
|
||||||
|
if (!$stmt->bind_param($types, ...$params)) {
|
||||||
|
$this->lastError = "Bind failed: " . $stmt->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
$this->lastError = "Execute failed: " . $stmt->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
$data[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->lastError = $e->getMessage();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute a SELECT query returning a single row
|
||||||
|
*
|
||||||
|
* @param string $query SQL query with ? placeholders
|
||||||
|
* @param array $params Parameters to bind
|
||||||
|
* @param string $types Type specification string
|
||||||
|
* @return array|false Single row as associative array or false
|
||||||
|
*/
|
||||||
|
public function selectOne($query, $params = [], $types = "") {
|
||||||
|
$results = $this->select($query, $params, $types);
|
||||||
|
return ($results && count($results) > 0) ? $results[0] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute an INSERT query
|
||||||
|
*
|
||||||
|
* @param string $query SQL query with ? placeholders
|
||||||
|
* @param array $params Parameters to bind
|
||||||
|
* @param string $types Type specification string
|
||||||
|
* @return int|false Last insert ID or false on error
|
||||||
|
*/
|
||||||
|
public function insert($query, $params = [], $types = "") {
|
||||||
|
try {
|
||||||
|
$this->lastQuery = $query;
|
||||||
|
$stmt = $this->conn->prepare($query);
|
||||||
|
|
||||||
|
if (!$stmt) {
|
||||||
|
$this->lastError = "Prepare failed: " . $this->conn->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($params) && !empty($types)) {
|
||||||
|
if (!$stmt->bind_param($types, ...$params)) {
|
||||||
|
$this->lastError = "Bind failed: " . $stmt->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
$this->lastError = "Execute failed: " . $stmt->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$insertId = $stmt->insert_id;
|
||||||
|
$stmt->close();
|
||||||
|
return $insertId;
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->lastError = $e->getMessage();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute an UPDATE query
|
||||||
|
*
|
||||||
|
* @param string $query SQL query with ? placeholders
|
||||||
|
* @param array $params Parameters to bind
|
||||||
|
* @param string $types Type specification string
|
||||||
|
* @return int|false Number of affected rows or false on error
|
||||||
|
*/
|
||||||
|
public function update($query, $params = [], $types = "") {
|
||||||
|
try {
|
||||||
|
$this->lastQuery = $query;
|
||||||
|
$stmt = $this->conn->prepare($query);
|
||||||
|
|
||||||
|
if (!$stmt) {
|
||||||
|
$this->lastError = "Prepare failed: " . $this->conn->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($params) && !empty($types)) {
|
||||||
|
if (!$stmt->bind_param($types, ...$params)) {
|
||||||
|
$this->lastError = "Bind failed: " . $stmt->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
$this->lastError = "Execute failed: " . $stmt->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$affectedRows = $stmt->affected_rows;
|
||||||
|
$stmt->close();
|
||||||
|
return $affectedRows;
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->lastError = $e->getMessage();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute a DELETE query
|
||||||
|
*
|
||||||
|
* @param string $query SQL query with ? placeholders
|
||||||
|
* @param array $params Parameters to bind
|
||||||
|
* @param string $types Type specification string
|
||||||
|
* @return int|false Number of affected rows or false on error
|
||||||
|
*/
|
||||||
|
public function delete($query, $params = [], $types = "") {
|
||||||
|
return $this->update($query, $params, $types);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute an arbitrary query (for complex queries)
|
||||||
|
*
|
||||||
|
* @param string $query SQL query with ? placeholders
|
||||||
|
* @param array $params Parameters to bind
|
||||||
|
* @param string $types Type specification string
|
||||||
|
* @return mixed Query result or false on error
|
||||||
|
*/
|
||||||
|
public function execute($query, $params = [], $types = "") {
|
||||||
|
try {
|
||||||
|
$this->lastQuery = $query;
|
||||||
|
$stmt = $this->conn->prepare($query);
|
||||||
|
|
||||||
|
if (!$stmt) {
|
||||||
|
$this->lastError = "Prepare failed: " . $this->conn->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($params) && !empty($types)) {
|
||||||
|
if (!$stmt->bind_param($types, ...$params)) {
|
||||||
|
$this->lastError = "Bind failed: " . $stmt->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
$this->lastError = "Execute failed: " . $stmt->error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->close();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->lastError = $e->getMessage();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count rows matching a condition
|
||||||
|
*
|
||||||
|
* @param string $table Table name
|
||||||
|
* @param string $where WHERE clause (without WHERE keyword)
|
||||||
|
* @param array $params Parameters to bind
|
||||||
|
* @param string $types Type specification string
|
||||||
|
* @return int|false Row count or false on error
|
||||||
|
*/
|
||||||
|
public function count($table, $where = "1=1", $params = [], $types = "") {
|
||||||
|
$query = "SELECT COUNT(*) as count FROM {$table} WHERE {$where}";
|
||||||
|
$result = $this->selectOne($query, $params, $types);
|
||||||
|
return ($result) ? (int)$result['count'] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a record exists
|
||||||
|
*
|
||||||
|
* @param string $table Table name
|
||||||
|
* @param string $where WHERE clause (without WHERE keyword)
|
||||||
|
* @param array $params Parameters to bind
|
||||||
|
* @param string $types Type specification string
|
||||||
|
* @return bool True if record exists, false otherwise
|
||||||
|
*/
|
||||||
|
public function exists($table, $where, $params = [], $types = "") {
|
||||||
|
$count = $this->count($table, $where, $params, $types);
|
||||||
|
return ($count !== false && $count > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the MySQLi connection object for advanced operations
|
||||||
|
*
|
||||||
|
* @return mysqli The MySQLi connection
|
||||||
|
*/
|
||||||
|
public function getConnection() {
|
||||||
|
return $this->conn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start a transaction
|
||||||
|
*
|
||||||
|
* @return bool Success status
|
||||||
|
*/
|
||||||
|
public function beginTransaction() {
|
||||||
|
try {
|
||||||
|
$this->conn->begin_transaction();
|
||||||
|
return true;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->lastError = $e->getMessage();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Commit a transaction
|
||||||
|
*
|
||||||
|
* @return bool Success status
|
||||||
|
*/
|
||||||
|
public function commit() {
|
||||||
|
try {
|
||||||
|
$this->conn->commit();
|
||||||
|
return true;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->lastError = $e->getMessage();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollback a transaction
|
||||||
|
*
|
||||||
|
* @return bool Success status
|
||||||
|
*/
|
||||||
|
public function rollback() {
|
||||||
|
try {
|
||||||
|
$this->conn->rollback();
|
||||||
|
return true;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->lastError = $e->getMessage();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -10,7 +10,13 @@ $conn = openDatabaseConnection();
|
|||||||
|
|
||||||
// Handle comment post
|
// Handle comment post
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['submit_comment'])) {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['submit_comment'])) {
|
||||||
$comment = $conn->real_escape_string(trim($_POST['comment']));
|
// Validate CSRF token
|
||||||
|
if (!isset($_POST['csrf_token']) || !validateCSRFToken($_POST['csrf_token'])) {
|
||||||
|
http_response_code(403);
|
||||||
|
die('Security token validation failed.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$comment = trim($_POST['comment'] ?? '');
|
||||||
|
|
||||||
if (!empty($comment)) {
|
if (!empty($comment)) {
|
||||||
$stmt = $conn->prepare("INSERT INTO comments (page_id, user_id, comment) VALUES (?, ?, ?)");
|
$stmt = $conn->prepare("INSERT INTO comments (page_id, user_id, comment) VALUES (?, ?, ?)");
|
||||||
|
|||||||
72
components/banner.php
Normal file
72
components/banner.php
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* REUSABLE PAGE BANNER COMPONENT
|
||||||
|
*
|
||||||
|
* Displays a page banner with background image, title, and breadcrumb navigation.
|
||||||
|
*
|
||||||
|
* Usage in your page:
|
||||||
|
*
|
||||||
|
* <?php
|
||||||
|
* $pageTitle = 'About';
|
||||||
|
* $bannerImage = 'assets/images/blog/cover.jpg'; // optional
|
||||||
|
* require_once('components/banner.php');
|
||||||
|
* ?>
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* $pageTitle (required) - Page title to display
|
||||||
|
* $bannerImage (optional) - URL to banner background image. If not set, uses random banner
|
||||||
|
* $breadcrumbs (optional) - Array of breadcrumb items. Default: [['Home' => 'index.php']]
|
||||||
|
* $classes (optional) - Additional CSS classes for banner section
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Default values
|
||||||
|
$pageTitle = $pageTitle ?? 'Page';
|
||||||
|
$bannerImage = $bannerImage ?? '';
|
||||||
|
$breadcrumbs = $breadcrumbs ?? [['Home' => 'index.php']];
|
||||||
|
$classes = $classes ?? '';
|
||||||
|
|
||||||
|
// If no banner image provided, try to use random banner
|
||||||
|
if (empty($bannerImage)) {
|
||||||
|
$bannerFolder = 'assets/images/banners/';
|
||||||
|
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
||||||
|
$bannerImage = !empty($bannerImages) ? $bannerImages[array_rand($bannerImages)] : 'assets/images/base4/camping.jpg';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the page title to breadcrumbs as last item (not a link)
|
||||||
|
$breadcrumbItems = [];
|
||||||
|
foreach ($breadcrumbs as $item) {
|
||||||
|
foreach ($item as $label => $url) {
|
||||||
|
$breadcrumbItems[] = ['label' => $label, 'url' => $url];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$breadcrumbItems[] = ['label' => $pageTitle, 'url' => null];
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Page Banner Start -->
|
||||||
|
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover <?php echo $classes; ?>" style="background-image: url('<?php echo $bannerImage; ?>');">
|
||||||
|
<!-- Overlay PNG -->
|
||||||
|
<div class="banner-overlay"></div>
|
||||||
|
<div class="container">
|
||||||
|
<div class="banner-inner text-white mb-50">
|
||||||
|
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">
|
||||||
|
<?php echo htmlspecialchars($pageTitle); ?>
|
||||||
|
</h2>
|
||||||
|
<nav aria-label="breadcrumb">
|
||||||
|
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
||||||
|
<?php foreach ($breadcrumbItems as $item): ?>
|
||||||
|
<li class="breadcrumb-item <?php echo $item['url'] === null ? 'active' : ''; ?>">
|
||||||
|
<?php if ($item['url']): ?>
|
||||||
|
<a href="<?php echo htmlspecialchars($item['url']); ?>">
|
||||||
|
<?php echo htmlspecialchars($item['label']); ?>
|
||||||
|
</a>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo htmlspecialchars($item['label']); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<!-- Page Banner End -->
|
||||||
@@ -13,3 +13,7 @@ if(!$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname)){
|
|||||||
}
|
}
|
||||||
|
|
||||||
date_default_timezone_set('Africa/Johannesburg');
|
date_default_timezone_set('Africa/Johannesburg');
|
||||||
|
|
||||||
|
// Initialize DatabaseService for modern queries
|
||||||
|
require_once(__DIR__ . '/classes/DatabaseService.php');
|
||||||
|
$db = new DatabaseService($conn);
|
||||||
|
|||||||
33
contact.php
33
contact.php
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php') ?>
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php') ?>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.image {
|
.image {
|
||||||
@@ -24,32 +26,11 @@
|
|||||||
display: block;
|
display: block;
|
||||||
/* Prevents inline whitespace issues */
|
/* Prevents inline whitespace issues */
|
||||||
}
|
}
|
||||||
</style>
|
</style><?php
|
||||||
|
$pageTitle = 'Contact Us';
|
||||||
<?php
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
$bannerFolder = 'assets/images/banners/';
|
require_once('components/banner.php');
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
|
||||||
|
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Contact Us</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.html">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">Contact Us</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Contact Info Area start -->
|
<!-- Contact Info Area start -->
|
||||||
|
|||||||
@@ -1,26 +1,22 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
|
|
||||||
// SQL query to fetch dates for driver training
|
// SQL query to fetch dates for driver training
|
||||||
$sql = "SELECT course_id, date FROM courses WHERE course_type = 'driver_training'";
|
$stmt = $conn->prepare("SELECT course_id, date FROM courses WHERE course_type = ?");
|
||||||
$result = $conn->query($sql);
|
$course_type = 'driver_training';
|
||||||
|
$stmt->bind_param("s", $course_type);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Page Banner Start -->
|
<?php
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url(assets/images/banner/banner.jpg);">
|
$pageTitle = 'Course Details';
|
||||||
<div class="container">
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
<div class="banner-inner text-white">
|
require_once('components/banner.php');
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">4X4 Driver Training</h2>
|
?>
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">4X4 Driver Training</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
<!-- Page Banner End -->
|
||||||
|
|
||||||
<!-- Product Details Start -->
|
<!-- Product Details Start -->
|
||||||
|
|||||||
@@ -12,35 +12,41 @@ if (!isset($_POST['csrf_token']) || !validateCSRFToken($_POST['csrf_token'])) {
|
|||||||
|
|
||||||
// Check if user_id is set in the POST request
|
// Check if user_id is set in the POST request
|
||||||
if (isset($_POST['user_id']) && !empty($_POST['user_id'])) {
|
if (isset($_POST['user_id']) && !empty($_POST['user_id'])) {
|
||||||
// Sanitize the input to prevent SQL injection
|
// Validate user_id as integer
|
||||||
$user_id = mysqli_real_escape_string($conn, $_POST['user_id']);
|
$user_id = intval($_POST['user_id']);
|
||||||
|
if ($user_id <= 0) {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Invalid user ID.']);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
$created_at = date('Y-m-d H:i:s'); // Use current date and time for created_at
|
$created_at = date('Y-m-d H:i:s'); // Use current date and time for created_at
|
||||||
|
|
||||||
// First, check if a bar tab already exists for this user_id
|
// First, check if a bar tab already exists for this user_id
|
||||||
$checkSql = "SELECT * FROM bar_tabs WHERE user_id = '$user_id' LIMIT 1";
|
$stmt = $conn->prepare("SELECT * FROM bar_tabs WHERE user_id = ? LIMIT 1");
|
||||||
$checkResult = mysqli_query($conn, $checkSql);
|
$stmt->bind_param("i", $user_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$checkResult = $stmt->get_result();
|
||||||
|
|
||||||
if (mysqli_num_rows($checkResult) > 0) {
|
if ($checkResult->num_rows > 0) {
|
||||||
// If a bar tab already exists for this user_id, return an error message
|
// If a bar tab already exists for this user_id, return an error message
|
||||||
echo json_encode(['status' => 'error', 'message' => 'A bar tab already exists for this user.']);
|
echo json_encode(['status' => 'error', 'message' => 'A bar tab already exists for this user.']);
|
||||||
} else {
|
} else {
|
||||||
// Prepare the SQL query to insert a new record into the bar_tabs table
|
// Prepare the SQL query to insert a new record into the bar_tabs table
|
||||||
$sql = "INSERT INTO bar_tabs (user_id) VALUES ('$user_id')";
|
$stmt = $conn->prepare("INSERT INTO bar_tabs (user_id) VALUES (?)");
|
||||||
|
$stmt->bind_param("i", $user_id);
|
||||||
|
|
||||||
// Execute the query
|
// Execute the query
|
||||||
if (mysqli_query($conn, $sql)) {
|
if ($stmt->execute()) {
|
||||||
// If the insertion is successful, return a success message
|
// If the insertion is successful, return a success message
|
||||||
echo json_encode(['status' => 'success', 'message' => 'Bar tab created successfully.']);
|
echo json_encode(['status' => 'success', 'message' => 'Bar tab created successfully.']);
|
||||||
} else {
|
} else {
|
||||||
// If there's an error, return an error message
|
// If there's an error, return an error message
|
||||||
echo json_encode(['status' => 'error', 'message' => 'Error: ' . mysqli_error($conn)]);
|
echo json_encode(['status' => 'error', 'message' => 'Error: ' . $conn->error]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If user_id is not provided, return an error message
|
// If user_id is not provided, return an error message
|
||||||
echo json_encode(['status' => 'error', 'message' => 'User ID is required.']);
|
echo json_encode(['status' => 'error', 'message' => 'User ID is required.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the database connection
|
|
||||||
mysqli_close($conn);
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
|
|
||||||
// SQL query to fetch dates for driver training
|
// SQL query to fetch dates for driver training
|
||||||
$sql = "SELECT course_id, date
|
$stmt = $conn->prepare("SELECT course_id, date
|
||||||
FROM courses
|
FROM courses
|
||||||
WHERE course_type = 'driver_training'
|
WHERE course_type = ?
|
||||||
AND date >= CURDATE()";
|
AND date >= CURDATE()");
|
||||||
|
$course_type = 'driver_training';
|
||||||
$result = $conn->query($sql);
|
$stmt->bind_param("s", $course_type);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
$page_id = 'driver_training';
|
$page_id = 'driver_training';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -22,32 +26,11 @@ $page_id = 'driver_training';
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
</style>
|
</style><?php
|
||||||
|
$pageTitle = 'Driver Training';
|
||||||
<?php
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
$bannerFolder = 'assets/images/banners/';
|
require_once('components/banner.php');
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
|
||||||
|
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">4X4 Driver Training</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">4X4 Driver Training</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
|
|
||||||
<!-- Product Details Start -->
|
<!-- Product Details Start -->
|
||||||
<section class="product-details pt-100">
|
<section class="product-details pt-100">
|
||||||
|
|||||||
46
events.php
46
events.php
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php') ?>
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php') ?>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.image {
|
.image {
|
||||||
@@ -52,41 +54,13 @@
|
|||||||
height: auto;
|
height: auto;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-modal-close {
|
|
||||||
position: absolute;
|
|
||||||
top: 10px;
|
|
||||||
right: 20px;
|
|
||||||
font-size: 30px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #333;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$bannerFolder = 'assets/images/banners/';
|
$pageTitle = 'Events';
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white mb-50">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">4WDCSA events</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">4WDCSA Events</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<!-- Tour List Area start -->
|
<!-- Tour List Area start -->
|
||||||
<section class="tour-list-page py-100 rel z-1">
|
<section class="tour-list-page py-100 rel z-1">
|
||||||
@@ -114,10 +88,10 @@ if (!empty($bannerImages)) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Query to retrieve data from the trips table
|
// Query to retrieve upcoming events
|
||||||
$sql = "SELECT event_id, date, time, name, image, description, feature, location, type, promo FROM events WHERE date > CURDATE() ORDER BY date ASC";
|
$stmt = $conn->prepare("SELECT event_id, date, time, name, image, description, feature, location, type, promo FROM events WHERE date > CURDATE() ORDER BY date ASC");
|
||||||
|
$stmt->execute();
|
||||||
$result = $conn->query($sql);
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
// Loop through each row
|
// Loop through each row
|
||||||
|
|||||||
@@ -1,16 +1,23 @@
|
|||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once("connection.php");
|
require_once("connection.php");
|
||||||
|
|
||||||
if (isset($_GET['tab_id'])) {
|
if (isset($_GET['tab_id'])) {
|
||||||
$tab_id = mysqli_real_escape_string($conn, $_GET['tab_id']);
|
$tab_id = (int) $_GET['tab_id']; // Convert to integer
|
||||||
|
|
||||||
|
if ($tab_id <= 0) {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Invalid tab ID.']);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch drinks available for this tab
|
// Fetch drinks available for this tab
|
||||||
$sql = "SELECT * FROM bar_items"; // Customize as needed
|
$stmt = $conn->prepare("SELECT * FROM bar_items");
|
||||||
$result = mysqli_query($conn, $sql);
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
$drinks = [];
|
$drinks = [];
|
||||||
while ($row = mysqli_fetch_assoc($result)) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
$drinks[] = $row;
|
$drinks[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ if ($conn->connect_error) {
|
|||||||
die(json_encode([])); // Return empty JSON on failure
|
die(json_encode([])); // Return empty JSON on failure
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT user_id, first_name, last_name FROM users ORDER BY first_name ASC";
|
$stmt = $conn->prepare("SELECT user_id, first_name, last_name FROM users ORDER BY first_name ASC");
|
||||||
$result = $conn->query($sql);
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
$users = [];
|
$users = [];
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php') ?>
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php') ?>
|
||||||
<style>
|
<style>
|
||||||
@media (min-width: 991px) {
|
@media (min-width: 991px) {
|
||||||
.container {
|
.container {
|
||||||
|
|||||||
@@ -31,9 +31,12 @@ function getTripCount()
|
|||||||
// Database connection
|
// Database connection
|
||||||
$conn = openDatabaseConnection();
|
$conn = openDatabaseConnection();
|
||||||
|
|
||||||
// SQL query to count the number of rows
|
// SQL query to count the number of upcoming trips
|
||||||
$sql = "SELECT COUNT(*) AS total FROM trips WHERE published = 1 AND start_date > CURDATE()";
|
$stmt = $conn->prepare("SELECT COUNT(*) AS total FROM trips WHERE published = ? AND start_date > CURDATE()");
|
||||||
$result = $conn->query($sql);
|
$published = 1;
|
||||||
|
$stmt->bind_param("i", $published);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
// Fetch the count from the result
|
// Fetch the count from the result
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
@@ -918,8 +921,10 @@ function getAvailableSpaces($trip_id)
|
|||||||
$trip_id = intval($trip_id);
|
$trip_id = intval($trip_id);
|
||||||
|
|
||||||
// Step 1: Get the vehicle capacity for the trip from the trips table
|
// Step 1: Get the vehicle capacity for the trip from the trips table
|
||||||
$query = "SELECT vehicle_capacity FROM trips WHERE trip_id = $trip_id";
|
$stmt = $conn->prepare("SELECT vehicle_capacity FROM trips WHERE trip_id = ?");
|
||||||
$result = $conn->query($query);
|
$stmt->bind_param("i", $trip_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
// Check if the trip exists
|
// Check if the trip exists
|
||||||
if ($result->num_rows === 0) {
|
if ($result->num_rows === 0) {
|
||||||
@@ -931,8 +936,10 @@ function getAvailableSpaces($trip_id)
|
|||||||
$vehicle_capacity = $trip['vehicle_capacity'];
|
$vehicle_capacity = $trip['vehicle_capacity'];
|
||||||
|
|
||||||
// Step 2: Get the total number of booked vehicles for this trip from the bookings table
|
// Step 2: Get the total number of booked vehicles for this trip from the bookings table
|
||||||
$query = "SELECT SUM(num_vehicles) as total_booked FROM bookings WHERE trip_id = $trip_id";
|
$stmt = $conn->prepare("SELECT SUM(num_vehicles) as total_booked FROM bookings WHERE trip_id = ?");
|
||||||
$result = $conn->query($query);
|
$stmt->bind_param("i", $trip_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
// Fetch the total number of vehicles booked
|
// Fetch the total number of vehicles booked
|
||||||
$bookings = $result->fetch_assoc();
|
$bookings = $result->fetch_assoc();
|
||||||
@@ -1537,10 +1544,12 @@ function countUpcomingTrips()
|
|||||||
// Open database connection
|
// Open database connection
|
||||||
$conn = openDatabaseConnection();
|
$conn = openDatabaseConnection();
|
||||||
|
|
||||||
$query = "SELECT COUNT(*) AS trip_count FROM trips WHERE published = 1 AND start_date > CURDATE()";
|
$stmt = $conn->prepare("SELECT COUNT(*) AS trip_count FROM trips WHERE published = ? AND start_date > CURDATE()");
|
||||||
|
$published = 1;
|
||||||
|
$stmt->bind_param("i", $published);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
if ($result = $stmt->get_result()) {
|
||||||
if ($result = $conn->query($query)) {
|
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
return (int)$row['trip_count'];
|
return (int)$row['trip_count'];
|
||||||
} else {
|
} else {
|
||||||
@@ -1629,16 +1638,19 @@ function getUserIP()
|
|||||||
function getNextOpenDayDate()
|
function getNextOpenDayDate()
|
||||||
{
|
{
|
||||||
$conn = openDatabaseConnection();
|
$conn = openDatabaseConnection();
|
||||||
$sql = "
|
$stmt = $conn->prepare("
|
||||||
SELECT date
|
SELECT date
|
||||||
FROM events
|
FROM events
|
||||||
WHERE name = '4WDCSA Open Day'
|
WHERE name = ?
|
||||||
AND date >= NOW()
|
AND date >= NOW()
|
||||||
ORDER BY date ASC
|
ORDER BY date ASC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
";
|
");
|
||||||
|
$event_name = '4WDCSA Open Day';
|
||||||
|
$stmt->bind_param("s", $event_name);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
$result = $conn->query($sql);
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
if ($result && $row = $result->fetch_assoc()) {
|
if ($result && $row = $result->fetch_assoc()) {
|
||||||
return $row['date']; // e.g. "2025-05-01 10:00:00"
|
return $row['date']; // e.g. "2025-05-01 10:00:00"
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ include_once('connection.php');
|
|||||||
include_once('functions.php');
|
include_once('functions.php');
|
||||||
$conn = openDatabaseConnection();
|
$conn = openDatabaseConnection();
|
||||||
|
|
||||||
$sql = "SELECT
|
$stmt = $conn->prepare("SELECT
|
||||||
c.*,
|
c.*,
|
||||||
u.first_name,
|
u.first_name,
|
||||||
u.last_name,
|
u.last_name,
|
||||||
u.profile_pic
|
u.profile_pic
|
||||||
FROM campsites c
|
FROM campsites c
|
||||||
LEFT JOIN users u ON c.user_id = u.user_id";
|
LEFT JOIN users u ON c.user_id = u.user_id");
|
||||||
|
$stmt->execute();
|
||||||
$result = $conn->query($sql);
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
$campsites = [];
|
$campsites = [];
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
|||||||
367
header.php
Normal file
367
header.php
Normal file
@@ -0,0 +1,367 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* UNIFIED HEADER TEMPLATE
|
||||||
|
*
|
||||||
|
* Replaces header01.php and header02.php with a single configurable template.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* $headerStyle = 'dark'; // or 'light'
|
||||||
|
* require_once("header.php");
|
||||||
|
*
|
||||||
|
* Styles:
|
||||||
|
* 'dark' = White text on dark background (header01 style)
|
||||||
|
* 'light' = Dark text on light background (header02 style)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Set default style if not provided
|
||||||
|
$headerStyle = $headerStyle ?? 'light';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
require_once("env.php");
|
||||||
|
require_once("session.php");
|
||||||
|
require_once("connection.php");
|
||||||
|
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();
|
||||||
|
|
||||||
|
// Determine styling based on headerStyle parameter
|
||||||
|
$headerClasses = 'main-header header-one';
|
||||||
|
$headerBgClass = '';
|
||||||
|
$logoImg = 'assets/images/logos/logo.png';
|
||||||
|
$mobileLogoImg = 'assets/images/logos/logo.png';
|
||||||
|
$textColor = '#fff'; // Default for dark style
|
||||||
|
$btnTextColor = '#fff';
|
||||||
|
|
||||||
|
if ($headerStyle === 'light') {
|
||||||
|
$headerBgClass = 'bg-white';
|
||||||
|
$logoImg = 'assets/images/logos/logo-two.png';
|
||||||
|
$mobileLogoImg = 'assets/images/logos/logo-two.png';
|
||||||
|
$textColor = '#111111';
|
||||||
|
$btnTextColor = '#111111';
|
||||||
|
} else {
|
||||||
|
// Dark style
|
||||||
|
$headerClasses .= ' white-menu menu-absolute';
|
||||||
|
$headerBgClass = '';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zxx">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<!-- Required meta tags -->
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
|
<!-- Title -->
|
||||||
|
<title>4WDCSA - The Four Wheel Drive Club of Southern Africa</title>
|
||||||
|
<!-- Favicon Icon -->
|
||||||
|
<link rel="shortcut icon" href="assets/images/logos/favicon.ico" type="image/x-icon">
|
||||||
|
<!-- Google Fonts -->
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<?php if ($headerStyle === 'light'): ?>
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<?php endif; ?>
|
||||||
|
<!-- Flaticon -->
|
||||||
|
<link rel="stylesheet" href="assets/css/flaticon.min.css">
|
||||||
|
<!-- Font Awesome -->
|
||||||
|
<link rel="stylesheet" href="assets/css/fontawesome-5.14.0.min.css">
|
||||||
|
<!-- Bootstrap -->
|
||||||
|
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
|
||||||
|
<!-- Magnific Popup -->
|
||||||
|
<link rel="stylesheet" href="assets/css/magnific-popup.min.css">
|
||||||
|
<!-- Nice Select -->
|
||||||
|
<link rel="stylesheet" href="assets/css/nice-select.min.css">
|
||||||
|
<?php if ($headerStyle === 'light'): ?>
|
||||||
|
<!-- jQuery UI -->
|
||||||
|
<link rel="stylesheet" href="assets/css/jquery-ui.min.css">
|
||||||
|
<?php endif; ?>
|
||||||
|
<!-- Animate -->
|
||||||
|
<link rel="stylesheet" href="assets/css/aos.css">
|
||||||
|
<?php if ($headerStyle === 'light'): ?>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aos@2.3.4/dist/aos.css" onload="AOS.init();">
|
||||||
|
<?php endif; ?>
|
||||||
|
<!-- Slick -->
|
||||||
|
<link rel="stylesheet" href="assets/css/slick.min.css">
|
||||||
|
<!-- Main Style -->
|
||||||
|
<link rel="stylesheet" href="assets/css/style_new.css<?php echo ($headerStyle === 'dark') ? '?v=1' : ''; ?>">
|
||||||
|
<?php if ($headerStyle === 'dark'): ?>
|
||||||
|
<link rel="stylesheet" href="header_css.css">
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<script id="mcjs">
|
||||||
|
! function(c, h, i, m, p) {
|
||||||
|
m = c.createElement(h), p = c.getElementsByTagName(h)[0], m.async = 1, m.src = i, p.parentNode.insertBefore(m, p)
|
||||||
|
}(document, "script", "https://chimpstatic.com/mcjs-connected/js/users/3c26590bcc200ef52edc0bec2/b960bfcd9c876f911833ca3f0.js");
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.mobile-only {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1199px) {
|
||||||
|
.mobile-only {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-menu {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-info span {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-pic {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 10px;
|
||||||
|
object-fit: cover;
|
||||||
|
/* Ensures the image fits without distortion */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-arrow {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu2 {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
right: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: <?php echo ($headerStyle === 'light') ? '2px 2px 5px 1px rgba(0, 0, 0, 0.1), -2px 0px 5px 1px rgba(0, 0, 0, 0.1)' : '0px 8px 16px rgba(0, 0, 0, 0.1)'; ?>;
|
||||||
|
/* border-radius: 5px; */
|
||||||
|
min-width: 250px;
|
||||||
|
z-index: 1000;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu2 ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu2 ul li {
|
||||||
|
padding: 8px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu22 ul li a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu22 ul li:hover {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
|
||||||
|
<?php if ($headerStyle === 'light'): ?>
|
||||||
|
.page-banner-area {
|
||||||
|
position: relative;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.banner-overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-image: url('assets/images/banner/tracks7.png');
|
||||||
|
/* Replace with your PNG */
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
z-index: 1;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure your content is above the overlays */
|
||||||
|
.banner-inner {
|
||||||
|
position: relative;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
<?php endif; ?>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="page-wrapper">
|
||||||
|
|
||||||
|
<!-- Preloader -->
|
||||||
|
<div class="preloader">
|
||||||
|
<div class="custom-loader"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- main header -->
|
||||||
|
<header class="<?php echo $headerClasses; ?>">
|
||||||
|
<!--Header-Upper-->
|
||||||
|
<div class="header-upper <?php echo $headerBgClass; ?> py-30 rpy-0">
|
||||||
|
<div class="container-fluid clearfix">
|
||||||
|
|
||||||
|
<div class="header-inner rel d-flex align-items-center">
|
||||||
|
<div class="logo-outer">
|
||||||
|
<div class="logo" style="width:200px;"><a href="index.php"><img src="<?php echo $logoImg; ?>" alt="Logo" title="Logo"></a></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="nav-outer mx-lg-auto ps-xxl-5 clearfix">
|
||||||
|
<!-- Main Menu -->
|
||||||
|
<nav class="main-menu navbar-expand-lg">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<div class="mobile-logo">
|
||||||
|
<a href="index.php">
|
||||||
|
<img src="<?php echo $mobileLogoImg; ?>" alt="Logo" title="Logo">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Toggle Button -->
|
||||||
|
<button type="button" class="navbar-toggle" data-bs-toggle="collapse" data-bs-target=".navbar-collapse">
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="navbar-collapse collapse clearfix">
|
||||||
|
<ul class="navigation clearfix">
|
||||||
|
<li><a href="index.php">Home</a></li>
|
||||||
|
<li><a href="about.php">About</a></li>
|
||||||
|
<li><a href="trips.php">Trips</a>
|
||||||
|
<?php if ($headerStyle === 'dark'): ?>
|
||||||
|
<ul>
|
||||||
|
<li><a href="tour-list.html">Tour List</a></li>
|
||||||
|
<li><a href="tour-grid.html">Tour Grid</a></li>
|
||||||
|
<li><a href="tour-sidebar.html">Tour Sidebar</a></li>
|
||||||
|
<li><a href="trip-details.php">Tour Details</a></li>
|
||||||
|
<li><a href="tour-guide.html">Tour Guide</a></li>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown"><a href="#">Training</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="driver_training.php">Basic 4X4 Driver Training</a></li>
|
||||||
|
<li><a href="bush_mechanics.php">Bush Mechanics</a></li>
|
||||||
|
<li><a href="rescue_recovery.php">Rescue & Recovery</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="events.php">Events</a></li>
|
||||||
|
<li><a href="blog.php">Blog</a></li>
|
||||||
|
<?php if ($role === 'admin' || $role === 'superadmin') { ?>
|
||||||
|
<li class="dropdown"><a href="#">admin</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="admin_web_users.php">Website Users</a></li>
|
||||||
|
<li><a href="admin_members.php">4WDCSA Members</a></li>
|
||||||
|
<li><a href="admin_trip_bookings.php">Trip Bookings</a></li>
|
||||||
|
<li><a href="admin_course_bookings.php">Course Bookings</a></li>
|
||||||
|
<li><a href="admin_efts.php">EFT Payments</a></li>
|
||||||
|
<li><a href="process_payments.php">Process Payments</a></li>
|
||||||
|
<?php if ($role === 'superadmin') { ?>
|
||||||
|
<li><a href="admin_visitors.php">Visitor Log</a></li>
|
||||||
|
<?php } ?>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<?php } ?>
|
||||||
|
<li><a href="contact.php">Contact</a></li>
|
||||||
|
<?php if ($is_member) : ?>
|
||||||
|
<li class="dropdown"><a href="#">Members Area</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#">Coming Soon!</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($is_logged_in) : ?>
|
||||||
|
<li class="dropdown"><a href="#">My Account</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="account_settings.php">Account Settings</a></li>
|
||||||
|
<li><a href="membership_details.php">Membership</a></li>
|
||||||
|
<li><a href="bookings.php">My Bookings</a></li>
|
||||||
|
<li><a href="submit_pop.php">Submit P.O.P</a></li>
|
||||||
|
<li><a href="logout.php">Log Out</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<?php else : ?>
|
||||||
|
<li class="nav-item d-xl-none"><a href="login.php">Log In</a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
<!-- Main Menu End-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Menu Button -->
|
||||||
|
<div class="menu-btns py-10">
|
||||||
|
<?php if ($is_logged_in) : ?>
|
||||||
|
<div class="profile-menu">
|
||||||
|
<div class="profile-info">
|
||||||
|
<span style="color: <?php echo $textColor; ?>;">Welcome, <?php echo $_SESSION['first_name']; ?></span>
|
||||||
|
<a href="account_settings.php">
|
||||||
|
<img src="<?php echo $_SESSION['profile_pic']; ?>?v=<?php echo time(); ?>" alt="Profile Picture" class="profile-pic">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
<a href="login.php" class="theme-btn style-two bgc-secondary">
|
||||||
|
<span data-hover="Log In">Log In</span>
|
||||||
|
<i class="fal fa-arrow-right"></i>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--End Header Upper-->
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const profileInfo = document.querySelector('.profile-info');
|
||||||
|
if (profileInfo) {
|
||||||
|
profileInfo.addEventListener('click', function(event) {
|
||||||
|
const dropdownMenu = document.querySelector('.dropdown-menu2');
|
||||||
|
if (dropdownMenu) {
|
||||||
|
dropdownMenu.style.display = dropdownMenu.style.display === 'block' ? 'none' : 'block';
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('click', function(event) {
|
||||||
|
const dropdownMenu = document.querySelector('.dropdown-menu2');
|
||||||
|
const profileMenu = document.querySelector('.profile-menu');
|
||||||
|
if (profileMenu && dropdownMenu && !profileMenu.contains(event.target)) {
|
||||||
|
dropdownMenu.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
// 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'];
|
||||||
@@ -36,33 +38,11 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<!-- Page Banner Start -->
|
|
||||||
<?php
|
<?php
|
||||||
$bannerFolder = 'assets/images/banners/';
|
$pageTitle = 'Indemnity';
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Indemnity</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item ">Membership</li>
|
|
||||||
<li class="breadcrumb-item ">Application</li>
|
|
||||||
<li class="breadcrumb-item active">Indemnity</li>
|
|
||||||
<li class="breadcrumb-item ">Payment</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
<!-- Page Banner End -->
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
15
index.php
15
index.php
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header01.php');
|
<?php
|
||||||
|
$headerStyle = 'dark';
|
||||||
|
include_once('header.php');
|
||||||
$indemnityPending = false;
|
$indemnityPending = false;
|
||||||
|
|
||||||
if (isset($_SESSION['user_id'])) {
|
if (isset($_SESSION['user_id'])) {
|
||||||
@@ -81,12 +83,15 @@ if (countUpcomingTrips() > 0) { ?>
|
|||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<?php
|
<?php
|
||||||
// Query to retrieve data from the trips table
|
// Query to retrieve data from the trips table
|
||||||
$sql = "SELECT trip_id, trip_name, location, short_description, start_date, end_date, vehicle_capacity, cost_members, places_booked
|
$stmt = $conn->prepare("SELECT trip_id, trip_name, location, short_description, start_date, end_date, vehicle_capacity, cost_members, places_booked
|
||||||
FROM trips
|
FROM trips
|
||||||
WHERE published = 1
|
WHERE published = ?
|
||||||
ORDER BY trip_id DESC
|
ORDER BY trip_id DESC
|
||||||
LIMIT 4";
|
LIMIT 4");
|
||||||
$result = $conn->query($sql);
|
$published = 1;
|
||||||
|
$stmt->bind_param("i", $published);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
// Loop through each row
|
// Loop through each row
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header01.php');
|
<?php
|
||||||
|
$headerStyle = 'dark';
|
||||||
|
include_once('header.php');
|
||||||
$indemnityPending = false;
|
$indemnityPending = false;
|
||||||
|
|
||||||
if (isset($_SESSION['user_id'])) {
|
if (isset($_SESSION['user_id'])) {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
// Include Google login PHP logic
|
// Include Google login PHP logic
|
||||||
require_once 'google-client/vendor/autoload.php';
|
require_once 'google-client/vendor/autoload.php';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
|
|
||||||
// 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'])) {
|
||||||
@@ -13,33 +15,11 @@ $stmt->bind_param("i", $user_id);
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
$user = $result->fetch_assoc();
|
$user = $result->fetch_assoc();
|
||||||
|
?><?php
|
||||||
|
$pageTitle = 'Membership';
|
||||||
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
?>
|
?>
|
||||||
<?php
|
|
||||||
$bannerFolder = 'assets/images/banners/';
|
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
|
||||||
|
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">Membership</li>
|
|
||||||
<li class="breadcrumb-item ">Application</li>
|
|
||||||
<li class="breadcrumb-item ">Indemnity</li>
|
|
||||||
<li class="breadcrumb-item ">Payment</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
<!-- Contact Form Area start -->
|
<!-- Contact Form Area start -->
|
||||||
<section class="about-us-area py-100 rpb-90 rel z-1">
|
<section class="about-us-area py-100 rpb-90 rel z-1">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
|
|
||||||
// Assuming you have the user ID stored in the session
|
// Assuming you have the user ID stored in the session
|
||||||
@@ -18,34 +20,11 @@ $stmt->bind_param("i", $user_id);
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
$user = $result->fetch_assoc();
|
$user = $result->fetch_assoc();
|
||||||
|
?><?php
|
||||||
|
$pageTitle = 'Membership Application';
|
||||||
|
$breadcrumbs = [['Home' => 'index.php'], ['Membership' => 'membership.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
?>
|
?>
|
||||||
<?php
|
|
||||||
$bannerFolder = 'assets/images/banners/';
|
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
|
||||||
|
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Application</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item ">Membership</li>
|
|
||||||
<li class="breadcrumb-item active">Application</li>
|
|
||||||
<li class="breadcrumb-item ">Indemnity</li>
|
|
||||||
<li class="breadcrumb-item ">Payment</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
// 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'];
|
||||||
@@ -65,36 +67,11 @@ $stmt->fetch();
|
|||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
?><?php
|
||||||
|
$pageTitle = 'Membership Payment';
|
||||||
|
$breadcrumbs = [['Home' => 'index.php'], ['Membership' => 'membership.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$bannerFolder = 'assets/images/banners/';
|
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
|
||||||
|
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Payment</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item ">Membership</li>
|
|
||||||
<li class="breadcrumb-item ">Application</li>
|
|
||||||
<li class="breadcrumb-item ">Indemnity</li>
|
|
||||||
<li class="breadcrumb-item active">Payment</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
<!-- Contact Form Area start -->
|
<!-- Contact Form Area start -->
|
||||||
<section class="about-us-area py-100 rpb-90 rel z-1">
|
<section class="about-us-area py-100 rpb-90 rel z-1">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkAdmin();
|
checkAdmin();
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
$user_id = $_SESSION['user_id'];
|
$user_id = $_SESSION['user_id'];
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php') ?>
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php') ?>
|
||||||
<style>
|
<style>
|
||||||
@media (min-width: 991px) {
|
@media (min-width: 991px) {
|
||||||
.container {
|
.container {
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
|
|
||||||
// SQL query to fetch dates for driver training
|
// SQL query to fetch dates for rescue & recovery
|
||||||
$sql = "SELECT course_id, date FROM courses WHERE course_type = 'rescue_recovery' AND date >= CURDATE()";
|
$stmt = $conn->prepare("SELECT course_id, date FROM courses WHERE course_type = ? AND date >= CURDATE()");
|
||||||
$result = $conn->query($sql);
|
$course_type = 'rescue_recovery';
|
||||||
|
$stmt->bind_param("s", $course_type);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
$page_id = 'rescue_recovery';
|
$page_id = 'rescue_recovery';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -17,32 +22,11 @@ $page_id = 'rescue_recovery';
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
</style>
|
</style><?php
|
||||||
|
$pageTitle = 'Rescue & Recovery';
|
||||||
<?php
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
$bannerFolder = 'assets/images/banners/';
|
require_once('components/banner.php');
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
|
||||||
|
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">Rescue & Recovery</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">Rescue & Recovery</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- Page Banner End -->
|
|
||||||
|
|
||||||
<!-- Product Details Start -->
|
<!-- Product Details Start -->
|
||||||
<section class="product-details pt-100">
|
<section class="product-details pt-100">
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
$token = $_GET['token'] ?? '';
|
$token = $_GET['token'] ?? '';
|
||||||
|
|
||||||
if (empty($token)) {
|
if (empty($token)) {
|
||||||
|
|||||||
@@ -19,14 +19,16 @@ if (isset($_POST['tab_id']) && isset($_SESSION['cart'][$_POST['tab_id']])) {
|
|||||||
|
|
||||||
foreach ($drinks as $drink) {
|
foreach ($drinks as $drink) {
|
||||||
$drink_id = (int) $drink['item_id']; // Ensure drink ID is an integer
|
$drink_id = (int) $drink['item_id']; // Ensure drink ID is an integer
|
||||||
$drink_name = mysqli_real_escape_string($conn, $drink['item_name']);
|
$drink_name = $drink['item_name']; // No escaping needed with prepared statements
|
||||||
$drink_price = (float) $drink['item_price']; // Ensure price is a float
|
$drink_price = (float) $drink['item_price']; // Ensure price is a float
|
||||||
$user_id = (float) $drink['user_id']; // Ensure price is a float
|
$user_id = (int) $drink['user_id']; // Convert to integer
|
||||||
|
|
||||||
// Insert each drink into the bar_transactions table
|
// Insert each drink into the bar_transactions table using prepared statement
|
||||||
$sql = "INSERT INTO bar_transactions (user_id, tab_id, item_id, item_name, item_price) VALUES ('$user_id', '$tab_id', '$drink_id', '$drink_name', '$drink_price')";
|
$stmt = $conn->prepare("INSERT INTO bar_transactions (user_id, tab_id, item_id, item_name, item_price) VALUES (?, ?, ?, ?, ?)");
|
||||||
if (!mysqli_query($conn, $sql)) {
|
$stmt->bind_param("iiisi", $user_id, $tab_id, $drink_id, $drink_name, $drink_price);
|
||||||
$errors[] = "Error inserting drink ID $drink_id: " . mysqli_error($conn);
|
|
||||||
|
if (!$stmt->execute()) {
|
||||||
|
$errors[] = "Error inserting drink ID $drink_id: " . $conn->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
require_once("functions.php");
|
require_once("functions.php");
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
|
|
||||||
if (!isset($_GET['token']) || empty($_GET['token'])) {
|
if (!isset($_GET['token']) || empty($_GET['token'])) {
|
||||||
@@ -148,7 +150,9 @@ $conn->close();
|
|||||||
/* Optional: makes non-member price stand out */
|
/* Optional: makes non-member price stand out */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
41
trips.php
41
trips.php
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -12,44 +14,13 @@
|
|||||||
display: block;
|
display: block;
|
||||||
/* Ensure proper block behavior */
|
/* Ensure proper block behavior */
|
||||||
}
|
}
|
||||||
|
|
||||||
.image img {
|
|
||||||
width: 100%;
|
|
||||||
/* Image scales to fill the container */
|
|
||||||
height: 100%;
|
|
||||||
/* Image scales to fill the container */
|
|
||||||
object-fit: cover;
|
|
||||||
/* Fills the container while maintaining aspect ratio */
|
|
||||||
object-position: top;
|
|
||||||
/* Aligns the top of the image with the top of the container */
|
|
||||||
display: block;
|
|
||||||
/* Prevents inline whitespace issues */
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$bannerFolder = 'assets/images/banners/';
|
$pageTitle = 'Trips';
|
||||||
$bannerImages = glob($bannerFolder . '*.{jpg,jpeg,png,webp}', GLOB_BRACE);
|
$breadcrumbs = [['Home' => 'index.php']];
|
||||||
|
require_once('components/banner.php');
|
||||||
$randomBanner = 'assets/images/base4/camping.jpg'; // default fallback
|
|
||||||
if (!empty($bannerImages)) {
|
|
||||||
$randomBanner = $bannerImages[array_rand($bannerImages)];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
|
|
||||||
<div class="banner-overlay"></div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="banner-inner text-white mb-50">
|
|
||||||
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">4WDCSA Trips</h2>
|
|
||||||
<nav aria-label="breadcrumb">
|
|
||||||
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
|
|
||||||
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
|
|
||||||
<li class="breadcrumb-item active">4WDCSA Trips</li>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<!-- Tour List Area start -->
|
<!-- Tour List Area start -->
|
||||||
<section class="tour-list-page py-100 rel z-1">
|
<section class="tour-list-page py-100 rel z-1">
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php include_once('header02.php');
|
<?php
|
||||||
|
$headerStyle = 'light';
|
||||||
|
include_once('header.php');
|
||||||
// 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'];
|
||||||
|
|||||||
Reference in New Issue
Block a user