BLACKSITE
:
216.73.216.62
:
147.93.18.13 / vinyasaweddings.com
:
Linux srv667811 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
:
/
var
/
www
/
kds
/
Upload File:
files >> /var/www/kds/index.php
<?php session_start(); require_once 'config/config.php'; require_once 'db.php'; // Database connection $page = $_GET['page'] ?? null; $slug = $_GET['slug'] ?? null; // Handle clean URL slugs (e.g., /about, /contact) if (!$page && !$slug) { $path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/'); if (str_starts_with($path, 'admin/')) { $page = str_replace('admin/', '', $path); $_GET['page'] = $page; } elseif (!empty($path) && $path !== 'index.php') { $slug = $path; $_GET['slug'] = $slug; } // Remove base path if on localhost or subdirectory // $baseFolder = basename(__DIR__); // e.g., if in /myproject // if (str_starts_with($path, $baseFolder)) { // $path = substr($path, strlen($baseFolder)); // $path = trim($path, '/'); // } // if (!empty($path) && $path !== 'index.php') { // $slug = $path; // $_GET['slug'] = $slug; // } } // Header/Footer (optional usage) function loadHeader() { include 'views/layout/header.php'; } function loadFooter() { include 'views/layout/footer.php'; } // Public admin pages $publicPages = ['login']; // Redirect unauthenticated users away from admin pages if ($page && !in_array($page, $publicPages) && !isset($_SESSION['admin_logged_in'])) { header('Location: login'); exit; } // ADMIN PAGES if ($page) { $adminPages = [ 'login', 'logout', 'dashboard', 'enquiry', 'banners-add', 'banners-manage', 'client-add', 'client-manage', 'faq-add', 'faq-manage', 'testimonial-add', 'testimonial-manage', 'pricing-add', 'pricing-manage', 'state-add', 'state-manage', 'city-add', 'city-manage', 'services-add', 'services-manage', 'cab-add', 'cab-manage', 'portfolio-add', 'portfolio-manage', 'page-setting', 'setting' ]; if (in_array($page, $adminPages)) { $file = "views/admin/{$page}.php"; if (file_exists($file)) { require $file; } else { require 'views/404.php'; } } else { require 'views/404.php'; } } // FRONTEND PAGES elseif ($slug) { $frontendPages = [ 'about' => 'about.php', 'services' => 'service.php', 'courses' => 'course.php', 'faq' => 'faq.php', 'gallery' => 'gallery.php', 'contact' => 'contact.php', 'thankyou' => 'thankyou.php', 'privacy-policy' => 'privacy-policy.php', 'terms-and-condition' => 'terms-and-condition.php', 'refund' => 'refund.php', 'sitemap' => 'sitemap.php', 'portfolio' => 'portfolio.php' ]; if (isset($frontendPages[$slug]) && file_exists("views/{$frontendPages[$slug]}")) { require "views/{$frontendPages[$slug]}"; } elseif (strpos($slug, 'service/') === 0) { $serviceSlug = str_replace('service/', '', $slug); $stmt = $db->prepare("SELECT * FROM service_page WHERE slug = :slug AND status = 'active' LIMIT 1"); $stmt->execute([':slug' => $serviceSlug]); $servicePage = $stmt->fetch(PDO::FETCH_ASSOC); if ($servicePage) { $pageTitle = $servicePage['seo_title'] ?: $servicePage['title']; $pageKeywords = $servicePage['seo_keyword']; $pageDescription = $servicePage['seo_description']; require 'views/service-detail.php'; exit; } else { require 'views/404.php'; exit; } } elseif (strpos($slug, 'tour/') === 0) { $serviceSlug = str_replace('tour/', '', $slug); $stmt = $db->prepare("SELECT * FROM cab_page WHERE slug = :slug AND status = 'active' LIMIT 1"); $stmt->execute([':slug' => $serviceSlug]); $servicePage = $stmt->fetch(PDO::FETCH_ASSOC); if ($servicePage) { $pageTitle = $servicePage['seo_title'] ?: $servicePage['title']; $pageKeywords = $servicePage['seo_keyword']; $pageDescription = $servicePage['seo_description']; require 'views/cab-detail.php'; exit; } else { require 'views/404.php'; exit; } } else { $path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/'); // echo "Parsed path: $path<br>"; $parts = explode('/', $path); // echo "Path parts: " . implode(', ', $parts) . "<br>"; $stateSlug = isset($parts[1]) ? $parts[1] : null; $citySlug = isset($parts[2]) ? $parts[2] : null; // echo "State Slug: $stateSlug<br>"; // echo "City Slug: $citySlug<br>"; if ($stateSlug && $citySlug) { // echo "Both state and city slug detected.<br>"; // Check if city exists using citySlug $stmt = $db->prepare("SELECT * FROM cities WHERE REPLACE(LOWER(title), ' ', '-') = :citySlug AND status = 'Active' LIMIT 1"); $stmt->execute([':citySlug' => $citySlug]); $city = $stmt->fetch(PDO::FETCH_ASSOC); if ($city) { // echo "City found: " . $city['title'] . "<br>"; // Now check if stateSlug matches city's state_name $stmt2 = $db->prepare("SELECT * FROM states WHERE REPLACE(LOWER(title), ' ', '-') = :stateSlug AND status = 'Active' LIMIT 1"); $stmt2->execute([':stateSlug' => $stateSlug]); $state = $stmt2->fetch(PDO::FETCH_ASSOC); if ($state) { // echo "State found: " . $state['title'] . "<br>"; // echo "Matching city['state_name']: " . strtolower($city['state_name']) . "<br>"; // echo "Matching state['title']: " . strtolower($state['title']) . "<br>"; if (strtolower($state['title']) == strtolower($city['state_name'])) { // echo "State matches city's state_name. Showing location page.<br>"; $locationData = [ 'mode' => 'city', 'state' => $state, 'city' => $city ]; require 'views/location.php'; } else { // echo "State doesn't match city's state_name. Showing 404.<br>"; require 'views/404.php'; } } else { // echo "State not found. Showing 404.<br>"; require 'views/404.php'; } } else { // echo "City not found. Showing 404.<br>"; require 'views/404.php'; } } elseif ($citySlug === null && $stateSlug) { // Try to find the state by slug $stmt = $db->prepare("SELECT * FROM states WHERE REPLACE(LOWER(title), ' ', '-') = :stateSlug AND status = 'Active' LIMIT 1"); $stmt->execute([':stateSlug' => $stateSlug]); $state = $stmt->fetch(PDO::FETCH_ASSOC); if ($state) { // State found. Now find all cities belonging to this state (using state name match) $stmt2 = $db->prepare("SELECT * FROM cities WHERE LOWER(state_name) = :stateName AND status = 'Active' ORDER BY title ASC"); $stmt2->execute([':stateName' => strtolower($state['title'])]); $cities = $stmt2->fetchAll(PDO::FETCH_ASSOC); $locationData = [ 'mode' => 'state', 'state' => $state, 'cities' => $cities ]; require 'views/location.php'; } else { // State not found. Show 404 require 'views/404.php'; } } else { // echo "Invalid URL structure. Showing 404.<br>"; require 'views/404.php'; } } } // DEFAULT: Home page else { require 'views/home.php'; }