<?php
include_once("include/main.inc.php");
@extract($_REQUEST);
if (preg_match('webpulse\.co$/', $_SERVER['HTTP_HOST'], $match)) {
  $match1 = $match[1];
  $vanity_url = 'http://' . $_SERVER['HTTP_HOST'];
}
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$urlarray = explode('/', $actual_link);
array_splice($urlarray, 3, 0, 'amp');
$amp_url = implode("/", $urlarray);

// if (is_mobile()) {
//   header("Location: " . $amp_url);
//   exit();
// }

$ee = explode('/', $actual_link);
$mm = $ee[3];
$ss = explode('.', $mm);
$cc = $ss[0];
$cat_url = $cc;
$cat = str_replace("-", " ", $cc);
$cats = ucfirst($cat);
$cat_s = "select catName, catID from category_tbl where catName='$cats' or catUrl='$cat_url'";
$cat_q = mysqli_query($GLOBALS['dbconn'], $cat_s);
$product_idss = end(explode('-', $cc));
$sql_latest = mysqli_query($dbconn, "select product_image,product_title,catalog,product_id,product_video,product_specfi,product_name,product_cat from product_tbl where product_id='$product_idss'");

if (mysqli_num_rows($cat_q) > 0) {
} elseif (mysqli_num_rows($sql_latest) > 0) {
  include "product-details.php";
  exit;
} else {
  header("Location: " . site_url);
  exit;
}

$num = mysqli_num_rows($cat_q);
$cat_r = mysqli_fetch_array($cat_q);
$category_id = $cat_r['catID'];
$hover = $category_id;
$catn = $cat_r['catName'];
$cat_sql = "select catImage, catName, displayName, catDesc, catID, catDesc1, parentID,catUrl from category_tbl where parentID='$category_id' and status='Y'";
$cat_qry = mysqli_query($GLOBALS['dbconn'], $cat_sql);
$cccnum = mysqli_num_rows($cat_qry);
$cat_sql1 = "select catName, displayName, catID, parentID,catImage,catDesc1,catBanner,keyword1,keyword2,keyword3,catHeading1, catHeading2,alt,pageTitle,pageKeywords,pageDescription,multi_image,catDesc2 from category_tbl where catID='$category_id'";
$cat_qry1 = mysqli_query($GLOBALS['dbconn'], $cat_sql1);
$cat_res = mysqli_fetch_array($cat_qry1);
$pageTitles = $cat_res['catName'];
$disTitles = $cat_res['displayName'];
$pdes = $cat_res['catDesc'];
$page_desc = $cat_res['catDesc1'];
$page_desc = str_ireplace('{companyName}', $admin_res['companyName'], $page_desc);
$page_desc1 = $cat_res['catDesc2'];
$page_desc1 = str_ireplace('{companyName}', $admin_res['companyName'], $page_desc1);
$parent = $cat_res['parentID'];
$cat_sql2 = "select catName, displayName, catID, parentID from category_tbl where catID='$parent'";
$cat_qry2 = mysqli_query($GLOBALS['dbconn'], $cat_sql2);
$num2 = mysqli_num_rows($cat_qry2);
$cat_res2 = mysqli_fetch_array($cat_qry2);
$mparent = $cat_res2['parentID'];
$cat_sql3 = "select catName, displayName, catID, parentID from category_tbl where catID='$mparent'";
$cat_qry3 = mysqli_query($GLOBALS['dbconn'], $cat_sql3);
$num3 = mysqli_num_rows($cat_qry3);
$cat_res3 = mysqli_fetch_array($cat_qry3);
$mmparent = $cat_res3['parentID'];
$cat_sql4 = "select catName, displayName, catID, parentID from category_tbl where catID='$mmparent'";
$cat_qry4 = mysqli_query($GLOBALS['dbconn'], $cat_sql4);
$num4 = mysqli_num_rows($cat_qry4);
$cat_res4 = mysqli_fetch_array($cat_qry4);
$mobile = $admin_res['mobile'];
$city = $admin_res['city'];
$state = $admin_res['state'];
$country = $admin_res['country'];
$companyName = $admin_res['companyName'];
$address = $admin_res['address'];
$multi_image = explode(',', $cat_res['multi_image']);

if ($cat_res['catImage'] != '') {
  $imglink = getImage($cat_res[catImage], 420, 630, $cat_res[catName], "/uploaded-files/category/images/");
} else {
  $imglink = getImage("noimage.jpg", 420, 630, "noimages", "/uploaded-files/category/images/");
}

