<?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'];
}
$admin_res=getAdminDetails();
$pg= "category";
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$ee=explode('/',$actual_link);
$mm=$ee[3];
$ss=explode('.',$mm);
$cc=$ss[0];
$cat=str_replace("-", " ", $cc);
$cats=ucwords($cat);
$cat_s="select * from category_tbl where catName='$cats'";
$cat_q=mysqli_query($dbconn,$cat_s);
$num=mysqli_num_rows($cat_q);
$cat_r=mysqli_fetch_array($cat_q);
$category_id=$cat_r['catID'];
$catn=$cat_r['catName'];
$SITE_Url=getValidFileName($catn);
$cat_sql="select * from category_tbl where parentID='$category_id' and status='Y'";

$cat_qry=mysqli_query($dbconn,$cat_sql);
$cccnum=mysqli_num_rows($cat_qry);
$cat_sql1="select * from category_tbl where catID='$category_id'";
$cat_qry1=mysqli_query($dbconn,$cat_sql1);
$cat_res=mysqli_fetch_array($cat_qry1);

$page_metatitle=str_replace('hotkeyword1',$cat_res[keyword1],str_replace('hotkeyword2', $cat_res[keyword2], str_replace('city', $admin_res[city], str_replace('state', $admin_res[state], str_replace('country', $admin_res[country], $cat_res['pageTitle'])))));

$page_metakey = str_replace('hotkeyword1',$cat_res[keyword1],str_replace('hotkeyword2', $cat_res[keyword2], str_replace('city', $admin_res[city], str_replace('hotkeyword3', $cat_res[keyword3], str_replace('country', $admin_res[country], $cat_res['pageKeywords'])))));

$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[phone], str_replace('city', $admin_res[city], str_replace('hotkeyword3', $cat_res[keyword3], str_replace('country', $admin_res[country], $cat_res['pageDescription'])))))));

$pageTitles=$cat_res['catName'];
$disTitles=$cat_res['displayName']; 
$pdes=$cat_res['catDesc'];
$pdes1=$cat_res['catDesc1'];
$parent=$cat_res['parentID'];
$cat_sql2="select * from category_tbl where catID='$parent'";
$cat_qry2=mysqli_query($dbconn,$cat_sql2);
$num2=mysqli_num_rows($cat_qry2);
$cat_res2=mysqli_fetch_array($cat_qry2);
$mparent=$cat_res2['parentID'];
$cat_sql3="select * from category_tbl where catID='$mparent'";
$cat_qry3=mysqli_query($dbconn,$cat_sql3);
$num3=mysqli_num_rows($cat_qry3);
$cat_res3=mysqli_fetch_array($cat_qry3);
$mmparent=$cat_res3['parentID'];
$cat_sql4="select * from category_tbl where catID='$mmparent'";
$cat_qry4=mysqli_query($dbconn,$cat_sql4);
$num4=mysqli_num_rows($cat_qry4);
$cat_res4=mysqli_fetch_array($cat_qry4);
$eee=explode('/',$actual_link);

$afterChunk = $eee[3];
$eem=explode('?',$afterChunk);

$finalUrl = $eem[1];
if($finalUrl){
     $url=site_url."/".$SITE_Url.".htm"; 
   echo "<script>
           window.location = '".$url."';
         </script>";
 }
