diff --git a/admin.php b/admin.php
new file mode 100644
index 0000000..6db42e9
--- /dev/null
+++ b/admin.php
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+ Admin Login - Juanda Transport
+
+
+
+
+
+
+
+
+
+
Admin Login
+
+
+
+
+
+
+
+
+
+
+ Use admin / password to login.
+
+
+
+
+
diff --git a/admin_add_tour.php b/admin_add_tour.php
new file mode 100644
index 0000000..37bb7e7
--- /dev/null
+++ b/admin_add_tour.php
@@ -0,0 +1,95 @@
+ ["min_range" => 1]])) {
+ $errors[] = 'Duration must be a positive number.';
+ }
+ if (!filter_var($price, FILTER_VALIDATE_INT, ["options" => ["min_range" => 0]])) {
+ $errors[] = 'Price must be a non-negative number.';
+ }
+
+ if (empty($errors)) {
+ try {
+ $pdo = db();
+ $sql = "INSERT INTO tour_packages (name, destination, duration_days, price, description, image_url) VALUES (?, ?, ?, ?, ?, ?)";
+ $stmt = $pdo->prepare($sql);
+ // Using a placeholder image for now
+ $placeholder_image = 'assets/images/tour_placeholder.png';
+ $stmt->execute([$name, $destination, $duration_days, $price, $description, $placeholder_image]);
+
+ header("Location: admin_tours.php?success=1");
+ exit;
+ } catch (PDOException $e) {
+ $errors[] = "Database error: " . $e->getMessage();
+ }
+ }
+}
+
+require_once 'includes/admin_sidebar.php';
+?>
+
+Add New Tour Package
+Fill out the form to add a new tour package.
+
+
+
+
diff --git a/admin_add_vehicle.php b/admin_add_vehicle.php
new file mode 100644
index 0000000..3f16fc4
--- /dev/null
+++ b/admin_add_vehicle.php
@@ -0,0 +1,101 @@
+ ["min_range" => 1]])) {
+ $errors[] = 'Capacity must be a positive number.';
+ }
+ if (!filter_var($price_per_day, FILTER_VALIDATE_INT, ["options" => ["min_range" => 0]])) {
+ $errors[] = 'Price must be a non-negative number.';
+ }
+
+ if (empty($errors)) {
+ try {
+ $pdo = db();
+ $sql = "INSERT INTO vehicles (name, type, capacity, price_per_day, is_available, image_url) VALUES (?, ?, ?, ?, ?, ?)";
+ $stmt = $pdo->prepare($sql);
+ // Using a placeholder image for now
+ $placeholder_image = 'assets/images/vehicle_placeholder.png';
+ $stmt->execute([$name, $type, $capacity, $price_per_day, $is_available, $placeholder_image]);
+
+ header("Location: admin_vehicles.php?success=1");
+ exit;
+ } catch (PDOException $e) {
+ $errors[] = "Database error: " . $e->getMessage();
+ }
+ }
+}
+
+require_once 'includes/admin_sidebar.php';
+?>
+
+Add New Vehicle
+Fill out the form to add a new vehicle to the fleet.
+
+
+
+
+
+
+
+
+
+ Vehicle Name
+
+
+
+ Vehicle Type
+
+ >Select a type
+ >MPV
+ >SUV
+ >Sedan
+ >Minibus
+
+
+
+
+
+ Available for rent
+
+
+ Add Vehicle
+ Cancel
+
+
+
+
+
diff --git a/admin_bookings.php b/admin_bookings.php
new file mode 100644
index 0000000..d33001a
--- /dev/null
+++ b/admin_bookings.php
@@ -0,0 +1,147 @@
+prepare("UPDATE bookings SET status = ? WHERE id = ?");
+ $stmt->execute([$status, $booking_id]);
+}
+
+// Handle tour booking status update
+if (isset($_POST['update_tour_booking'])) {
+ $booking_id = $_POST['booking_id'];
+ $status = $_POST['status'];
+ $stmt = $pdo->prepare("UPDATE tour_bookings SET status = ? WHERE id = ?");
+ $stmt->execute([$status, $booking_id]);
+}
+
+// Fetch vehicle bookings
+$stmt_bookings = $pdo->query('SELECT b.*, v.name as vehicle_name FROM bookings b JOIN vehicles v ON b.vehicle_id = v.id ORDER BY b.start_date DESC');
+$vehicle_bookings = $stmt_bookings->fetchAll(PDO::FETCH_ASSOC);
+
+// Fetch tour bookings
+$stmt_tour_bookings = $pdo->query('SELECT tb.*, tp.name as package_name FROM tour_bookings tb JOIN tour_packages tp ON tb.tour_package_id = tp.id ORDER BY tb.tour_date DESC');
+$tour_bookings = $stmt_tour_bookings->fetchAll(PDO::FETCH_ASSOC);
+
+$statuses = ['pending', 'confirmed', 'completed', 'cancelled'];
+
+require_once 'includes/admin_sidebar.php';
+?>
+
+
+
Manage Bookings
+
View and manage customer bookings for vehicles and tours.
+
+
+
+
+
+
+
+
+ Customer
+ Vehicle
+ Dates
+ Status
+ Action
+
+
+
+
+
+ No vehicle bookings found.
+
+
+
+
+
+
+
+
+
+ to
+
+
+
+
+
+ >
+
+
+
+
+ Update
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Customer
+ Tour Package
+ Tour Date
+ # of People
+ Status
+ Action
+
+
+
+
+
+ No tour bookings found.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+ Update
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin_delete_tour.php b/admin_delete_tour.php
new file mode 100644
index 0000000..bf1cc12
--- /dev/null
+++ b/admin_delete_tour.php
@@ -0,0 +1,28 @@
+prepare("DELETE FROM tour_packages WHERE id = ?");
+ $stmt->execute([$id]);
+
+ header("Location: admin_tours.php?success=3");
+ exit;
+} catch (PDOException $e) {
+ // Redirect with an error message
+ header("Location: admin_tours.php?error=db");
+ exit;
+}
diff --git a/admin_delete_vehicle.php b/admin_delete_vehicle.php
new file mode 100644
index 0000000..839f8e0
--- /dev/null
+++ b/admin_delete_vehicle.php
@@ -0,0 +1,28 @@
+prepare("DELETE FROM vehicles WHERE id = ?");
+ $stmt->execute([$id]);
+
+ header("Location: admin_vehicles.php?success=3");
+ exit;
+} catch (PDOException $e) {
+ // Redirect with an error message
+ header("Location: admin_vehicles.php?error=db");
+ exit;
+}
diff --git a/admin_edit_tour.php b/admin_edit_tour.php
new file mode 100644
index 0000000..2d1caa3
--- /dev/null
+++ b/admin_edit_tour.php
@@ -0,0 +1,119 @@
+prepare("SELECT * FROM tour_packages WHERE id = ?");
+ $stmt->execute([$id]);
+ $tour = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if (!$tour) {
+ header('Location: admin_tours.php?error=notfound');
+ exit;
+ }
+
+ $name = $tour['name'];
+ $destination = $tour['destination'];
+ $duration_days = $tour['duration_days'];
+ $price = $tour['price'];
+ $description = $tour['description'];
+
+} catch (PDOException $e) {
+ $errors[] = "Database error: " . $e->getMessage();
+}
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $name = trim($_POST['name'] ?? '');
+ $destination = trim($_POST['destination'] ?? '');
+ $duration_days = trim($_POST['duration_days'] ?? '');
+ $price = trim($_POST['price'] ?? '');
+ $description = trim($_POST['description'] ?? '');
+
+ if (empty($name)) {
+ $errors[] = 'Package name is required.';
+ }
+ if (empty($destination)) {
+ $errors[] = 'Destination is required.';
+ }
+ if (!filter_var($duration_days, FILTER_VALIDATE_INT, ["options" => ["min_range" => 1]])) {
+ $errors[] = 'Duration must be a positive number.';
+ }
+ if (!filter_var($price, FILTER_VALIDATE_INT, ["options" => ["min_range" => 0]])) {
+ $errors[] = 'Price must be a non-negative number.';
+ }
+
+ if (empty($errors)) {
+ try {
+ $sql = "UPDATE tour_packages SET name = ?, destination = ?, duration_days = ?, price = ?, description = ? WHERE id = ?";
+ $stmt = $pdo->prepare($sql);
+ $stmt->execute([$name, $destination, $duration_days, $price, $description, $id]);
+
+ header("Location: admin_tours.php?success=2");
+ exit;
+ } catch (PDOException $e) {
+ $errors[] = "Database error: " . $e->getMessage();
+ }
+ }
+}
+
+require_once 'includes/admin_sidebar.php';
+?>
+
+Edit Tour Package
+Update the details for the tour package below.
+
+
+
+
+
+
+
+
+
+ Package Name
+
+
+
+ Destination
+
+
+
+
+ Description
+
+
+
+ Save Changes
+ Cancel
+
+
+
+
+
diff --git a/admin_edit_vehicle.php b/admin_edit_vehicle.php
new file mode 100644
index 0000000..6bbf0e7
--- /dev/null
+++ b/admin_edit_vehicle.php
@@ -0,0 +1,125 @@
+prepare("SELECT * FROM vehicles WHERE id = ?");
+ $stmt->execute([$id]);
+ $vehicle = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if (!$vehicle) {
+ header('Location: admin_vehicles.php?error=notfound');
+ exit;
+ }
+
+ $name = $vehicle['name'];
+ $type = $vehicle['type'];
+ $capacity = $vehicle['capacity'];
+ $price_per_day = $vehicle['price_per_day'];
+ $is_available = $vehicle['is_available'];
+
+} catch (PDOException $e) {
+ $errors[] = "Database error: " . $e->getMessage();
+}
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $name = trim($_POST['name'] ?? '');
+ $type = trim($_POST['type'] ?? '');
+ $capacity = trim($_POST['capacity'] ?? '');
+ $price_per_day = trim($_POST['price_per_day'] ?? '');
+ $is_available = isset($_POST['is_available']) ? 1 : 0;
+
+ if (empty($name)) {
+ $errors[] = 'Vehicle name is required.';
+ }
+ if (empty($type)) {
+ $errors[] = 'Vehicle type is required.';
+ }
+ if (!filter_var($capacity, FILTER_VALIDATE_INT, ["options" => ["min_range" => 1]])) {
+ $errors[] = 'Capacity must be a positive number.';
+ }
+ if (!filter_var($price_per_day, FILTER_VALIDATE_INT, ["options" => ["min_range" => 0]])) {
+ $errors[] = 'Price must be a non-negative number.';
+ }
+
+ if (empty($errors)) {
+ try {
+ $sql = "UPDATE vehicles SET name = ?, type = ?, capacity = ?, price_per_day = ?, is_available = ? WHERE id = ?";
+ $stmt = $pdo->prepare($sql);
+ $stmt->execute([$name, $type, $capacity, $price_per_day, $is_available, $id]);
+
+ header("Location: admin_vehicles.php?success=2");
+ exit;
+ } catch (PDOException $e) {
+ $errors[] = "Database error: " . $e->getMessage();
+ }
+ }
+}
+
+require_once 'includes/admin_sidebar.php';
+?>
+
+Edit Vehicle
+Update the details for the vehicle below.
+
+
+
+
+
+
+
+
+
+ Vehicle Name
+
+
+
+ Vehicle Type
+
+ >MPV
+ >SUV
+ >Sedan
+ >Minibus
+
+
+
+
+ >
+ Available for rent
+
+
+ Save Changes
+ Cancel
+
+
+
+
+
diff --git a/admin_tours.php b/admin_tours.php
new file mode 100644
index 0000000..4e4d02b
--- /dev/null
+++ b/admin_tours.php
@@ -0,0 +1,69 @@
+query('SELECT * FROM tour_packages ORDER BY name ASC');
+ $tours = $stmt->fetchAll(PDO::FETCH_ASSOC);
+} catch (PDOException $e) {
+ $error_message = "Database error: " . $e->getMessage();
+ $tours = [];
+}
+
+require_once 'includes/admin_sidebar.php';
+?>
+
+Manage Tour Packages
+Add, edit, or remove tour packages.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ Destination
+ Duration (days)
+ Price
+ Actions
+
+
+
+
+
+
+
+
+ Rp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin_vehicles.php b/admin_vehicles.php
new file mode 100644
index 0000000..6089f41
--- /dev/null
+++ b/admin_vehicles.php
@@ -0,0 +1,71 @@
+query('SELECT * FROM vehicles ORDER BY name ASC');
+ $vehicles = $stmt->fetchAll(PDO::FETCH_ASSOC);
+} catch (PDOException $e) {
+ $error_message = "Database error: " . $e->getMessage();
+ $vehicles = [];
+}
+
+require_once 'includes/admin_sidebar.php';
+?>
+
+Manage Vehicles
+Add, edit, or remove vehicles from your fleet.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ Type
+ Capacity
+ Price per Day
+ Status
+ Actions
+
+
+
+
+
+
+
+
+ Rp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/css/custom.css b/assets/css/custom.css
new file mode 100644
index 0000000..44e4ca7
--- /dev/null
+++ b/assets/css/custom.css
@@ -0,0 +1,137 @@
+/* Import Font */
+@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700;900&display=swap');
+
+body {
+ font-family: 'Poppins', sans-serif;
+ background-color: #f8f9fa;
+}
+
+/* Header */
+.navbar-brand .brand-text {
+ font-size: 1.5rem;
+ font-weight: 700;
+}
+.navbar-brand .sub-text {
+ font-size: 0.8rem;
+ display: block;
+ line-height: 1;
+ color: #6c757d;
+}
+.nav-link.active {
+ background-color: #0d6efd;
+ color: white !important;
+ border-radius: 0.375rem;
+ padding-left: 1rem !important;
+ padding-right: 1rem !important;
+}
+.btn-contact {
+ background-color: #198754;
+ color: white;
+}
+.btn-contact:hover {
+ background-color: #157347;
+ color: white;
+}
+
+/* Hero Section */
+.hero-section {
+ background: linear-gradient(90deg, #2c3e50, #fd7e14);
+ color: white;
+ padding: 8rem 0;
+ text-align: center;
+}
+.hero-section h1 {
+ font-size: 3.5rem;
+ font-weight: 900;
+ text-transform: uppercase;
+ margin-bottom: 0.5rem;
+}
+.hero-section .highlight-text {
+ color: #ffc107;
+}
+.hero-section .sub-heading {
+ font-size: 1.25rem;
+ font-weight: 400;
+ margin-bottom: 1rem;
+}
+.hero-section .location-text {
+ font-size: 0.9rem;
+ color: #e9ecef;
+ margin-bottom: 2rem;
+}
+.hero-section .btn {
+ font-size: 1.2rem;
+ padding: 0.8rem 2rem;
+ border-radius: 50px;
+ font-weight: 700;
+ margin: 0 0.5rem;
+}
+.btn-rental {
+ background-color: #0d6efd;
+ color: white;
+}
+.btn-tour {
+ background-color: #ff8c00;
+ color: white;
+}
+
+/* Floating WhatsApp Button */
+.whatsapp-float {
+ position: fixed;
+ width: 60px;
+ height: 100vh;
+}
+
+.vehicle-card {
+ transition: transform 0.3s ease, box-shadow 0.3s ease;
+}
+
+.vehicle-card:hover {
+ transform: translateY(-10px);
+ box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
+}
+
+.vehicle-card .card-img-top {
+ height: 200px;
+ object-fit: cover;
+}
+ bottom: 40px;
+ right: 40px;
+ background-color: #25d366;
+ color: #FFF;
+ border-radius: 50px;
+ text-align: center;
+ font-size: 30px;
+ box-shadow: 2px 2px 3px #999;
+ z-index: 100;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+.whatsapp-float:hover {
+ color: white;
+}
+
+/* Footer */
+footer {
+ background-color: #212529;
+ color: #adb5bd;
+ padding: 3rem 0;
+}
+footer .footer-logo {
+ font-size: 1.5rem;
+ font-weight: 700;
+ color: white;
+ margin-bottom: 1rem;
+}
+footer a {
+ color: #adb5bd;
+ text-decoration: none;
+}
+footer a:hover {
+ color: white;
+}
+footer .social-icons a {
+ font-size: 1.5rem;
+ margin-right: 1rem;
+}
diff --git a/assets/js/main.js b/assets/js/main.js
new file mode 100644
index 0000000..6130445
--- /dev/null
+++ b/assets/js/main.js
@@ -0,0 +1 @@
+// Custom JavaScript will go here
diff --git a/booking.php b/booking.php
new file mode 100644
index 0000000..d12deaa
--- /dev/null
+++ b/booking.php
@@ -0,0 +1,80 @@
+prepare("SELECT * FROM vehicles WHERE id = ?");
+ $stmt->execute([$vehicle_id]);
+ $vehicle = $stmt->fetch(PDO::FETCH_ASSOC);
+}
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $customer_name = $_POST['customer_name'] ?? '';
+ $customer_email = $_POST['customer_email'] ?? '';
+ $customer_phone = $_POST['customer_phone'] ?? '';
+ $start_date = $_POST['start_date'] ?? '';
+ $end_date = $_POST['end_date'] ?? '';
+ $status = 'pending';
+
+ if ($vehicle_id && !empty($customer_name) && !empty($customer_email) && !empty($start_date) && !empty($end_date)) {
+ $stmt = db()->prepare("INSERT INTO bookings (vehicle_id, customer_name, customer_email, customer_phone, start_date, end_date, status) VALUES (?, ?, ?, ?, ?, ?, ?)");
+ $stmt->execute([$vehicle_id, $customer_name, $customer_email, $customer_phone, $start_date, $end_date, $status]);
+ $booking_id = db()->lastInsertId();
+
+ echo 'Thank you! Your booking has been received. We will contact you shortly.
';
+ } else {
+ echo 'Please fill in all required fields.
';
+ }
+}
+
+if (!$vehicle) {
+ echo '';
+ require_once 'includes/footer.php';
+ exit;
+}
+?>
+
+
+
Book Vehicle:
+
+
+
+
+
+
Type:
+
Capacity: people
+
Price: Rp / day
+
+
+
+ Full Name
+
+
+
+ Email Address
+
+
+
+ Phone Number
+
+
+
+ Book Now
+
+
+
+
+
+
\ No newline at end of file
diff --git a/contact.php b/contact.php
new file mode 100644
index 0000000..7e13933
--- /dev/null
+++ b/contact.php
@@ -0,0 +1,83 @@
+
+
+
+
+
+
Hubungi Kami
+
Punya pertanyaan atau ingin memesan? Isi formulir di bawah ini dan tim kami akan segera menghubungi Anda.
+
+
+
+
+
+
+
+
+
+
+
+ Nama Lengkap
+
+
+
+ Alamat Email
+
+
+
+ Pesan Anda
+
+
+
+ Kirim Pesan
+
+
+
+
+
+
+
Untuk respons lebih cepat, hubungi kami langsung melalui WhatsApp.
+
Hubungi via WhatsApp
+
+
+
+
+
+
diff --git a/dashboard.php b/dashboard.php
new file mode 100644
index 0000000..6b6e2cc
--- /dev/null
+++ b/dashboard.php
@@ -0,0 +1,78 @@
+query('SELECT COUNT(*) FROM vehicles');
+ $vehicle_count = $stmt_vehicles->fetchColumn();
+
+ // Count tour packages
+ $stmt_tours = $pdo->query('SELECT COUNT(*) FROM tour_packages');
+ $tour_count = $stmt_tours->fetchColumn();
+
+ // Count bookings
+ $stmt_bookings = $pdo->query('SELECT COUNT(*) FROM bookings');
+ $booking_count = $stmt_bookings->fetchColumn();
+
+} catch (PDOException $e) {
+ // Handle database errors gracefully
+ $error_message = "Database error: " . $e->getMessage();
+ $vehicle_count = 0;
+ $tour_count = 0;
+ $booking_count = 0;
+}
+
+require_once 'includes/admin_sidebar.php';
+?>
+
+Dashboard
+Welcome back, ! Here's a summary of your site.
+
+
+
+
+
+
+
+
+
+
+
+ Under Construction: More features are coming soon!
+
+
+
\ No newline at end of file
diff --git a/db/001_create_tables.sql b/db/001_create_tables.sql
new file mode 100644
index 0000000..c0d6549
--- /dev/null
+++ b/db/001_create_tables.sql
@@ -0,0 +1,57 @@
+-- Create the customers table
+CREATE TABLE IF NOT EXISTS `customers` (
+ `id` INT AUTO_INCREMENT PRIMARY KEY,
+ `name` VARCHAR(255) NOT NULL,
+ `email` VARCHAR(255) NOT NULL UNIQUE,
+ `phone` VARCHAR(50),
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+);
+
+-- Create the vehicles table
+CREATE TABLE IF NOT EXISTS `vehicles` (
+ `id` INT AUTO_INCREMENT PRIMARY KEY,
+ `name` VARCHAR(255) NOT NULL,
+ `type` VARCHAR(100),
+ `price_per_day` DECIMAL(10, 2) NOT NULL,
+ `image_url` VARCHAR(255),
+ `description` TEXT,
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+);
+
+-- Create the bookings table for vehicle rentals
+CREATE TABLE IF NOT EXISTS `bookings` (
+ `id` INT AUTO_INCREMENT PRIMARY KEY,
+ `customer_id` INT NOT NULL,
+ `vehicle_id` INT NOT NULL,
+ `start_date` DATE NOT NULL,
+ `end_date` DATE NOT NULL,
+ `total_price` DECIMAL(10, 2) NOT NULL,
+ `status` VARCHAR(50) DEFAULT 'pending',
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`),
+ FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles`(`id`)
+);
+
+-- Create the tour_packages table
+CREATE TABLE IF NOT EXISTS `tour_packages` (
+ `id` INT AUTO_INCREMENT PRIMARY KEY,
+ `name` VARCHAR(255) NOT NULL,
+ `description` TEXT,
+ `price` DECIMAL(10, 2) NOT NULL,
+ `image_url` VARCHAR(255),
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+);
+
+-- Create the tour_bookings table
+CREATE TABLE IF NOT EXISTS `tour_bookings` (
+ `id` INT AUTO_INCREMENT PRIMARY KEY,
+ `customer_id` INT NOT NULL,
+ `package_id` INT NOT NULL,
+ `booking_date` DATE NOT NULL,
+ `num_people` INT NOT NULL,
+ `total_price` DECIMAL(10, 2) NOT NULL,
+ `status` VARCHAR(50) DEFAULT 'pending',
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`),
+ FOREIGN KEY (`package_id`) REFERENCES `tour_packages`(`id`)
+);
diff --git a/db/config.php b/db/config.php
index f12ebaf..a6bdebe 100644
--- a/db/config.php
+++ b/db/config.php
@@ -8,10 +8,16 @@ define('DB_PASS', '2c66b530-2a65-423a-a106-6760b49ad1a2');
function db() {
static $pdo;
if (!$pdo) {
- $pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
- ]);
+ try {
+ $pdo = new PDO('mysql:host='.DB_HOST.';charset=utf8mb4', DB_USER, DB_PASS, [
+ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
+ PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
+ ]);
+ $pdo->exec('CREATE DATABASE IF NOT EXISTS `'.DB_NAME.'`');
+ $pdo->exec('USE `'.DB_NAME.'`');
+ } catch (PDOException $e) {
+ die("DB connection failed: " . $e->getMessage());
+ }
}
return $pdo;
}
diff --git a/db/migrate.php b/db/migrate.php
new file mode 100644
index 0000000..e1973e0
--- /dev/null
+++ b/db/migrate.php
@@ -0,0 +1,13 @@
+exec($sql);
+ echo "Database migration completed successfully.";
+} catch (PDOException $e) {
+ die("Database migration failed: " . $e->getMessage());
+}
diff --git a/includes/admin_footer.php b/includes/admin_footer.php
new file mode 100644
index 0000000..b25163b
--- /dev/null
+++ b/includes/admin_footer.php
@@ -0,0 +1,5 @@
+
+
+
+