if ($cat_res['keyword1'] != '' && $cat_res['keyword2'] != '' && $cat_res['keyword3'] != '') {
  // echo "3";
  // exit;

  $m_title = "hotkeyword1 Manufacturers state, hotkeyword2 Suppliers Exporters country";
  $page_metatitle = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'],  str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_title))));

  $m_keyword = "hotkeyword1 state, hotkeyword1 Manufacturers state, hotkeyword1 Suppliers in state, hotkeyword2 Exporters in Pakistan, hotkeyword2 in Pakistan";
  $page_metakey = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'], str_replace('hotkeyword3', $cat_res['keyword3'], str_replace('state', $admin_res[targetlocation], $m_keyword))));

  $m_desc = "companyName leading hotkeyword1 Manufacturers in state, Since 2023. Premium Quality hotkeyword2 Suppliers, Exporters in country, Get latest factory price for hotkeyword1. ✓Fast Delivery ✓Good Price ✓Premium Quality";
  $page_metadesc = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'], str_replace('companyName', $admin_res[companyName], str_replace('phone', $admin_res[mobile_meta], str_replace('hotkeyword3', $cat_res['keyword3'], str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[state], $m_desc)))))));
} else if ($cat_res['keyword1'] != '' && $cat_res['keyword2'] != '') {
  // echo "2";
  // exit;

  $m_title = "hotkeyword1 Manufacturers in state, hotkeyword2 Suppliers Exporters country";
  $page_metatitle = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'],  str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_title))));

  $m_keyword = "hotkeyword1,hotkeyword2, hotkeyword1 Manufacturers, hotkeyword2 Manufacturers, hotkeyword1 Suppliers,hotkeyword2 Suppliers, hotkeyword1 Manufacturers in state, hotkeyword2 Suppliers in Pakistan";
  $page_metakey = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'],  str_replace('state', $admin_res[targetlocation], $m_keyword)));

  $m_desc = "companyName leading hotkeyword1 Manufacturers in state, since 2023. Premium Quality hotkeyword2 Suppliers, Exporters in Pakistan, Get latest factory price for hotkeyword1. ✓Fast Delivery ✓Good Price";
  $page_metadesc = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'], str_replace('companyName', $admin_res[companyName], str_replace('phone', $admin_res[mobile_meta], str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[state], $m_desc))))));
} else if ($cat_res['keyword1'] != '') {
  // echo "1";
  // exit;

  $m_title = "hotkeyword1 Manufacturers in state, Suppliers, Exporters country";
  $page_metatitle = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_title)));

  $m_keyword = "hotkeyword1 state, hotkeyword1 Manufacturers state, hotkeyword1 Suppliers in state, hotkeyword1 Exporters in Pakistan, hotkeyword1 in Pakistan";
  $page_metakey = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('state', $admin_res[targetlocation], $m_keyword));

  $m_desc = "companyName leading hotkeyword1 Manufacturers in state, Since 2023. Premium Quality hotkeyword1 Suppliers Exporters in country, Get latest factory price for hotkeyword1. ✓Fast Delivery ✓Good Price ✓Premium Quality";
  $page_metadesc = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('companyName', $admin_res[companyName], str_replace('phone', $admin_res[mobile_meta], str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[state], $m_desc)))));
} else {

  // echo "0";
  // exit;

  $page_metatitle = $cat_res['pageTitle'];
  $page_metakey = $cat_res['pageKeywords'];
  $page_metadesc = $cat_res['pageDescription'];
}

if ($cat_res['catHeading1'] != '') {
  $heading1 = $cat_res['catHeading1'];
} else {
  $heading1 = $disTitles;
}

if ($cat_res['catHeading2'] != '') {
  $heading2 = $cat_res['catHeading2'] . '<span> in ' . $admin_res['targetlocation'] . '</span>';
} else {
  $heading2 = $disTitles . '<span> in ' . $admin_res['targetlocation'] . '</span>';
}

if ($cat_res['alt'] != '') {
  $alttag = $cat_res['alt'] . ' in ' . $admin_res['targetlocation'];
} else {
  $alttag = $disTitles . ' in ' . $admin_res['targetlocation'];
}
?>

<!DOCTYPE html>
<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <?php include 'app_top.php'; ?>
</head>

