<?php session_start();
   require_once("./config/config.php");
   $company_name = ($_REQUEST['coupon']);
   $country_name = ($_REQUEST['country']);
   //  echo  $country_name ;
    $sqlcou="SELECT * FROM coupon WHERE company_name='$company_name' ";
      $myquerycou=$conn->query($sqlcou);
      $mydaracou= $myquerycou->fetchAll()  ;
      
      $rows_foundcou = $myquerycou->rowCount();
    
   if($rows_foundcou=='0'){
           
           $status='active';
           
       }
   
          $sqlc = "SELECT * FROM company_master  WHERE company='$company_name'";
      
       $myq=$conn->query($sqlc);
     $mydar= $myq->fetchAll()  ;
     
     $rows_fou = $myq->rowCount();
   
       foreach( $mydar as $rowcn) {
         
           $country  = $rowcn['country'];
            $company  = $rowcn['company'];
             $image_cou  = $rowcn['image']; 
   }
   
   
   
   $sql_coupon_company="SELECT * FROM coupon WHERE company_name='$company_name' AND coupon_code!=''";
   
      $myquery_coupon_company=$conn->query($sql_coupon_company);
      $mydaracou_coupon_company= $myquery_coupon_company->fetchAll()  ;
      
      $rows_found_coupon_company = $myquery_coupon_company->rowCount();
   
   
   $sqlcou_offers="SELECT * FROM coupon WHERE company_name='$company_name' AND coupon_code =''";
      $myquerycou_offers=$conn->query($sqlcou_offers);
      $mydaracou_offers= $myquerycou_offers->fetchAll()  ;
      
      $rows_foundcou_offers = $myquerycou_offers->rowCount();
   
      
      $sql_coupon_country="SELECT * FROM coupon WHERE coupon_country_name='$country_name' AND  coupon_country_name!=''";
   
      $myquery_coupon_country=$conn->query($sql_coupon_country);
      $mydaracou_coupon_country= $myquery_coupon_country->fetchAll()  ;
      
      $rows_found_coupon_country = $myquery_coupon_country->rowCount();
    //  echo  $rows_found_coupon_country;
    $sql_tag = "SELECT * FROM meta_tag_setting WHERE pages = 'coupons'";
   $mydara_sql = $conn->query($sql_tag);
   $fetch_tag = $mydara_sql->fetchAll();
   $rows_tag =$mydara_sql->rowCount();
   
   if($rows_tag !=0 ){
      foreach( $fetch_tag  as $rowcon ) {
         $title = $rowcon['title'];
         $description  = $rowcon['description'];
         $keyword = $rowcon['keyword'];
      }
   }

          // This is a code for php minifiers Begin
          ob_start("minifier");
          function minifier($code) {
              $search = array(
                   
                  // Remove whitespaces after tags
                  '/\>[^\S ]+/s',
                   
                  // Remove whitespaces before tags
                  '/[^\S ]+\</s',
                   
                  // Remove multiple whitespace sequences
                  '/(\s)+/s',
                   
                  // Removes comments
                  '/<!--(.|\s)*?-->/'
              );
              $replace = array('>', '<', '\\1');
              $code = preg_replace($search, $replace, $code);
              return $code;
          }
          // This is a code for php minifiers End


   ?>
