📁
SKYSHELL MANAGER-
🛒
PHP v7.4.33
Create Folder
Create File
Current Path:
home
/
oshofree
/
public_html
/
chbluxuries.com
/
boot
/
Name
Size
Permissions
Actions
📁
..
-
0755
🗑️
🔒
📁
css
-
0755
🗑️
🔒
📁
js
-
0755
🗑️
🔒
📄
config.php
7.06 KB
0444
🗑️
⬇️
✏️
🔒
📄
error_log
153.2 KB
0644
🗑️
⬇️
✏️
🔒
Editing: header1.php
<?php session_start(); ob_start(); include "connect_to_mysqli.php"; date_default_timezone_set('Africa/Lagos'); $sql = "SELECT * from site_settings"; $sql2 = mysqli_query($con,$sql); while($row = mysqli_fetch_array($sql2)){ $faq = $row["faq"]; $terms_c= $row["terms"]; $goldloyalfee= $row["gold_loyalty"]; $silverloyalfee= $row["silver_loyalty"]; $diamondloyalfee= $row["diamond_loyalty"]; } $code = ""; $code = $_SESSION['id']; if (isset($_COOKIE['userID'])) { $code = $_COOKIE['userID']; } $check = "SELECT * FROM users WHERE s = '".$code."'"; $query = mysqli_query($con, $check); if (mysqli_affected_rows($con) == 0) { $active_log = 0; } else { $sql = "SELECT * FROM users WHERE s = '".$code."'"; $sql2 = mysqli_query($con, $sql); while ($row = mysqli_fetch_array($sql2)) { $id = $row["s"]; $user_id = $row['id']; $user_name = $row['name']; $user_email = $row['email']; $user_phone = $row['phone']; $user_pass = $row['password']; $user_reg_date = $row['reg_date']; $user_lastseen = $row['lastseen']; $user_statuslog = $row['statuslog']; $user_verify = $row['verify']; $wallet = $row['wallet']; $user_discount = $row['discount']; $user_loyalty= $row['loyalty']; $active_log = 1; // Store user data in session variables $_SESSION['id'] = $id; $_SESSION['user_id'] = $user_id; $_SESSION['user_name'] = $user_name; $_SESSION['user_email'] = $user_email; $_SESSION['user_phone'] = $user_phone; $_SESSION['user_reg_date'] = $user_reg_date; $_SESSION['user_lastseen'] = $user_lastseen; $_SESSION['user_statuslog'] = $user_statuslog; $_SESSION['user_verify'] = $user_verify; }} if ($user_id !== '91014276') { if (isset($_SESSION['savedinvoice'])) { $godid = $_SESSION['savedinvoice']; $invoiceCheckQuery = "SELECT * FROM orders WHERE orderid = '$godid' AND payment = 'invoice'"; $invoiceCheckResult = mysqli_query($con, $invoiceCheckQuery); if (mysqli_num_rows($invoiceCheckResult) == 0 && $active_log=="0"){ $godid=""; } if (mysqli_num_rows($invoiceCheckResult) == 0 && $active_log=="1") { $sql = "SELECT * FROM orders WHERE user_id='$user_id' AND status='no' AND payment='online' AND pay_status='' ORDER BY s DESC LIMIT 1"; $sql2 = mysqli_query($con, $sql); if ($row = mysqli_fetch_array($sql2)) { $godid = $row['orderid']; }} } else if ($active_log=="1"){ $sql = "SELECT * FROM orders WHERE user_id='$user_id' AND status='no' AND payment='online' AND pay_status='' ORDER BY s DESC LIMIT 1"; $sql2 = mysqli_query($con, $sql); if ($row = mysqli_fetch_array($sql2)) { $godid = $row['orderid']; }}} include "godid.php"; include "actions.php"; function formatNumber($number) { return number_format($number);} //godid stuff //code to end fastest promo $currentDate = date('Y-m-d'); $sqla = "SELECT * FROM stocks WHERE fast_promo='1' AND fastestdate < '$currentDate' GROUP BY group_id ORDER BY s ASC"; $sql2a = mysqli_query($con,$sqla); while ($rows = mysqli_fetch_array($sql2a)) { $ord=$rows['group_id']; mysqli_query($con, "UPDATE stocks SET fast_promo='0' WHERE group_id='$ord'"); } // end flash sales $currentDateTime = date('H:i:s'); $sqla = "SELECT * FROM stocks WHERE flash_promo = '1' AND (flashsales_date < '$currentDate' OR (flashsales_date = '$currentDate' AND '$currentDateTime' > '12:30:00')) GROUP BY group_id ORDER BY s ASC"; $sql2a = mysqli_query($con,$sqla); while ($rows = mysqli_fetch_array($sql2a)) { $ord=$rows['group_id']; mysqli_query($con, "UPDATE stocks SET flash_promo='0' WHERE group_id='$ord'"); } //code to end promo $currentDate = date('Y-m-d'); $sqla = "SELECT * FROM stocks WHERE promo > '0' AND promo_date < '$currentDate' GROUP BY group_id ORDER BY s ASC"; $sql2a = mysqli_query($con,$sqla); while ($rows = mysqli_fetch_array($sql2a)) { $ord=$rows['group_id']; mysqli_query($con, "UPDATE stocks SET promo='0' WHERE group_id='$ord'"); } //special promo $sq = "SELECT * from special_promo"; $sq2 = mysqli_query($con,$sq); while($rod = mysqli_fetch_array($sq2)) { $specialpromo=$rod["discount"]; $specialstart=$rod["startdate"]; $specialend=$rod["enddate"]; } //code to end special promo $currentDate = date('Y-m-d'); if($specialend < $currentDate ){ $sqla = "SELECT * FROM stocks WHERE special_promo='1' GROUP BY group_id ORDER BY s ASC"; $sql2a = mysqli_query($con,$sqla); while ($rows = mysqli_fetch_array($sql2a)) { $ord=$rows['group_id']; mysqli_query($con, "UPDATE stocks SET special_promo='0' WHERE group_id='$ord'"); }} ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>CHB NAIL SHOP <?php echo $titlename; ?></title> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <meta name="description" content="Leading supply store in beauty products such as nail products, manicure & pedicure products, eyelashes products, microblading products/machines, hair wax removal products, piercing & tattoo products, teeth whitening products, detoxification machine, etc."> <meta name="keywords" content="CHB NAIL SHOP, beauty products, nail products, manicure, pedicure, eyelashes, microblading, hair removal, piercing, tattoo, teeth whitening, detoxification"> <!-- Favicon --> <link href="img/favicon.jpg" rel="icon"> <!-- Open Graph Protocol for Social Media --> <meta property="og:title" content="CHB NAIL SHOP <?php echo $titlename; ?>"> <meta property="og:type" content="website" /> <meta property="og:description" content="Leading supply store in beauty products such as nail products, manicure & pedicure products, eyelashes products, microblading products/machines, hair wax removal products, piercing & tattoo products, teeth whitening products, detoxification machine, etc."> <meta property="og:image" content="<?php echo $thesiteimg; ?>"> <meta property="og:url" content="https://chbluxuries.com"> <!-- Google Web Fonts --> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet"> <!-- Font Awesome --> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet"> <link href="lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <!-- jQuery Scripts --> <script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> </head> <body> <?php include"flashpromo.php"; ?> <!-- Topbar Start --> <div class="container-fluid"> <div class="row bg-secondary" style="height:50px; font-size:14px;"> <div class="col-lg-12 d-lg-block pt-3"> <div class="align-items-center"> <marquee direction="left" behavior="scroll"><b> <?php include "adverts.php"; ?> </b></marquee> </div> </div></div> <?php if($specialdiscount > 0){ ?> <div class="row bg-primary" style="padding:10px 3px; font-size:24px; font-family: 'Montserrat', sans-serif; font-weight: bold; text-align:center;"> <div class="col-lg-12 d-lg-block pt-3"> <div class="align-items-center text-center text-light"><b> 🔔 🚨 🚀 <?php echo $promoname_alert; ?> PROMO IS ON FROM <?php echo $formattedStartDate_specialalert; ?> to <?php echo $formattedEndDate_specialalert; ?> 🔔 🚨 🚀 </b> </div> </div></div> <?php } ?> <div class="row align-items-center py-3 px-xl-5 "> <div class="col-lg-3 d-none d-lg-block"> <a href="index.php" class="text-decoration-none"> <h1 class="m-0 display-5 font-weight-semi-bold" > <img src="img/favicon.jpg" width="60px" height="60px"/></h1></a> </div> <div class="col-lg-6 col-6 text-left d-none d-lg-block"> <form action="searchs.php" method="post"> <div class="input-group"> <input type="text" name="search" class="form-control" id="myrealInput" placeholder="I am looking for.." required> <div class="input-group-append"> <button type="submit" class="input-group-text bg-transparent text-primary"> <i class="fa fa-search"></i> </button> </div> </div> <div id="realsearchResults" style="padding: 0; border: none;"></div> </form> </div> <div class="col-lg-3 col-6 text-right d-none d-lg-block"> <a href="wishlist.php" class="btn border" data-toggle="tooltip" data-placement="left" title="Your Wishlist"> <i class="fas fa-heart text-primary"></i> </a> <a href="cart.php" class="btn border"> <i class="fas fa-shopping-cart text-primary"></i> <span class="badge" id="lblCartCounts" style="color:black;"> </span> </a> </div> </div> </div> <!-- Topbar End --> <!-- Navbar Start --> <div class="container-fluid"> <div class="row border-top px-xl-5"> <div class="col-lg-3 d-lg-block"> <a class="btn shadow-none d-flex align-items-center justify-content-between bg-primary text-white w-100" data-toggle="collapse" href="#navbar-vertical" style="height: 65px; margin-top: -1px; padding: 0 30px;"> <h6 class="m-0 text-light">All Categories</h6> <i class="fa fa-angle-down text-light"></i> </a> <nav class="collapse position-absolute navbar navbar-vertical navbar-light align-items-start p-0 border border-top-0 border-bottom-0 bg-light" id="navbar-vertical" style="width: calc(100% - 30px); z-index: 1000; overflow-y: auto;"> <div class="navbar-nav w-100 overflow-hidden" style="max-height:100%; z-index:1000;"> <?php include "menu.php"; ?> </div> </nav> </div> <div class="col-lg-9"> <nav class="navbar navbar-expand-lg bg-light navbar-light py-3 py-lg-0 px-0 d-none d-lg-block"> <a href="index.php" class="text-decoration-none d-block d-lg-none"> <h1 class="m-0 display-5 font-weight-semi-bold" > <!--- <img src="img/favicon.jpg" width="50px" height="50px"/> ---></h1></a> <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse"> <i class="fas fa-bars text-dark"></i> </button> <div class="collapse navbar-collapse justify-content-between" id="navbarCollapse"> <div class="navbar-nav mr-auto py-0"> <a href="index.php" class="nav-item nav-link active">Shop</a> <a href="categories.php" class="nav-link">All Categories</a> <div class="nav-item dropdown"> <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Products</a> <div class="dropdown-menu rounded-0 m-0"> <a href="hotproducts.php" class="dropdown-item">Best Sellers</a> <a href="newproducts.php" class="dropdown-item">New Products</a> <a href="viewhistory.php" class="dropdown-item">Recently Viewed</a> </div> </div> <a href="apply.php" class="nav-item nav-link">Shop Wholesales</a> <a href="history.php" class="nav-item nav-link">Orders History</a> <?php if($user_verify=="yes"){ ?> <a href="wallet.php" class="nav-item nav-link">My Wallet</a> <?php } ?> <a href="chat.php" class="nav-item nav-link">Live Chat</a> <a href="help.php" class="nav-item nav-link">Help</a> </div> <div class="navbar-nav ml-auto py-0"> <?php if($active_log=="0"){?> <a href="signin.php" class="nav-item nav-link">Sign In</a> <?php } else{ ?> <a href="#" data-toggle="modal" data-target="#logoutModal" class="nav-item nav-link">Log Out</a> <?php } ?> </div> </div> </nav> </div> </div> </div> <!-- Navbar End --> <script src="card.js"></script> <script type="text/javascript" src="wishlist.js"></script> <script type="text/javascript" src="autocart.js"></script> <script type="text/javascript" src="all.js"></script> <input type="text" value="<?php echo $user_id; ?>" id="ultimateuser" hidden> <input type="text" value="<?php echo $godid; ?>" id="orderid" hidden> <input type="text" value="<?php echo $user_verify ?>" id="wholesaler" hidden> <div id="report_show"></div> <script> $(document).on('click', function (event) { setTimeout(function() { $(".kayd-alert").alert("close"); }, 5000); }); $(document).ready(function() { function getCartCount() { var bigid = $('#orderid').val(); $.ajax({ url: 'cartcount.php', type: 'POST', data: { bigid: bigid }, success: function(response) { // Update the cart count on the page $('#lblCartCount').text(response); $('#lblCartCounts').text(response); }, error: function(xhr, status, error) { console.log(error); } }); } getCartCount(); setInterval(getCartCount, 1000); function getShipFee() { var bigid = $('#orderid').val(); $.ajax({ url: 'shippingfee.php', type: 'POST', data: { bigid: bigid }, success: function(response) { $('#subtotal_price').text(response); }, error: function(xhr, status, error) { console.log(error); } }); } getShipFee(); setInterval(getShipFee, 1000); }); $(document).ready(function() { $('.close-button.zero').on('click', function () { closeSidebar(); }); $(document).on('click', function(event) { var sidebar = $('#sidebar'); var excludeElement = $('.exclude-element'); if (!sidebar.is(event.target) && sidebar.has(event.target).length === 0 && !excludeElement.is(event.target) && excludeElement.has(event.target).length === 0) { closeSidebar(); } }); function closeSidebar() { $('#fade-background').hide(); $('body').css('overflow', 'auto'); } }); $(document).ready(function() { $('.icon-toggle').click(function() { var targetClass = $(this).data('toggle-class'); $('.products-view').removeClass('col-6 col-12').addClass(targetClass); }); }); </script> <?php $currentUri = $_SERVER['REQUEST_URI']; $excludedUriPrefixes = [ '/cart', '/checkout', '/signup', '/signin', '/apply', '/help', '/apply_form', '/chat', '/suggestion', ]; $excludeInvoice = strpos($currentUri, '/invoice?invoice='); if (!in_array($currentUri, $excludedUriPrefixes) && $excludeInvoice === false) { ?> <script> function showFixedCard() { var fixedCard = $('#fixed-card-me'); fixedCard.addClass('slide-in'); setTimeout(function () { hideFixedCard(); }, 10000); // 10 seconds in milliseconds } // Function to hide the fixed card by sliding out function hideFixedCard() { var fixedCard = $('#fixed-card-me'); fixedCard.removeClass('slide-in'); // Remove CSS class for sliding in fixedCard.addClass('slide-out'); // Add CSS class for sliding out setTimeout(function () { fixedCard.removeClass('slide-out'); fixedCard.hide(); // Hide the fixed card after the sliding out animation }, 500); // Animation duration in milliseconds (same as the duration in CSS) } // Function to fetch and display the ad function fetchAndDisplayAd() { $.ajax({ url: 'adverts_popup.php', // Replace with the actual PHP file that fetches the ad method: 'GET', dataType: 'html', success: function (data) { $('#ad-container').html(data); // Append the fetched HTML code to the container showFixedCard(); // Show the fixed card after fetching the ad }, error: function (xhr, status, error) { console.error('Error fetching ad:', error); }, }); } fetchAndDisplayAd(); setInterval(fetchAndDisplayAd, 20000); $(document).on('click', '#close-button-me', hideFixedCard); $(document).ready(function() { $('#myrealInput').on('input', function() { var searchQuery = $(this).val().trim(); var user = $('#ultimateuser').val(); console.log(searchQuery); if (searchQuery !== '') { $.ajax({ url: 'search_auto.php', method: 'POST', data: { search: searchQuery, user: user }, success: function(response) { $('#realsearchResults').html(response); $('#realsearchResults').css('padding', '10px'); $('#realsearchResults').css('border', '1px solid #ccc'); } }); }else { $('#realsearchResults').empty(); $('#realsearchResults').css('padding', '0'); $('#realsearchResults').css('border', 'none'); } }); }); $(function(){ $.each(document.images, function(){ var this_image = this; var src = $(this_image).attr('src') || '' ; if(!src.length > 0){ //this_image.src = options.loading; // show loading var lsrc = $(this_image).attr('lsrc') || '' ; if(lsrc.length > 0){ var img = new Image(); img.src = lsrc; $(img).load(function() { this_image.src = this.src; }); } } }); }); </script> <?php } ?> <style> html { width: 100%; height: 100%; margin: 0px; padding: 0px; overflow-x: hidden; } .icon-toggle{ font-size:28px !important; margin-right: 10px; margin-top:-6px;/* Adjust the margin value to add desired space */ } .custom-select { height: 30px; /* Adjust the height value as per your requirements */ padding: 0.375rem 0.75rem; /* Adjust the padding values as per your requirements */ font-size: 0.775rem; /* Adjust the font-size value as per your requirements */ } #fade-background { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); /* Adjust the opacity as needed */ z-index: 999; } body.modal-open { overflow: hidden; } .sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid #ccc; } .sidebar-header h5 { margin: 0; color:black; } .close-button { background: none; border: none; font-size: 15px !important; } .sidebar-footer { position: fixed; bottom: 0; right: 0; width:inherit; padding:10px; align-items: center; background-color: #fff; } .cart-items { min-height: 100%; /* Increase the height as needed */ } #kayd-sidebar { width: 300px; max-height: 100%; background-color: #fff; position: fixed; bottom:0; top: 0; right: 0; /* Start with the sidebar hidden */ transition: left 0.3s ease-in-out; z-index:999; overflow-y: auto; padding: 20px; } .hidden { display: none; /* Hide the sidebar initially */ } .sidebar-toggle { position: fixed; top: 20px; right: 20px; background-color: #333; color: #fff; border: none; padding: 10px; font-size: 20px; cursor: pointer; } .cart-item { display: flex; align-items: center; padding: 10px 0px; border-bottom: 1px solid #ccc; } .cart-item img { width: 50px; margin-right: 10px; } .product-name { flex: 1; font-size:13px; } .sidebar-buttons { margin-top: 100px; text-align: center; } .product-price { font-weight: bold; } .total-label { font-weight: bold; margin-right: 10px; font-size:16px; } .total-price { font-weight: bold; font-size:20px; } .sidebar-toggle.open { transform: translateX(-300px); /* Move the toggle button when the sidebar is open */ } .row-eq-height { display: flex; flex-wrap: wrap; } .wishlist-added { color: #FF339A !important; } .kayd-alert { position: fixed; bottom: 70px; border-radius:20px; font-size:14px; font-weight:400; z-index: 9999; } .col-lg-3.col-6.pb-1 { display: flex; flex-direction: column; justify-content: space-between; } .catcard { width: 100%; display: flex; flex-direction: column; justify-content: space-between; height: 100%; } .product-cards-container { flex-wrap: wrap; display:flex; } .product-item { /* height: 500px; set a fixed height here */ } .image-fill { object-fit: cover; height: 150px; /* Adjust the height as needed */ } .card-body { flex: 1; } .product-img { position: relative; } .tag { position: absolute; top: -1px; left: -2px; color: #ffffff; padding: 5px; font-size: 12px; text-transform: uppercase; border-radius: 5px; font-family: 'Poppins'; /* Animation properties */ animation-name: blink; animation-duration: 1s; animation-timing-function: linear; animation-iteration-count: infinite; } .hot { position: absolute; top: 2px; left: 3px; color: #ffffff; padding: 3px; font-size: 10px; text-transform: uppercase; border-radius: 10%; background-color: #FF339A; font-family: 'Poppins'; /* Animation properties */ animation-name: blink; animation-duration: 1s; animation-timing-function: linear; animation-iteration-count: infinite; } .promo-tag { position: absolute; top: 2px; right: 3px; color: #ffffff; padding: 3px; font-size: 10px; text-transform: uppercase; border-radius: 10%; background-color: #FF339A; font-family: 'Poppins'; /* Animation properties */ animation-name: blink; animation-duration: 1s; animation-timing-function: linear; animation-iteration-count: infinite; } /* Define the blinking animation */ @keyframes blink { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } } .card-body h5{ font-size:18px !important; } } .card-header.product-img { position: relative; } .icon-container { position: absolute; top: 0; /* Adjust this value to move the container to the desired height */ right: -5px; /* Change left to right to align the container to the right side*/ width: auto; /* Change this to adjust the width of the container */ height: auto; /* Change this to adjust the height of the container */ display: block; justify-content: flex-end; /* Align the icons to the right side */ align-items: center; opacity: 0; transition: opacity 0.3s ease; } .card-header.product-img:hover .icon-container { opacity: 1; } .wishlist-icon, .compare-icon { display: block; /* Change display to block to move the icons to their own line */ width: 40px; height: 40px; margin: 15px; /* Add margin to space the icons apart */ background: #eeeeee; border-radius: 50%; text-align: center; line-height: 40px; font-size: 16px; color: #333; } .product-icons{ margin-top: -2%; margin-right:5%; } .product-icons .wishlist-icon, .product-icons .compare-icon { display: flex; justify-content: center; align-items: center; width: 35px; /* Adjust the width as needed */ height: 35px; /* Adjust the height as needed */ margin: 1px; /* Add margin to space the icons apart */ background: none; border: 1px solid #FF339A; border-radius: 50%; font-size: 14px; /* Adjust the font size as needed */ color: #333; text-decoration:none; } .product-icons.compare-icon :hover { color: #FF339A; } .new-img{ width:40px !important; height:40px !important; } .pagination { list-style: none; display: flex; justify-content: center; align-items: center; margin-bottom:10%; } .pagination li { margin: 0 5px; } .pagination li a { display: inline-block; padding: 5px 10px; text-decoration: none; color: #FF339A; background-color: #fff; border: 1px solid #FF339A; border-radius: 3px; } .pagination li.active a { background-color: #FF339A; color: #fff; } .scroll-container { display: flex; overflow-x: scroll; } .promo { margin: 0px 5px; min-width: 200px; /* Optional: Set the minimum width for each content item */ } @keyframes scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } } /* Define a blinking animation */ @keyframes blink { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } } /* Apply the animation to the element with the class "blink-text" */ .blink-text { animation: blink 1s infinite; /* "blink" animation lasts for 1 second and repeats infinitely */ } .fixed-card-me { position: fixed; bottom: 60px; left: 20px; background-color: #fff; border-radius:55px; z-index:999; padding:0px; } /* CSS animation for sliding in */ .slide-in { animation: slideIn 0.5s ease; } /* CSS animation for sliding out */ .slide-out { animation: slideOut 0.5s ease; } @keyframes slideIn { from { transform: translateY(100%); } to { transform: translateY(0); } } @keyframes slideOut { from { transform: translateY(0); } to { transform: translateY(100%); } } .body-me { min-height: 1px; padding: 1.2rem; } </style> <script> $(function() { $('[data-toggle="tooltip"]').tooltip(); }); const fixedElement = document.querySelector('.fixed-elements'); function handleScroll() { if (window.scrollY > 100) { fixedElement.classList.add('fixeds'); } else { fixedElement.classList.remove('fixeds'); } } window.addEventListener('scroll', handleScroll); </script> <div id="ad-container"></div> <?php $currentUri = $_SERVER['REQUEST_URI']; $excludedUriPrefixes = [ '/cart', '/checkout', '/signup', '/signin', '/apply', '/help', '/apply_form', '/chat', '/suggestion', ]; $excludeInvoice = strpos($currentUri, '/invoice?invoice='); if (!in_array($currentUri, $excludedUriPrefixes) && $excludeInvoice === false) {?> <script> document.addEventListener('DOMContentLoaded', function() { const fixedElement = document.querySelector('.fixed-elements'); const fixedCard = document.getElementById('fixed-card-me'); const adContainer = document.getElementById('ad-container'); const closeButton = document.getElementById('close-button-me'); // Throttle function to optimize performance function throttle(func, limit) { let lastFunc; let lastRan; return function() { const context = this; const args = arguments; if (!lastRan) { func.apply(context, args); lastRan = Date.now(); } else { clearTimeout(lastFunc); lastFunc = setTimeout(function() { if ((Date.now() - lastRan) >= limit) { func.apply(context, args); lastRan = Date.now(); } }, limit - (Date.now() - lastRan)); } }; } // Handle fixed element scroll function handleScroll() { if (window.scrollY > 100) { fixedElement.classList.add('fixeds'); } else { fixedElement.classList.remove('fixeds'); } } window.addEventListener('scroll', throttle(handleScroll, 200)); // Show and hide fixed card function showFixedCard() { fixedCard.classList.add('slide-in'); setTimeout(hideFixedCard, 10000); // Hide after 10 seconds } function hideFixedCard() { fixedCard.classList.remove('slide-in'); fixedCard.classList.add('slide-out'); setTimeout(function() { fixedCard.classList.remove('slide-out'); fixedCard.style.display = 'none'; // Hide after animation }, 500); // Match animation duration } // Fetch and display ad function fetchAndDisplayAd() { fetch('adverts_popup.php') .then(response => response.text()) .then(data => { // Check if content has changed before updating if (adContainer.innerHTML !== data) { adContainer.innerHTML = data; // Update container only if content changes showFixedCard(); // Show the fixed card after fetching the ad } }) .catch(error => console.error('Error fetching ad:', error)); } fetchAndDisplayAd(); setInterval(fetchAndDisplayAd, 30000); // Increase interval to 30 seconds if (closeButton) { closeButton.addEventListener('click', hideFixedCard); } }); </script> <?php } ?>
💾 Save Changes