<body>
  <?php include 'app_header.php'; ?>
  <div class="img-breadcum img-breadcum2">
    <div class="container">
      <!-- <div class="sub-tt">Astrology Remedies</div> -->
      <h1 class="tt"><?= $heading1; ?></h1>
    </div>
  </div>
  <div class="breadcum-sec">
    <div class="container-fluid px-md-5">
      <ul>
        <li><a href="<?= site_url; ?>" title="Home">Home</a></li>
        <?php if ($num4 > 0) { ?>
          <li>
            <a href="<?= site_url; ?>/<?= getValidFileName($cat_res4['catName']); ?>.htm"
              title="<?php echo $cat_res4['catName']; ?>"><?php echo $cat_res4['catName']; ?></a>
          </li>
        <?php } ?>

        <?php if ($num3 > 0) { ?>
          <li>
            <a href="<?= site_url; ?>/<?= getValidFileName($cat_res3['catName']); ?>.htm"
              title="<?php echo $cat_res3['catName']; ?>"><?php echo $cat_res3['catName']; ?></a>
          </li>
        <?php } ?>

        <?php if ($num2 > 0) { ?>
          <?php if ($cat_res2['catID'] == '1' || $cat_res2['catID'] == '2' || $cat_res2['catID'] == '3') { ?>
            <li>
              <a href="javascript:void(0);"
                title="<?php echo $cat_res2['catName']; ?>"><?php echo $cat_res2['catName']; ?></a>
            </li>
          <?php } else {  ?>

            <li>
              <a href="<?= site_url; ?>/<?= getValidFileName($cat_res2['catName']); ?>.htm"
                title="<?php echo $cat_res2['catName']; ?>"><?php echo $cat_res2['catName']; ?></a>
            </li>
        <?php  }
        } ?>
        <!-- <li><a href="" title="Astrology Remedies">Astrology Remedies</a></li> -->
        <li><?php echo $cat_res['catName']; ?></li>
      </ul>
    </div>
  </div>
  <div class="section bg-light">
    <div class="container">
      <div class="cate-img">
        <a href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#productEnquiry"
          onclick="$('.catID').val('<?php echo $cat_res['catID']; ?>');  
                 $('.catName').html('<?php echo $cat_res['catName']; ?>'); 
                 $('.catImg').attr('src','<?= $imglink; ?>');  
                 $('.catImg').attr('alt','<?= $alttag; ?>'); 
                 $('.catImg').attr('title','<?= $alttag; ?>');"
          Title="<?= $alttag; ?>">
          <img src="<?= $imglink; ?>" alt="<?= $alttag; ?>" title="<?= $alttag; ?>">
        </a>
        <div class="d-flex gap-2 justify-content-center align-items-center mt-3">
          <button class="main-btn" type="button" data-bs-toggle="modal" data-bs-target="#productEnquiry"
            onclick="$('.catID').val('<?php echo $cat_res['catID']; ?>');  
                   $('.catName').html('<?php echo $cat_res['catName']; ?>'); 
                   $('.catImg').attr('src','<?= $imglink; ?>');  
                   $('.catImg').attr('alt','<?= $alttag; ?>'); 
                   $('.catImg').attr('title','<?= $alttag; ?>');" title="Consult With Astrologer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-envelope" viewBox="0 0 16 16">
              <path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1zm13 2.383-4.708 2.825L15 11.105zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741M1 11.105l4.708-2.897L1 5.383z"></path></svg> Consult With Astrologer</button>
          <a target="_blank" href="https://api.whatsapp.com/send?phone='<?= $admin_res['whatsapp_no'] ;?>'&text=Please%20Help%20To%20Me" class="w-btn" title="Whatsapp Now">
            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
              <path d="M13.601 2.326A7.854 7.854 0 0 0 7.994 0C3.627 0 .068 3.558.064 7.926c0 1.399.366 2.76 1.057 3.965L0 16l4.204-1.102a7.933 7.933 0 0 0 3.79.965h.004c4.368 0 7.926-3.558 7.93-7.93A7.898 7.898 0 0 0 13.6 2.326zM7.994 14.521a6.573 6.573 0 0 1-3.356-.92l-.24-.144-2.494.654.666-2.433-.156-.251a6.56 6.56 0 0 1-1.007-3.505c0-3.626 2.957-6.584 6.591-6.584a6.56 6.56 0 0 1 4.66 1.931 6.557 6.557 0 0 1 1.928 4.66c-.004 3.639-2.961 6.592-6.592 6.592zm3.615-4.934c-.197-.099-1.17-.578-1.353-.646-.182-.065-.315-.099-.445.099-.133.197-.513.646-.627.775-.114.133-.232.148-.43.05-.197-.1-.836-.308-1.592-.985-.59-.525-.985-1.175-1.103-1.372-.114-.198-.011-.304.088-.403.087-.088.197-.232.296-.346.1-.114.133-.198.198-.33.065-.134.034-.248-.015-.347-.05-.099-.445-1.076-.612-1.47-.16-.389-.323-.335-.445-.34-.114-.007-.247-.007-.38-.007a.729.729 0 0 0-.529.247c-.182.198-.691.677-.691 1.654 0 .977.71 1.916.81 2.049.098.133 1.394 2.132 3.383 2.992.47.205.84.326 1.129.418.475.152.904.129 1.246.08.38-.058 1.171-.48 1.338-.943.164-.464.164-.86.114-.943-.049-.084-.182-.133-.38-.232z">
              </path>
            </svg>
            Chat with us</a>
        </div>
      </div>
      <div class="content-sec">
        <?php echo html_entity_decode($page_desc); ?>
      </div>
      <div class="you_may mb-2">All Category Range</div>
      <div class="row g-3">
        <?php
        if (mysqli_num_rows($cat_qry) > 1) {
          $subcat_sql = $cat_qry;
        } else {

          $subcat_sql = mysqli_query($GLOBALS['dbconn'], "select catImage, catName, displayName, catDesc, catID, catDesc1, parentID from category_tbl where parentID ='$parent' and status='Y' and catID!='$category_id' order by catOrder Asc");
        }
        if (mysqli_num_rows($subcat_sql) < 2) {
          $subcat_sql = mysqli_query($GLOBALS['dbconn'], "select catImage, catName, displayName, catDesc, catID, catDesc1, parentID from category_tbl where parentID ='0' and status='Y' and catID!='$category_id' order by catOrder Asc");
        }
        while ($sub_res = mysqli_fetch_array($subcat_sql)) {

          if ($sub_res['catImage'] != '') {
            $img_link = getImage($sub_res[catImage], 500, 500, $sub_res[catName], "/uploaded-files/category/images/");
            $img_link1 = getImage($sub_res[catImage], 437, 437, $sub_res[catName], "/uploaded-files/category/images/");
          } else {
            $img_link = getImage("noimage.jpg",  500, 500, "noimages", "/uploaded-files/category/images/");
            $img_link1 = getImage("noimage.jpg", 437, 437, "noimages", "/uploaded-files/category/images/");
          }
          // echo $sub_res['catDesc'];
          $sub_desc = $sub_res['catDesc'];
          $sub_desc = str_ireplace('{companyName}', $admin_res['companyName'], $sub_desc);
        ?>
          <div class="col-12 pr_view">
            <div class="pr-li">
              <div class="row g-0">
                <div class="col-lg-4 col-md-5 col-12 g_col">
                  <div class="img_bx">
                    <a class="main-img" href="<?= site_url; ?>/<?= getValidFileName($sub_res['catName']); ?>.htm"
                      title="<?= $sub_res['displayName']; ?> in <?= $admin_res['targetlocation']; ?>">
                      <img id="mainImage<?php echo $sub_res['catID']; ?>" src="<?= $img_link; ?>" alt="<?= $sub_res['displayName']; ?> in <?= $admin_res['targetlocation']; ?>" title="<?= $sub_res['displayName']; ?> in <?= $admin_res['targetlocation']; ?>">
                    </a>
                  </div>
                </div>
                <div class="col-lg-8 col-md-7 col-12 g_col">
                  <div class="tx-bx">
                    <div class="title"><a href="<?= site_url; ?>/<?= getValidFileName($sub_res['catName']); ?>.htm" title="<?= $sub_res['displayName']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>"><?= $sub_res['displayName']; ?></a></div>
                    <div class="info">
                      <p><?= substr($sub_desc, 0, 3000); ?></p>
                    </div>
                    <div class="d-flex gap-2 align-items-center">
                      <a href="<?= site_url; ?>/<?= getValidFileName($sub_res['catName']); ?>.htm" title="Read More" class="main-btn">Read More</a>
                      <button class="main-btn dark" data-bs-toggle="modal" data-bs-target="#productEnquiry"
                        onclick="$('.catID').val('<?php echo $sub_res['catID']; ?>');
                             $('.catName').html('<?php echo $sub_res['catName']; ?>');
                             $('.catImg').attr('src','<?= $img_link1; ?>'); 
                             $('.catImg').attr('alt','<?= $sub_res['displayName']; ?> in <?= $admin_res['targetlocation']; ?>'); 
                             $('.catImg').attr('title','<?= $sub_res['displayName']; ?> in <?= $admin_res['targetlocation']; ?>');"
                        title="Consult With Astrologer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                          <path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555ZM0 4.697v7.104l5.803-3.558L0 4.697ZM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757Zm3.436-.586L16 11.801V4.697l-5.803 3.546Z"></path>
                        </svg> Consult With Astrologer</button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        <?php } ?>
      </div>

      <div class="clearfix"></div>
      <div class="you_may"></div>
    </div>
  </div>
  <?php include 'app_faq.php'; ?>
  <?php include 'app_videos2.php'; ?>
  <?php include 'app_footer.php'; ?>
  <?php include 'app_bottom.php'; ?>
</body>

</html>