<!DOCTYPE html>
<html lang="en">
   <head>
      <!-- Character set configuration -->
      <base href="<?=$base_link?>" target="_self">
      <meta charset="UTF-8" />
      <title><?=$title?></title>
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <link id="favicon" rel="icon" type="image/x-icon" href="images/web-images/home/favicon.png"/>
      <meta name="robots" content="index, follow" />
      <meta name="description" content="<?=$description?>">
      <meta name="keywords" content="<?=$keyword?>">
      <link rel="canonical" href="coupons.php"/>
      <!-- Viewport configuration, scaling options -->
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>

      <!-- CSS Stylesheet -->
      <link href="css/icouponworld.css" rel="stylesheet" />
      <!-- Font Awesome icon -->
      <link href="fontawesome/css/fontawesome.css" rel="stylesheet" />
      <!-- Google Analytics Code Begin-->
      <?=$google_ana ?>
      <!-- Google Analytics Code End-->
      <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
      <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
      <![endif]-->
   </head>
   <body>
      <!-- Preloader Begin-->
      <div class="preloader">
         <div class="loading">
            <img src="images/web-images/home/loader.gif" alt="loader" title="loader" class="mx-auto d-flex"> 
            <h2 class="text-center fw-light">loading...</h2>
         </div>
      </div>
      <!-- Preloader End-->
      <!--Header Begin-->
      <?php include("./includefiles/header.php"); ?>
      <!--Header End-->
      <!--Overlay Begin-->
      <div id="overlay"></div>
      <!--Overlay End-->
      <!--All Coupons Offers Section Begin-->
      <?php include("./contentpages/coupon_specific/coupon_specific_header.php"); ?> 
      <!--All Coupons Offers Section End--> 
      <!--Filters and showdetails Section Begin--> 
      <section class="bg-light">
         <!--container Begin--> 
         <div class="container">
            <!--row Begin--> 
            <div class="row">
               <!--col-md-3 Begin--> 
               <!--coupon_specific_sidebar Begin--> 
               <?php include("./contentpages/coupon_specific/coupon_specific_sidebar.php"); ?> 
               <!--coupon_specific_sidebar End--> 
               <!--col-md-3 End--> 
               <!--col-md-9 Begin--> 
               <!--coupon_specific Begin--> 
               <?php include("./contentpages/coupon_specific/coupon_specific.php"); ?> 
               <!--coupon_specific End--> 
               <!--col-md-9 End--> 
               <!--Banner Begin--> 
               <div class="col-md-12 mt-4 mb-5">
                  <?php    if(!empty($google_adar )){
                     echo $google_adar ;
                     }else{
                     echo ' <img src="admin/forms/'.$adimg3.'" alt="Horizontal Banner" title="Horizontal Banner" class="img-fluid w-100 rounded-3 my-5">';
                     } ?>
               </div>
               <!--Banner End--> 
            </div>
            <!--row End--> 
         </div>
         <!--container End--> 
      </section>
      <!--Filters and showdetails Section End--> 
      <!--for more saving subscribe now Begin-->
      <?php include("./contentpages/common-files/hubspot.php"); ?>
      <!--like Product Modal -->
      <div class="modal fade" id="like-product" tabindex="-1" aria-labelledby="likeproductLabel" aria-hidden="true">
         <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
               <div class="modal-header border-0">
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
               </div>
               <div class="modal-body">
                  <div class="mx-auto d-block text-center">
                     <h6 class="likethead">Please <a href="./login.php?role=user">Sign in </a><strong> for like</strong></h6>
                     <img src="images/web-images/home/like.png" alt="like" title="like" width="50" class="img-fluid">
                  </div>
               </div>
               <div class="modal-footer bg-transparent">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
               </div>
            </div>
         </div>
      </div>
      <!--favourate  Product Modal -->
      <div class="modal fade" id="favorite-product" tabindex="-1" aria-labelledby="favoriteproductLabel" aria-hidden="true">
         <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
               <div class="modal-header border-0">
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
               </div>
               <div class="modal-body">
                  <div class="mx-auto d-block text-center">
                     <h6 class="likethead">Please <a href="./login.php?role=user">Sign in </a><strong> for favorite</strong></h6>
                     <img src="images/web-images/home/favorite.png" alt="favorite" title="favorite" width="50" class="img-fluid">
                  </div>
               </div>
               <div class="modal-footer bg-transparent">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
               </div>
            </div>
         </div>
      </div>
      <!--for more saving subscribe now End-->
      <!--footer Section Begin-->
      <?php include("./includefiles/footer.php"); ?>
      <!--footer Section End-->
      <!--scroll to top Begin-->
      <button onclick="topFunction()" id="gobackToTop" title="Go TO Top"><i class="fas fa-angle-up"></i></button>
      <!--scroll to top end-->
      <!-- jquery-3.4.1.min js Begin-->
      <script src="js/jquery-3.4.1.min.js"></script>
      <!-- jquery-3.4.1.min js End-->
      <!-- bootstrap.bundle.min js Begin-->
      <script src="js/bootstrap.bundle.min.js"></script>
      <!-- bootstrap.bundle.min js End-->
      <!-- icouponworld.js Begin-->
      <script src="js/icouponworld.js"></script>
      <!-- icouponworld.js End-->
      <!-- sweetalert.min.js Begin-->
      <script src="js/sweetalert.min.js"></script>
      <!-- sweetalert.min.js End-->
      <!--script for googleTranslateElementInit Begin-->
      <!-- <script>
         function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
      </script> -->
      <!--script for googleTranslateElementInit End-->
      <!--script for googleTranslate Begin-->
      <!-- <script src="js/googletranslate.js"></script> -->
      <!--script for googleTranslate End-->
      <!-- Script for show_details and hide_details Begin-->
      <script>
         function show_details(id){
            
         $('#target-details-'+id).show();
         $('#show-details'+id).hide(0);
         $('#hide-details'+id).show(0);
         
         }
         function hide_details(id){
            
          $('#target-details-'+id).hide();
         $('#show-details'+id).show(0);
         $('#hide-details'+id).hide(0);
         
         }
      </script>
      <!-- Script for show_details and hide_details End-->
      <!-- like_dislike script Begin-->
      <script type="text/javascript">  
         function cwRating(id,type,target){
         $.ajax({
           type:'POST',
           url:'forms/like_dislike.php',
           data:'id='+id+'&type='+type,
           success:function(msg){
               if(msg == 'err'){
                   alert('Some problem occured, please try again.');
               }else{
                   $('.like'+target).html(msg);
                   swal({
         title: "Hurray!",
         text: "Your liking was just saved.",
         imageUrl: 'thumbs-up.jpg'
         });
               }
           }
         });
         }
      </script>
      <!-- like_dislike script End-->
      <!-- fav_master script Begin-->
      <script type="text/javascript">  
         function fav(id,type){
         $.ajax({
           type:'POST',
           url:'forms/fav_master.php',
           data:'id='+id+'&type='+type,
           success:function(msg){
               if(msg == 'err'){
                   alert('Some problem occured, please try again.');
               }else{
                   $('.fav'+id).html(msg);
                   swal({
         title: "Yay!",
         text: "We just saved your favourite.",
         imageUrl: 'thumbs-up.jpg'
         });
               }
           }
         });
         }
      </script>
      <!-- fav_master script End-->
      <!-- script for copytoclipboard couponall tab Begin-->
      <script>
         function couponall(inputId) {
             /* Get the text field */
         
             // Changed to get the Element by the parameter containing the ElementID
             var couponallText = document.getElementById(inputId);
         
             /* Select the text field */
             couponallText.select();
             couponallText.setSelectionRange(0, 99999); /* For mobile devices */
         
             /* couponall the text inside the text field */
             navigator.clipboard.writeText(couponallText.value);
         
             /* Alert the copied text */
             alert("Copied the text: " + couponallText.value);
         }
      </script>
      <!-- script for copytoclipboard couponall tab End-->
      <!-- script for copytoclipboard couponoffers tab Begin-->
      <script>
         function couponoffers(inputId) {
             /* Get the text field */
         
             // Changed to get the Element by the parameter containing the ElementID
             var couponoffersText = document.getElementById(inputId);
         
             /* Select the text field */
             couponoffersText.select();
             couponoffersText.setSelectionRange(0, 99999); /* For mobile devices */
         
             /* couponoffersthe text inside the text field */
             navigator.clipboard.writeText(couponoffersText.value);
         
             /* Alert the copied text */
             alert("Copied the text: " + couponoffersText.value);
         }
      </script>
      <!-- script for copytoclipboard couponoffers tab End-->
      <!-- script for copytoclipboard couponcouponall tab Begin-->
      <script>
         function couponcouponall(inputId) {
             /* Get the text field */
         
             // Changed to get the Element by the parameter containing the ElementID
             var couponcouponallText = document.getElementById(inputId);
         
             /* Select the text field */
             couponcouponallText.select();
             couponcouponallText.setSelectionRange(0, 99999); /* For mobile devices */
         
             /* couponcouponallthe text inside the text field */
             navigator.clipboard.writeText(couponcouponallText.value);
         
             /* Alert the copied text */
             alert("Copied the text: " + couponcouponallText.value);
         }
      </script>
      <!-- script for copytoclipboard couponcouponall tab End-->
   </body>
</html>
<?php
ob_end_flush();  // This is a code for php minifiers
?>