$numsss=mysqli_num_rows($cat_q);
 if($numsss > 0)
{
     
}else 
    {
	header("Location: http://www.aarnasystems.in");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php if($title !='') {
    ?>
    <title><?php echo $page_metatitle; ?></title>
    <meta name="description" content="<?php echo $page_metadesc; ?>">
    <meta name="keywords" content="<?php echo $page_metakey; ?>">
    <?php
}
else
{
?>
    <title><?php echo $page_metatitle; ?></title>
    <meta name="description" content="<?php echo $page_metadesc; ?>">
    <meta name="keywords" content="<?php echo $page_metakey; ?>">
    <?php
}
?>
    <?php include 'components/top_header.php';?>
</head>

<body>
    <div class="webpulse-main-wrapper">
        <!-- Header -->
        <?php include 'components/header.php';?>

        <!-- Heading Banner -->
        <section class="heading_banner" style="background-image: url(<?=theme_url?>images/Inner-banner.png)">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12 text-center">
                        <h1 class="cat_title">
                            <?php if($cat_res['parentID'] == '0'){ echo $cat_res['keyword1'];}else{ echo $pageTitles;}?>
                        </h1>
                        <div class="clearfix"></div>

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

        <!-- Breadcrumb -->
        <div class="inner_breadcrumb hidden-xs">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12">
                        <ul class="breadcrumb">
                            <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) {?>
                            <li><a href="#"
                                    title="<?php echo $cat_res2['catName']; ?>"><?php echo $cat_res2['catName']; ?></a>
                            </li>
                            <?php } ?>
                            <li class="active"><?php echo $cat_res['catName'];?></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <?php
        if($cat_res['parentID'] == '0')
        {?>
        <!-- Home About -->
        <section class="about_page ptb-50">
            <div class="container">
                <div class="row">
                    <div class="col-md-12">
                        <div class="right_side">
                            <h2 class="bg-title"><span> <?=$cat_res['keyword1'];?> in India</span></h2>
                            <div class="wps_right">
                                <?=html_entity_decode($cat_res['catDesc1']);?>
                                <div class="clearfix"></div>
                                <?php 
                                $related_s = "select * from category_tbl where parentID='$cat_res[catID]' and status='Y' order by catOrder";
                                $related_q = mysqli_query($dbconn,$related_s);
                                if(mysqli_num_rows($related_q)){ 
                                ?>
                                <div class="listing_view">
                                    <div class="row">
                                        <div class="col-lg-8 col-md-8 col-sm-6">
                                            <h3>View Our Product Range</h3>
                                        </div>

                                    </div>

                                </div>
                                <div class="clearfix"></div>
                                <!-- Products Listing -->
                                <div id="products" class="list-group">
                                    <div class="row">
                                        <?php    
                while($related_res=mysqli_fetch_array($related_q)) {
                    $img = getImage($related_res[catImage], 296, 296, $related_res[catName],"/uploaded-files/category/images/");
                            ?>
                                        <div class="col-lg-4 col-md-4 col-sm-4 item_view">
                                            <div class="thumbnail">
                                                <div class="product_view">
                                                    <div class="image">
                                                        <a href="<?=site_url;?>/<?=getValidFileName($related_res['catName']);?>.htm"
                                                            title="<?=$related_res[catName]?> in India">
                                                            <img src="<?=$img?>"
                                                                alt="<?=$related_res[catName]?> in India"
                                                                class="img-responsive"
                                                                title="<?=$related_res[catName]?> in India">
                                                        </a>
                                                    </div>
                                                </div>
                                                <div class="caption">
                                                    <h4 class="product-title"><a
                                                            href="<?=site_url;?>/<?=getValidFileName($related_res['catName']);?>.htm"
                                                            title="<?=$related_res[catName]?> in India"><?=$related_res[catName]?></a>
                                                    </h4>
                                                    <div class="blue-line1"></div>
                                                    <p> <?=html_entity_decode($related_ress['pageDescription1']);?></p>
                                                    <a href="<?=site_url;?>/<?=getValidFileName($related_res['catName']);?>.htm"
                                                        class="read_more_product btn-style-two"
                                                        title="Read More"><span>Read More
                                                            <i class="fa fa-long-arrow-right fa-1x"></i></span></a>
                                                    <a class="read_more_product btn-style-two" href="javascript:void()"
                                                        data-bs-toggle="modal" data-bs-target="#productID"
                                                        title="Send Enquiry"
                                                        onclick="$('#catID').val('<?php echo $related_res['catID']; ?>');
                                 $('#catName').val('<?php echo $related_res['catName']; ?>');
                                 $('.catName').html('<?php echo $related_res['catName']; ?>');  $('.catImg').attr('src','<?=site_url;?>/uploaded-files/category/images/<?php echo ($related_res['catImage']);?>');"><span>Send
                                                            Enquiry</span></a>
                                                    <div class="clearfix"></div>
                                                </div>
                                            </div>
                                        </div>
                                        <?php  } } ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>


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

        <?php  } else { ?>

        <!-- Home About -->
        <section class="about_page ptb-50 bg-grey">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12 col-md-12">
                        <div class="right_side">
                            <h2 class="bg-title"><span><?=$pageTitles?> in India</span></h2>
                            <div class="wps_right">
                                <div class="product_right_image">
                                    <div class="more_images">
                                        <div class="single_image">
                                            <a href="#"
                                                onclick="$('#catID').val('<?php echo $cat_res['catID']; ?>');
                                 $('#catName').val('<?php echo $cat_res['catName']; ?>');
                                 $('.catName').html('<?php echo $cat_res['catName']; ?>');  $('.catImg').attr('src','<?=site_url;?>/uploaded-files/category/images/<?php echo $cat_res['catImage'];?>');"
                                                data-bs-toggle="modal" data-bs-target="#productID"
                                                title="<?=$cat_res['catName']?> in India">
                                                <img src="<?=site_url;?>/uploaded-files/category/images/<?php echo $cat_res['catImage'];?>"
                                                    alt="<?=$cat_res['catName']?> Manufacturers in India"
                                                    title="<?=$cat_res['catName']?> Manufacturers in India">
                                            </a>
                                        </div>
                                    </div>
                                    <a class="theme-btn btn-style-two" title="Send Enquiry" href="#"
                                        data-bs-toggle="modal" data-bs-target="#productID"
                                        onclick="$('#catID').val('<?php echo $cat_res['catID']; ?>');
                                 $('#catName').val('<?php echo $cat_res['catName']; ?> in India');
                                 $('.catName').html('<?php echo $cat_res['catName']; ?>');  $('.catImg').attr('src','<?=site_url;?>/uploaded-files/category/images/<?php echo ($cat_res['catImage']);?>');"><span>Send
                                            Enquiry</span></a>
                                </div>

                                <?=html_entity_decode($cat_res['catDesc1']);?>

                                <div class="clearfix"></div>

                                <div class="clearfix"></div>
                                <!-- product-listing -->
                                <?php  
                                $product_s="select * from product_tbl where product_cat='$cat_res[catID]' || prodcut_subcat='$cat_res[catID]'";
                                $product_q=mysqli_query($dbconn,$product_s);
                                $num=mysqli_num_rows($product_q);
                                if($num > 0)
                                {  
                                       ?>
                                <div class="you_may">Product Related To <?=$cat_res['displayName']?>:</div>
                                <div class="clearfix"></div>
                                <?php $pnum=1;
                                    while($product_r=mysqli_fetch_array($product_q)) { 
                                    $image_array = explode(',', $product_r['product_image']);
                                        
                                    ?>
                                <div class="product_listing">
                                    <div class="row">
                                        <div class="col-xxl-5 col-xl-5 col-lg-5 col-md-5 col-sm-5 col-12">
                                            <div class="product">
                                                <?php if($product_r['product_image']!=null) { ?>
                                                <div class="single_image">
                                                    <a class="largeImage" id="bigImage<?=$pnum?>" href="#"
                                                        data-bs-toggle="modal" data-bs-target="#productID"
                                                        title="<?=$product_r[product_title]?> in India"
                                                        onclick="$('#catID').val('<?php echo $product_r['catID']; ?>');
                                 $('#catName').val('<?php echo $product_r['product_title']; ?>');
                                 $('.catName').html('<?php echo $product_r['product_title']; ?>');  $('.catImg').attr('src','<?=site_url;?>/uploaded-files/product-images/<?php echo ($image_array[0]);?>');">
                                                        <img src="<?=site_url?>/uploaded-files/product-images/<?=$image_array[0]?>"
                                                            alt="<?=$product_r[product_title]?> Manufacturers, Suppliers, Exporters in India"
                                                            title="<?=$product_r[product_title]?> Manufacturers, Suppliers, Exporters in India">
                                                    </a>
                                                </div>
                                                <div id="small<?=$pnum?>" class="small">
                                                    <?php   
                                $pnum++;
                             $multi_image_array = explode(',', $product_r['product_image']); 
                             $i=1;
                               foreach($multi_image_array as $image){
                                   if($i<=2){
                                 $product_img = getImage($image, 407, 305, $product_r[product_title].$i ,"/uploaded-files/product-images/");
                                   ?>
                                                    <img class="item <?php if($i=="1"){ echo "active";}?>"
                                                        src="<?=site_url?>/uploaded-files/product-images/<?=$image; ?>"
                                                        alt="<?=$product_r[product_title]?> Manufacturers, Suppliers, Exporters in India"
                                                        title="<?=$product_r[product_title]?> in India">
                                                    <?php } $i++;  }  ?>
                                                    <?php if($product_r[product_video]){
                                                    
                                                    ?>

                                                    <div class="item youtube">
                                                        <a data-fancybox
                                                            href="https://www.youtube.com/watch?v=<?=$product_r[product_video]?>">
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="16"
                                                                height="16" fill="currentColor" viewBox="0 0 16 16">
                                                                <path
                                                                    d="m11.596 8.697-6.363 3.692c-.54.313-1.233-.066-1.233-.697V4.308c0-.63.692-1.01 1.233-.696l6.363 3.692a.802.802 0 0 1 0 1.393z">
                                                                </path>
                                                            </svg></a>
                                                    </div>

                                                    <?php }?>

                                                </div>
                                                <?php } ?>
                                            </div>
                                        </div>
                                        <div class="col-xxl-7 col-xl-7 col-lg-7 col-md-7 col-sm-7 col-12">
                                            <div class="right-content">
                                                <h4 class="product-list-title"><a href="javascript:void()"
                                                        title="<?=$product_r[product_title]?>Manufacturers, Suppliers, Exporters in India"><?=$product_r[product_title]?></a>
                                                </h4>
                                                <div class="blue-line1"></div>
                                            </div>
                                            <div class="more_info">
                                                <?=$product_r['product_specfi']?>
                                            </div>

                                            <div class="clearfix"></div>
                                            <a href="javascript:void()" data-bs-toggle="modal"
                                                data-bs-target="#productID" class="read_more_product btn-style-two"
                                                title=""><span><i class="fa fa-envelope me-2"></i> Get Best Quote
                                                </span></a>
                                            <a href="javascript:void()" data-bs-toggle="modal" data-bs-target="#call"
                                                class="read_more_product btn-style-two" title=""><span> <i
                                                        class="fa fa-phone me-2"></i>
                                                    Request A Call Back</span></a>

                                        </div>
                                    </div>
                                </div>
                            </div><!-- product-listing -->
                            <?php  } } ?>

                            <!-- You May Also Like  -->
                            <?php 
                            $related_s = "select * from category_tbl where parentID='$cat_res[parentID]' and catID!='$cat_res[catID]' and status='Y' order by catOrder";
                            $related_q = mysqli_query($dbconn,$related_s);
                            if(mysqli_num_rows($related_q)){ 
                            ?>
                            <div class="you_may">You May Also Like:</div>
                            <div class="clearfix"></div>
                            <?php    
                                while($related_res=mysqli_fetch_array($related_q)) {
                            $img = getImage($related_res[catImage], 340, 340, $related_res[catName],"/uploaded-files/category/images/");
                                            ?>
                            <div class="product_listing">
                                <div class="row">
                                    <div class="col-xxl-4 col-xl-4 col-lg-4 col-md-4 col-sm-4 col-12">
                                        <div class="product">
                                            <div class="more_images">
                                                <div class="single_image">
                                                    <a href="<?=site_url;?>/<?=getValidFileName($related_res['catName']);?>.htm"
                                                        title="<?=$related_res[catName]?> in India">
                                                        <img src="<?=$img?>" alt="<?=$related_res[catName]?> in India"
                                                            title="<?=$related_res[catName]?> in India">
                                                    </a>
                                                </div>
                                            </div>

                                            <p>Interested in this product?</p>

                                            <a title="Get Best Quote" class="theme-btn btn-style-two"
                                                href="javascript:void()" data-bs-toggle="modal"
                                                data-bs-target="#productID"
                                                onclick="$('#catID').val('<?php echo $related_res['catID']; ?>');
                                 $('#catName').val('<?php echo $related_res['catName']; ?>');
                                 $('.catName').html('<?php echo $related_res['catName']; ?>');  $('.catImg').attr('src','<?=site_url;?>/uploaded-files/category/images/<?php echo ($related_res['catImage']);?>');"><span>Get
                                                    Best Quote</span></a>
                                        </div>
                                    </div>
                                    <div class="col-xxl-8 col-xl-8 col-lg-8 col-md-8 col-sm-8 col-12">
                                        <div class="right-content">
                                            <h4 class="product-list-title"><a
                                                    href="<?=site_url;?>/<?=getValidFileName($related_res['catName']);?>.htm"
                                                    title="<?php echo $related_res['catName']; ?> in India"><?php echo $related_res['catName']; ?></a>
                                            </h4>
                                            <div class="blue-line1"></div>
                                            <?=html_entity_decode($related_res['catDesc']);?>
                                            <div class="clearfix"></div>
                                            <a href="<?=site_url;?>/<?=getValidFileName($related_res['catName']);?>.htm"
                                                class="read_more_product btn-style-two" title="Read More"><span> Read
                                                    More
                                                </span></a>
                                            <a href="javascript:void()" data-bs-toggle="modal" data-bs-target="#call"
                                                class="read_more_product btn-style-two" title="Request A Call Back"
                                                onclick="$('#catID').val('<?php echo $related_res['catID']; ?>');
                                 $('#catName').val('<?php echo $related_res['catName']; ?>');
                                 $('.catName').html('<?php echo $related_res['catName']; ?>');  $('.catImg').attr('src','<?=site_url;?>/uploaded-files/category/images/<?php echo ($related_res['catImage']);?>');"><span>
                                                    <i class="fa fa-phone me-2"></i>
                                                    Request A Call Back</span></a>

                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php  } } ?>
                        </div>
                    </div>
              
        </section>

        <?php } ?>

        <?php include 'components/app_testi_client.php';?>
        <!-- Footer -->
        <?php include 'components/footer.php';?>
    </div>
    <?php include 'components/bottom_footer.php';?>
    <script>
    <?php for($i=1;$i<=6;$i++){ ?>
    $('#small<?=$i?> .item').click(function() {
        $('#bigImage<?=$i?> img').attr('src', $(this).attr('src').replace('thumb', 'large'));
        if ($(this).hasClass("active")) {
            $("#small<?=$i?> .item").removeClass("active");
        } else {
            $("#small<?=$i?> .item").removeClass("active");
            $(this).addClass("active");
        }
    });
    <?php }?>
    </script>
</body>

</html>