File Manager V1.5

[SYSTEM@ROOT]: /home/ketechno/dakotaoilug.com/
INJECT_FILE:
NEW_ENTRY:

FILE_CONTENT: service_detail.php

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once 'header.php';
require_once 'admin/link_db_process.php';

// Get service slug from URL
$service_slug = isset($_GET['slug']) ? $_GET['slug'] : '';
//echo "Debug - Slug from URL: " . htmlspecialchars($service_slug) . "<br>";

// Convert slug back to title
$title = ucwords(str_replace('-', ' ', urldecode($service_slug)));
//echo "Debug - Converted title: " . htmlspecialchars($title) . "<br>";

// Fetch service details from homepage_services
$query = "SELECT * FROM homepage_services WHERE LOWER(REPLACE(title, ' ', '-')) LIKE LOWER(?)";
//echo "Debug - SQL Query: " . $query . "<br>";

$stmt = $conn->prepare($query);
$stmt->bind_param("s", $service_slug);
$stmt->execute();
$result = $stmt->get_result();
$service = $result->fetch_assoc();

//echo "Debug - Found service: " . ($service ? "Yes" : "No") . "<br>";
if ($service) {
  //  echo "Debug - Service title: " . htmlspecialchars($service['title']) . "<br>";
}

// If service not found, redirect to services page
if (!$service) {
    //echo "Debug - Service not found, about to redirect...<br>";
    // Temporarily comment out redirect for debugging
    // header("Location: services.php");
    // exit();
}
?>

<!-- Page Title -->
<section class="page-title" style="background-image:url(images/background/14.jpg);">
    <div class="auto-container">
        <h1><?php echo htmlspecialchars($service['title']); ?></h1>
    </div>
</section>
<!-- End Page Title -->

<!-- Service Detail Section -->
<section class="service-detail-section">
    <div class="auto-container">
        <div class="row clearfix">
            <!-- Content Column -->
            <div class="content-column col-lg-8 col-md-12 col-sm-12">
                <div class="inner-column">
                    <?php if ($service['image']): ?>
                    <div class="service-image">
                        <img src="<?php echo htmlspecialchars($service['image']); ?>" alt="<?php echo htmlspecialchars($service['title']); ?>" class="img-fluid">
                    </div>
                    <?php endif; ?>
                    
                    <div class="service-content">
                        <h2><?php echo htmlspecialchars($service['title']); ?></h2>
                        <div class="text">
                            <?php echo nl2br(htmlspecialchars($service['description'])); ?>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Sidebar Column -->
            <div class="sidebar-column col-lg-4 col-md-12 col-sm-12">
                <div class="inner-column">
                    <!-- Other Services -->
                    <div class="sidebar-widget">
                        <h3>Other Services</h3>
                        <ul class="service-list">
                            <?php
                            $query = "SELECT title FROM homepage_services WHERE id != ? ORDER BY display_order ASC";
                            $stmt = $conn->prepare($query);
                            $stmt->bind_param("i", $service['id']);
                            $stmt->execute();
                            $result = $stmt->get_result();
                            
                            while ($other_service = $result->fetch_assoc()) {
                                $other_slug = strtolower(str_replace(' ', '-', preg_replace('/[^A-Za-z0-9\-\s]/', '', $other_service['title'])));
                                echo '<li><a href="service_detail.php?slug=' . urlencode($other_slug) . '">' . 
                                     htmlspecialchars($other_service['title']) . '</a></li>';
                            }
                            ?>
                        </ul>
                    </div>
                    
                    <!-- Book Appointment -->
                    <div class="sidebar-widget">
                        <div class="appointment-box">
                            <h3>Book an Appointment</h3>
                            <p>Need this service? Book an appointment now!</p>
                            <a href="appointment.php" class="theme-btn btn-style-one">Book Appointment</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<style>
.service-detail-section {
    padding: 80px 0;
}

.service-image {
    margin-bottom: 30px;
}

.service-image img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.service-content h2 {
    color: #333;
    margin-bottom: 20px;
}

.service-content .text {
    color: #666;
    line-height: 1.8;
}

.sidebar-widget {
    background: #f8f9fa;
    padding: 25px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.sidebar-widget h3 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

.service-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.service-list li {
    margin-bottom: 10px;
}

.service-list li a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
    display: block;
    padding: 8px 15px;
    background: #fff;
    border-radius: 4px;
}

.service-list li a:hover {
    color: #007bff;
    background: #e9ecef;
}

.appointment-box {
    text-align: center;
   background: linear-gradient( rgba(20, 20, 31, 0.7), #fe9601);
    color: #fff;
    padding: 30px 20px;
    border-radius: 8px;
}

.appointment-box h3 {
    color: #fff;
    border-bottom: 2px solid rgba(255,255,255,0.2);
}

.appointment-box p {
    margin: 20px 0;
}

.appointment-box .btn-style-one {
    background: #fff;
    color: #007bff;
}

.appointment-box .btn-style-one:hover {
    background: #0056b3;
    color: #fff;
}

@media (max-width: 991px) {
    .sidebar-column {
        margin-top: 40px;
    }
}
</style>

<?php require_once 'footer.php'; ?>
[ KEMBALI ]