File Manager V1.5

[SYSTEM@ROOT]: /home/ketechno/autosolutions.osby.ug/
INJECT_FILE:
NEW_ENTRY:

FILE_CONTENT: services.php

<?php
require_once('header.php');

// Get services content
$services_query = "SELECT * FROM services_content ORDER BY display_order ASC";
$services_result = $conn->query($services_query);
$services_content = [];
while ($row = $services_result->fetch_assoc()) {
    $services_content[$row['section_key']] = $row;
}

// Get FAQs
$faq_query = "SELECT * FROM services_faq WHERE is_active = 1 ORDER BY display_order ASC";
$faqs = $conn->query($faq_query);
$faqs_list = [];
while ($row = $faqs->fetch_assoc()) {
    $faqs_list[] = $row;
}
?>
<!--Page Title-->
<section class="page-title" style="background-image:url(images/background/12.jpg)">
    <div class="auto-container">
        <h1><?php echo htmlspecialchars($services_content['page_header']['title'] ?? 'Our Services'); ?></h1>
        <div class="text"><?php echo htmlspecialchars($services_content['page_header']['content'] ?? 'We strive for perfection in all our services'); ?></div>
    </div>
</section>
<!--End Page Title-->

<!--Team Section-->
<section class="team-section">
    <div class="auto-container">
        <div class="row clearfix">
            <?php
            $main_services = ['mechanical_repairs', 'full_service', 'electrical_wiring'];
            foreach ($main_services as $service_key):
                $service = $services_content[$service_key] ?? null;
                if ($service):
            ?>
            <div class="team-block col-lg-4 col-md-6 col-sm-12">
                <div class="inner-box wow fadeInLeft" data-wow-delay="0ms" data-wow-duration="1500ms">
                    <h3 style="padding-bottom:10px;">
                        <a href="#"><?php echo htmlspecialchars($service['title'] ?? ''); ?></a>
                    </h3>
                    <div class="image">
                        <a href="#"><img src="<?php echo htmlspecialchars($service['image_url'] ?? 'images/resource/service-default.jpg'); ?>" alt="" /></a>
                    </div>
                    <div class="lower-content">
                        <div class="text"><?php echo htmlspecialchars($service['content'] ?? ''); ?></div>
                    </div>
                </div>
            </div>
            <?php 
                endif;
            endforeach; 
            ?>
        </div>
    </div>
</section>
<!--End Team Section-->

<!--Services Section Two-->
<section class="services-section-two">
    <div class="auto-container">
        <div class="row clearfix">
            <?php
            // Get services section two items
            $query = "SELECT * FROM services_section_two ORDER BY display_order ASC";
            $result = $conn->query($query);
            
            if ($result && mysqli_num_rows($result) > 0) {
                while ($service = mysqli_fetch_assoc($result)) {
            ?>
                <!--Services Block Two-->
                <div class="services-block-two col-lg-3 col-md-6 col-sm-12">
                    <div class="inner-box wow fadeInLeft" data-wow-delay="0ms" data-wow-duration="1500ms">
                        <div class="icon-box">
                            <span class="<?php echo htmlspecialchars($service['icon']); ?>"></span>
                        </div>
                        <h3><a href="service_section_two_detail.php?id=<?php echo (int)$service['id']; ?>">
                            <?php echo htmlspecialchars($service['title']); ?>
                        </a></h3>
                        <div class="text">
                            <?php 
                            // Show a truncated version of the description
                            $desc = htmlspecialchars($service['description']);
                            echo strlen($desc) > 100 ? substr($desc, 0, 100) . '...' : $desc;
                            ?>
                        </div>
                        <a href="service_section_two_detail.php?id=<?php echo (int)$service['id']; ?>" class="theme-btn btn-style-three">Read More</a>
                    </div>
                </div>
            <?php 
                }
            } else {
            ?>
                <!--Default Service if No Database Content-->
                <div class="services-block-two col-lg-3 col-md-6 col-sm-12">
                    <div class="inner-box wow fadeInLeft" data-wow-delay="0ms" data-wow-duration="1500ms">
                        <div class="icon-box">
                            <span class="flaticon-car-service"></span>
                        </div>
                        <h3><a href="#">AC Repair Diagnostics</a></h3>
                        <div class="text">
                            Common AC issues and their signs...
                        </div>
                        <a href="#" class="theme-btn btn-style-three">Read More</a>
                    </div>
                </div>
            <?php } ?>
        </div>
    </div>
</section>
<!--End Services Section Two-->

<!--Accordian Section-->
<section class="accordian-section">
    <div class="auto-container">
        <div class="row clearfix">
            <!--Accordian Column-->
            <div class="accordian-column col-lg-6 col-md-12 col-sm-12">
                <div class="inner-column">
                    <ul class="accordion-box accordion-style-one">
                        <?php foreach ($faqs_list as $faq): ?>
                        <li class="accordion block <?php echo ($faq['is_active'] ?? 0) ? 'active-block' : ''; ?>">
                            <div class="acc-btn <?php echo ($faq['is_active'] ?? 0) ? 'active' : ''; ?>">
                                <div class="icon-outer">
                                    <span class="icon icon-plus flaticon-plus-symbol"></span>
                                    <span class="icon icon-minus flaticon-substract"></span>
                                </div>
                                <?php echo htmlspecialchars($faq['question'] ?? ''); ?>
                            </div>
                            <div class="acc-content <?php echo ($faq['is_active'] ?? 0) ? 'current' : ''; ?>">
                                <div class="content">
                                    <div class="text">
                                        <?php echo nl2br(htmlspecialchars($faq['answer'] ?? '')); ?>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <?php endforeach; ?>
                    </ul>
                </div>
            </div>

            <!--Content Column-->
            <div class="content-column col-lg-6 col-md-12 col-sm-12">
                <div class="inner-column">
                    <h2>Don't miss out!, Get regular tips on how to maintain your car</h2>
                    <h3><?php echo htmlspecialchars($services_content['ac_tips']['title'] ?? ''); ?></h3>
                    <div class="text">
                        <?php echo nl2br(htmlspecialchars($services_content['ac_tips']['content'] ?? '')); ?>
                    </div>
                    <a href="appointment.php" class="theme-btn btn-style-oneone">Book an Appointment</a>
                </div>
            </div>
        </div>
    </div>
</section>
<!--End Accordian Section-->
<?php require_once('footer.php'); ?>
[ KEMBALI ]