<?php
include('cms/includes/config.php');
include('cms/includes/session.php');
include('cms/includes/function.php');

$database = new Database();
$session = new Session();

$limit = 9;  // Number of entries to show in a page.
// Look for a GET variable page if not found default is 1.     
if (isset($_GET["page"])) { 
  $pn  = $_GET["page"]; 
} 
else { 
  $pn=1; 
};  

$start_from = ($pn-1) * $limit;

//search filter code
$homesearchfilter = $_POST['homesearchfilter'];
$listingsearchfilter = $_POST['listingsearchfilter'];

if($homesearchfilter=="1"){
    $searchkeywords = $_POST['searchkeywords'];
    $photosubject = $_POST['photosubject'];
    $listingcountry = $_POST['listingcountry'];
    
    $getAssocCatRecord = $database->getRecords("manage_associate_category", "cat_id='".$photosubject."'", "created_on ASC");
    $getAssocLocRecord = $database->getRecords("manage_associate_locations", "cat_id='".$listingcountry."'", "created_on ASC");
    
    foreach($getAssocCatRecord as $record):
        $catTourNums .= $record['tour_id'].",";
    endforeach;
    
    foreach($getAssocLocRecord as $record):
        $locTourNums .= $record['tour_id'].",";
    endforeach;
    
    $tourids = rtrim($catTourNums.$locTourNums, ",");
    
    $getTours = $database->getRecords("manage_tours", "(keywords LIKE '%".$searchkeywords."%' OR title LIKE '%".$searchkeywords."%') OR num IN ('".$tourids."')", "created_on DESC LIMIT $start_from, $limit");
} else if($listingsearchfilter=="1") {
    $searchkeywords = $_POST['searchkeywords'];
    $addAssocSubCats = $_POST['tourSubCat'];
    $addAssocSubLocs = $_POST['tourSubLoc'];
    
    for ($a=0; $a<count($addAssocSubCats); $a++) {
        $getCatTourId = $database->getRecord("manage_associate_category", "sub_cat_id='".$addAssocSubCats[$a]."'");
        $catTourNums .= $getCatTourId['tour_id'].",";
    }
    
    for ($a=0; $a<count($addAssocSubLocs); $a++) {
        $getLocTourId = $database->getRecord("manage_associate_locations", "sub_loc_id='".$addAssocSubLocs[$a]."'");
        $locTourNums .= $getLocTourId['tour_id'].",";
    }
    
    $tourids = rtrim($catTourNums.$locTourNums, ",");
    
    if(!empty($searchkeywords)) {
        $getTours = $database->getRecords("manage_tours", "keywords LIKE '%".$searchkeywords."%' OR num IN (".$tourids.")", "created_on DESC LIMIT $start_from, $limit");
    } else {
        $getTours = $database->getRecords("manage_tours", "num IN (".$tourids.")", "created_on DESC LIMIT $start_from, $limit");
    }
} else {
    $getTours = $database->getRecords("manage_tours", "1", "created_on DESC LIMIT $start_from, $limit");
}

$getTourCats = $database->getRecords("manage_tour_cat", "cat_id='0' AND num!=31", "created_on ASC");
$getTourLocations = $database->getRecords("manage_locations", "cat_id='0'", "created_on ASC");

include('includes/code.php');
?>
<!DOCTYPE html>
<html dir="ltr" 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">
<meta name="keywords" content="advanced search custom, agency, agent, business, clean, corporate, directory, google maps, homes, listing, membership packages, property, real estate, real estate agent, realestate agency, realtor">
<meta name="description" content="VirtualVisitTours">
<meta name="CreativeLayers" content="ATFN">
<!-- css file -->
<link rel="stylesheet" href="<?php echo WEBSITE_URL;?>css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo WEBSITE_URL;?>css/style.css">
<!-- Responsive stylesheet -->
<link rel="stylesheet" href="<?php echo WEBSITE_URL;?>css/responsive.css">
<!-- Title -->
<title>VirtualVisitTours</title>
<!-- Favicon -->
<link href="<?php echo WEBSITE_URL;?><?php echo WEBSITE_URL;?>images/favicon.ico" sizes="128x128" rel="shortcut icon" type="image/x-icon" />
<link href="<?php echo WEBSITE_URL;?><?php echo WEBSITE_URL;?>images/favicon.ico" sizes="128x128" rel="shortcut icon" />


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simplePagination.<?php echo WEBSITE_URL;?>js/1.6/simplePagination.min.css">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
    <input type="hidden" name="siteurl" id="siteurl" value="<?php echo WEBSITE_URL;?>">
<div class="wrapper">
	<div class="preloader"></div>

	<!-- Main Header Nav -->
	<header class="header-nav menu_style_home_one style2 navbar-scrolltofixed stricky main-menu">
		<div class="container-fluid p0">
		    <!-- Ace Responsive Menu -->
		    <nav>
		        <!-- Menu Toggle btn-->
		        <div class="menu-toggle">
		            <img class="nav_logo_img img-fluid" src="<?php echo WEBSITE_URL;?>images/logo_front.png" alt="header-logo.png">
		            <button type="button" id="menu-btn">
		                <span class="icon-bar"></span>
		                <span class="icon-bar"></span>
		                <span class="icon-bar"></span>
		            </button>
		        </div>
		        <a href="index.php" class="navbar_brand float-left dn-smd">
		            <img class="logo1 img-fluid" src="<?php echo WEBSITE_URL;?>images/logo_front.png" alt="header-logo.png" style="width:300px;">
		            <img class="logo2 img-fluid" src="<?php echo WEBSITE_URL;?>images/logo_front.png" alt="header-logo2.png" style="width:300px;">
		        </a>
		        <!-- Responsive Menu Structure-->
		        <!--Note: declare the Menu style in the data-menu-style="horizontal" (options: horizontal, vertical, accordion) -->
		        <ul id="respMenu" class="ace-responsive-menu text-right" data-menu-style="horizontal">
		            <li>
		                <a href="index.php"><span class="title">Home</span></a>
		            </li>
		            <li>
		                <a href="listing.php"><span class="title">Explore</span></a>
		            </li>
		            <li>
		                <a href="#"><span class="title">Licence</span></a>
		            </li>
		            <li>
		                <a href="<?php echo CMS_ROOT;?>addbusiness.php"><span class="title">Add Your Business</span></a>
		            </li>
		            <li>
		                <a href="photographers.php"><span class="title">Photographers</span></a>
		            </li>
		            <li>
		                <a href="contact.php"><span class="title">Contact</span></a>
		            </li>
	                <li class="list-inline-item list_s"><?php if($isFrontLoggedIn=="0" || empty($isFrontLoggedIn)){?><a href="#" class="btn flaticon-user" data-toggle="modal" data-target=".bd-example-modal-lg"> <span class="dn-lg">Login/Register</span></a><?php } else {?><a href="javascript:void(0);">Welcome <?php echo $getLoggedinDetails['first_name'];?></a>
	                
	                <ul>
	                    <li><a href="javascript:void(0);" class="btn flaticon-user redirecttocms" style="text-align:left;"> <span class="dn-lg">My Account</span></a></li>
	                    <li><a href="<?php echo WEBSITE_URL;?>logout.php" class="btn flaticon-logout" style="text-align:left;"> <span class="dn-lg">Logout</span></a></li>
	                </ul><?php } ?></li>
	                <!--<li class="list-inline-item add_listing"><a href="page-add-new-property.html"><span class="flaticon-plus"></span><span class="dn-lg"> Create Listing</span></a></li>-->
		        </ul>
		    </nav>
		</div>
	</header>
	<!-- Modal -->
	<div class="sign_up_modal modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="modal-dialog modal-lg" role="document">
		    <div class="modal-content">
		      	<div class="modal-header">
		        	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		      	</div>
		      	<div class="modal-body container pb20">
		      		<div class="row">
		      			<div class="col-lg-12">
				    		<ul class="sign_up_tab nav nav-tabs" id="myTab" role="tablist">
							  	<li class="nav-item">
							    	<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Login</a>
							  	</li>
							  	<li class="nav-item">
							    	<a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Register</a>
							  	</li>
							</ul>
		      			</div>
		      		</div>
					<div class="tab-content container" id="myTabContent">
					  	<div class="row mt25 tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
					  		<div class="col-lg-6 col-xl-6">
					  			<div class="login_thumb">
					  				<img class="img-fluid w100" src="<?php echo WEBSITE_URL;?>images/reg1.jpg" alt="login.jpg">
					  			</div>
					  		</div>
					  		<div class="col-lg-6 col-xl-6">
								<div class="login_form">
									<form action="" name="loginform" id="loginform" method="post">
									    <input type="hidden" name="action" value="frontloginform">
										<div class="heading">
											<h4>Login</h4>
										</div>
										<div style="background:red; color:#fff; padding:10px; width:100%;" id="alertLoginMessage"></div>
										<!--<div class="row mt25">
											<div class="col-lg-12">
												<button type="submit" class="btn btn-fb btn-block"><i class="fa fa-facebook float-left mt5"></i> Login with Facebook</button>
											</div>
											<div class="col-lg-12">
												<button type="submit" class="btn btn-googl btn-block"><i class="fa fa-google float-left mt5"></i> Login with Google</button>
											</div>
										</div>
										<hr>-->
										<div class="input-group mb-2 mr-sm-2">
										    <input type="text" class="form-control" required name="inlineFormInputGroupUsername2" id="inlineFormInputGroupUsername2" placeholder="User Name Or Email">
										    <div class="input-group-prepend">
										    	<div class="input-group-text"><i class="flaticon-user"></i></div>
										    </div>
										</div>
										<div class="input-group form-group">
									    	<input type="password" class="form-control" required id="exampleInputPassword1" name="exampleInputPassword1" placeholder="Password">
										    <div class="input-group-prepend">
										    	<div class="input-group-text"><i class="flaticon-password"></i></div>
										    </div>
										</div>
										<!--<div class="form-group custom-control custom-checkbox">
											<input type="checkbox" class="custom-control-input" id="exampleCheck1">
											<label class="custom-control-label" for="exampleCheck1">Remember me</label>
											<a class="btn-fpswd float-right" href="#">Lost your password?</a>
										</div>-->
										<button type="submit" class="btn btn-log btn-block loginsubmit btn-thm">Log In</button>
										<!--<p class="text-center">Don't have an account? <a class="text-thm" href="#">Register</a></p>-->
									</form>
								</div>
					  		</div>
					  	</div>
					  	<div class="row mt25 tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
					  		<div class="col-lg-6 col-xl-6">
					  			<div class="regstr_thumb">
					  				<img class="img-fluid w100" src="<?php echo WEBSITE_URL;?>images/reg.jpg" alt="regstr.jpg">
					  			</div>
					  		</div>
					  		<div class="col-lg-6 col-xl-6">
								<div class="sign_up_form">
									<div class="heading">
										<h4>Register</h4>
									</div>
									<form action="#" name="phototgrapherForm" id="phototgrapherForm" method="post">
									    <div style="background:green; color:#fff; padding:10px; width:100%;" id="alertMessage"></div>
									    <input type="hidden" name="action" value="registerForm">
										<!--<div class="row">
											<div class="col-lg-12">
												<button type="submit" class="btn btn-block btn-fb"><i class="fa fa-facebook float-left mt5"></i> Login with Facebook</button>
											</div>
											<div class="col-lg-12">
												<button type="submit" class="btn btn-block btn-googl"><i class="fa fa-google float-left mt5"></i> Login with Google</button>
											</div>
										</div>
										<hr>-->
										<div class="form-group input-group">
										    <select name="usertype" required id="usertype" class="form-control">
										        <option value="">Select User Type</option>
										        <?php foreach($getUserType as $record):?>
										        <option value="<?php echo $record['num'];?>"><?php echo $record['title'];?></option>
										        <?php endforeach;?>
										    </select>
										</div>
										
										<div class="form-group input-group">
										    <input type="text" class="form-control" required name="firstName" id="firstName" placeholder="First Name">
										    <div class="input-group-prepend">
										    	<div class="input-group-text"><i class="flaticon-user"></i></div>
										    </div>
										</div>
										<div class="form-group input-group">
										    <input type="text" class="form-control" required name="lastName" id="lastName" placeholder="Last Name">
										    <div class="input-group-prepend">
										    	<div class="input-group-text"><i class="flaticon-user"></i></div>
										    </div>
										</div>
										<div class="form-group input-group">
										    <input type="email" class="form-control" required name="exampleInputEmail2" id="exampleInputEmail2" placeholder="Email">
										    <div class="input-group-prepend">
										    	<div class="input-group-text"><i class="fa fa-envelope-o"></i></div>
										    </div>
										</div>
										<div class="form-group input-group">
										    <input type="password" class="form-control" required name="exampleInputPassword2" id="exampleInputPassword2" placeholder="Password">
										    <div class="input-group-prepend">
										    	<div class="input-group-text"><i class="flaticon-password"></i></div>
										    </div>
										</div>
										<div class="form-group input-group">
										    <input type="password" class="form-control" required name="exampleInputPassword3" id="exampleInputPassword3" placeholder="Re-enter password">
										    <div class="input-group-prepend">
										    	<div class="input-group-text"><i class="flaticon-password"></i></div>
										    </div>
										</div>
										<div id="CheckPasswordMatch"></div>
										<!--<div class="form-group ui_kit_select_search mb0">
											<select class="selectpicker" data-live-search="true" data-width="100%">
												<option data-tokens="SelectRole">Single User</option>
												<option data-tokens="Agent/Agency">Agent</option>
												<option data-tokens="SingleUser">Multi User</option>
											</select>
										</div>-->
										<div class="form-group custom-control custom-checkbox">
											<input type="checkbox" required class="custom-control-input" id="exampleCheck2">
											<label class="custom-control-label" for="exampleCheck2">I have read and accept the Terms and Privacy Policy?</label>
										</div>
										<button type="submit" class="btn btn-log btn-block btn-thm">Sign Up</button>
										<!--<p class="text-center">Already have an account? <a class="text-thm" href="#">Log In</a></p>-->
									</form>
								</div>
					  		</div>
					  	</div>
					</div>
		      	</div>
		    </div>
		</div>
	</div>

	<!-- Main Header Nav For Mobile -->
	<div id="page" class="stylehome1 h0">
		<div class="mobile-menu">
			<div class="header stylehome1">
				<div class="main_logo_home2 text-center">
		            <img class="nav_logo_img img-fluid mt20" src="<?php echo WEBSITE_URL;?>images/header-logo2.png" alt="header-logo2.png">
		            <span class="mt20">FindHouse</span>
				</div>
				<ul class="menu_bar_home2">
	                <li class="list-inline-item list_s"><a href="page-register.html"><span class="flaticon-user"></span></a></li>
					<li class="list-inline-item"><a href="#menu"><span></span></a></li>
				</ul>
			</div>
		</div><!-- /.mobile-menu -->
		<nav id="menu" class="stylehome1">
			<ul>
				<li><span>Home</span>
	                <ul>
	                    <li><a href="index.html">Home 1</a></li>
	                    <li><a href="index2.html">Home 2</a></li>
	                    <li><a href="index3.html">Home 3</a></li>
	                    <li><a href="index4.html">Home 4</a></li>
	                    <li><a href="index5.html">Home 5</a></li>
	                    <li><a href="index6.html">Home 6</a></li>
	                    <li><a href="index7.html">Home 7</a></li>
	                    <li><a href="index8.html">Home 8</a></li>
	                    <li><a href="index9.html">Home 9</a></li>
	                    <li><a href="index10.html">Home 10</a></li>
	                </ul>
				</li>
				<li><span>Listing</span>
					<ul>
						<li><span>Listing Grid</span>
							<ul>
	                            <li><a href="page-listing-grid-v1.html">Grid v1</a></li>
	                            <li><a href="page-listing-grid-v2.html">Grid v2</a></li>
	                            <li><a href="page-listing-grid-v3.html">Grid v3</a></li>
	                            <li><a href="page-listing-grid-v4.html">Grid v4</a></li>
	                            <li><a href="page-listing-grid-v5.html">Grid v5</a></li>
	                            <li><a href="page-listing-full-width-grid.html">Grid Fullwidth</a></li>
							</ul>
						</li>
						<li><span>Listing Style</span>
							<ul>
	                            <li><a href="page-listing-parallax.html">Parallax Style</a></li>
	                            <li><a href="page-listing-slider.html">Slider Style</a></li>
	                            <li><a href="page-listing-map.html">Map Header</a></li>
							</ul>
						</li>
						<li><span>Listing Half</span>
							<ul>
	                            <li><a href="page-listing-half-map-v1.html">Map V1</a></li>
	                            <li><a href="page-listing-half-map-v2.html">Map V2</a></li>
	                            <li><a href="page-listing-half-map-v3.html">Map V3</a></li>
	                            <li><a href="page-listing-half-map-v4.html">Map V4</a></li>
							</ul>
						</li>
						<li><span>Agent View</span>
							<ul>
	                            <li><a href="page-listing-agent-v1.html">Agent V1</a></li>
	                            <li><a href="page-listing-agent-v2.html">Agent V2</a></li>
	                            <li><a href="page-listing-agent-v3.html">Agent Details</a></li>
							</ul>
						</li>
						<li><span>Agencies View</span>
							<ul>
	                            <li><a href="page-agencies-list-v1.html">Agencies V1</a></li>
	                            <li><a href="page-agencies-list-v2.html">Agencies V2</a></li>
	                            <li><a href="page-agencies-list-v3.html">Agencies Details</a></li>
							</ul>
						</li>
					</ul>
				</li>
				<li><span>Property</span>
					<ul>
						<li><span>Property</span>
							<ul>
					            <li><a href="page-dashboard.html">Dashboard</a></li>
			                    <li><a href="page-my-properties.html">My Properties</a></li>
			                    <li><a href="page-add-new-property.html">Add New Property</a></li>
							</ul>
						</li>
						<li><span>Listing Single</span>
							<ul>
	                            <li><a href="page-listing-single-v1.html">Single V1</a></li>
	                            <li><a href="page-listing-single-v2.html">Single V2</a></li>
	                            <li><a href="page-listing-single-v3.html">Single V3</a></li>
	                            <li><a href="page-listing-single-v4.html">Single V4</a></li>
	                            <li><a href="page-listing-single-v5.html">Single V5</a></li>
							</ul>
						</li>
					</ul>
				</li>
				<li><span>Blog</span>
					<ul>
	                    <li><a href="page-blog-v1.html">Blog List 1</a></li>
	                    <li><a href="page-blog-grid.html">Blog List 2</a></li>
	                    <li><a href="page-blog-single.html">Single Post</a></li>
					</ul>
				</li>
				<li><span>Pages</span>
					<ul>
						<li><span>Shop</span>
							<ul>
			                    <li><a href="page-shop.html">Shop</a></li>
			                    <li><a href="page-shop-single.html">Shop Single</a></li>
			                    <li><a href="page-shop-cart.html">Cart</a></li>
			                    <li><a href="page-shop-checkout.html">Checkout</a></li>
			                    <li><a href="page-shop-order.html">Order</a></li>
							</ul>
						</li>
		                <li><a href="page-about.html">About Us</a></li>
		                <li><a href="page-gallery.html">Gallery</a></li>
		                <li><a href="page-faq.html">Faq</a></li>
		                <li><a href="page-login.html">LogIn</a></li>
		                <li><a href="page-compare.html">Membership</a></li>
		                <li><a href="page-compare2.html">Membership 2</a></li>
	                    <li><a href="page-register.html">Register</a></li>
	                    <li><a href="page-service.html">Service</a></li>
		                <li><a href="page-error.html">404 Page</a></li>
		                <li><a href="page-terms.html">Terms and Conditions</a></li>
		                <li><a href="page-ui-element.html">UI Elements</a></li>
					</ul>
				</li>
				<li><a href="page-contact.html">Contact</a></li>
				<li><a href="page-login.html"><span class="flaticon-user"></span> Login</a></li>
				<li><a href="page-register.html"><span class="flaticon-edit"></span> Register</a></li>
				<li class="cl_btn"><a class="btn btn-block btn-lg btn-thm circle" href="#"><span class="flaticon-plus"></span> Create Listing</a></li>
			</ul>
		</nav>
	</div>

	<!-- Listing Grid View -->
	<section class="our-listing bgc-f7 pb30-991">
		<div class="container">
			<div class="row">
				<div class="col-sm-12">
					<div class="listing_sidebar">
						<div class="sidebar_content_details style3">
							<!-- <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a> -->
							<div class="sidebar_listing_list style2 mb0">
								<form action="<?php echo WEBSITE_URL;?>listing.php" name="listingsearchform" id="listingsearchform" method="post">
					            <input type="hidden" value="1" name="listingsearchfilter">
								<div class="sidebar_advanced_search_widget">
									<h4 class="mb25">Advanced Search <a class="filter_closed_btn float-right" href="#"><small>Hide Filter</small> <span class="flaticon-close"></span></a></h4>
									<ul class="sasw_list style2 mb0">
										<li class="search_area">
										    <div class="form-group">
										    	<input type="text" class="form-control" name="searchkeywords" id="searchkeywords" placeholder="keyword">
										    	<label for="searchkeywords"><span class="flaticon-magnifying-glass"></span></label>
										    </div>
										</li>
										
										<li style="display:none;">
											<div class="small_dropdown2">
											    <div id="prncgs" class="btn dd_btn">
											    	<span>Price</span>
											    	<label for="exampleInputEmail2"><span class="fa fa-angle-down"></span></label>
											    </div>
											  	<div class="dd_content2 w100">
												    <div class="pricing_acontent">
														<!-- <input type="text" class="amount" placeholder="$52,239"> 
														<input type="text" class="amount2" placeholder="$985,14">
														<div class="slider-range"></div> -->
												    	<span id="slider-range-value1"></span>
														<span class="mt0" id="slider-range-value2"></span>
													    <div id="slider"></div>
												    </div>
											  	</div>
											</div>
										</li>
										
										<li>
										    
										    <h5>Tour Categories</h5><br>
										  	<div id="accordion" class="panel-group">
											    <div class="panel">
											      	<?php foreach($getTourCats as $record):
											      	$getTourSubCats = $database->getRecords("manage_tour_cat", "cat_id='".$record['num']."'", "created_on ASC");
											      	?>
											      	<div class="panel-heading">
												      	<h4 class="panel-title">
												        	<a href="#panelBodyRatingcat<?php echo $record['num'];?>" class="accordion-toggle link" data-toggle="collapse" data-parent="#accordion"><i class="flaticon-more"></i> <?php echo $record['title'];?></a>
												        </h4>
											      	</div>
												    <div id="panelBodyRatingcat<?php echo $record['num'];?>" class="panel-collapse collapse">
												        <div class="panel-body row">
												      		<div class="col-lg-12">
												                <ul class="float-left fn-400">
												                	<?php foreach($getTourSubCats as $recorda):?>
												                	<li style="float:left; margin-right:10px;">
																			<input type="checkbox" class="" value="<?php echo $recorda['num'];?>" name="tourSubCat[]" id="customChecksubcat<?php echo $recorda['num'];?>">
																			<label class="" for="customCheck1"><?php echo $recorda['title'];?></label>
												                	</li>
												                	<?php endforeach;?>
												                	
												                </ul>
													        </div>
												        </div>
												    </div>
												    <hr>
											      	
												    <?php endforeach;?>
											    </div>
											</div>
										</li>
										
										<li>
										    
										    <h5>Tour Locations</h5><br>
										  	<div id="accordion" class="panel-group">
											    <div class="panel">
											      	<?php foreach($getTourLocations as $record):
											      	$getTourSubLocs = $database->getRecords("manage_locations", "cat_id='".$record['num']."'", "created_on ASC");
											      	?>
											      	<div class="panel-heading">
												      	<h4 class="panel-title">
												        	<a href="#panelBodyRatingloc<?php echo $record['num'];?>" class="accordion-toggle link" data-toggle="collapse" data-parent="#accordion"><i class="flaticon-more"></i> <?php echo $record['title'];?></a>
												        </h4>
											      	</div>
												    <div id="panelBodyRatingloc<?php echo $record['num'];?>" class="panel-collapse collapse">
												        <div class="panel-body row">
												      		<div class="col-lg-12">
												                <ul class="float-left fn-400">
												                	<?php foreach($getTourSubLocs as $recorda):?>
												                	<li style="float:left; margin-right:10px;">
																			<input type="checkbox" class="" value="<?php echo $recorda['num'];?>" name="tourSubLoc[]" id="customChecksubloc<?php echo $recorda['num'];?>">
																			<label class="" for="customCheck1"><?php echo $recorda['title'];?></label>
												                	</li>
												                	<?php endforeach;?>
												                	
												                </ul>
													        </div>
												        </div>
												    </div>
												    <hr>
											      	
												    <?php endforeach;?>
											    </div>
											</div>
										</li>
										<li>
											<div class="search_option_button">
											    <button type="submit" class="btn btn-block btn-thm">Search</button>
											</div>
										</li>
									</ul>
								</div>
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-md-8 col-lg-6">
					<div class="breadcrumb_content style2">
						<ol class="breadcrumb">
						    <li class="breadcrumb-item"><a href="index.php">Home</a></li>
						    <?php if($_REQUEST['cat']=="1" || $_REQUEST['cat']=="2" || $_REQUEST['cat']=="3" || $_REQUEST['cat']=="4") {?>
						    <li class="breadcrumb-item">Category</li>
						    <?php }?>
						    <li class="breadcrumb-item active text-thm" aria-current="page">
						        <?php if($_REQUEST['cat']=="1") {?>
						        Beaches
						        <?php } else if($_REQUEST['cat']=="2") { ?>
						        Historic Buildings
						        <?php } else if($_REQUEST['cat']=="3") { ?>
						        The Great Outdoors
						        <?php } else if($_REQUEST['cat']=="4") { ?>
						        Hotels
						        <?php } else { ?>
						        Listing<?php } ?></li>
						</ol>
						<h2 class="breadcrumb_title"><?php if($_REQUEST['cat']=="1") {?>
						        Beaches
						        <?php } else if($_REQUEST['cat']=="2") { ?>
						        Historic Buildings
						        <?php } else if($_REQUEST['cat']=="3") { ?>
						        The Great Outdoors
						        <?php } else if($_REQUEST['cat']=="4") { ?>
						        Hotels
						        <?php } else { ?>
						        Listing<?php } ?></h2>
					</div>
				</div>
				<div class="col-md-4 col-lg-6">
					<div class="sidebar_switch text-right">
						<div id="main2">
						    <a href="listing-map.php" style="position: relative; right: 200px; top: 5px;" class="btn btn-lg btn-thm">Show Map View</a>
							<span id="open2" class="flaticon-filter-results-button filter_open_btn"> Show Filter</span>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-lg-12">
					
					<div class="row tour-lisitng">
						<?php //if($_REQUEST['cat']=="1") {
						    ?>
						 <?php foreach($getTours as $record):
						$getUserDetails = $database->getRecord("manage_users", "num='".$record['user_id']."'");
						?>
						 <div class="col-md-6 col-lg-4 items">
							<div class="feat_property">
								<a href="details.php?title=<?php echo $database->cleanText($record['title']);?>&num=<?php echo $record['num'];?>"><div class="thumb">
									<img class="img-whp" src="<?php echo $record['featured_image'];?>" alt="fp1.jpg">
								</div></a>
								<div class="details">
									<div class="tc_content">
										<h4><?php echo $record['title'];?></h4>
										<p><span class="flaticon-placeholder"></span> <?php echo $record['town'];?>, <?php echo $record['country'];?></p>
										<p><?php echo $record['short_desc'];?></p>
									</div>
									<div class="fp_footer">
										<ul class="fp_meta float-left mb0">
											<li class="list-inline-item"><a href="agent_detail.php?num=<?php echo $record['num'];?>"><img src="https://vvt.theflexstudio.com/<?php echo WEBSITE_URL;?>images/ph1.jpg" style="width:40px; height:40px; border-radius:100px;" alt="pposter1.png"></a></li>
											<li class="list-inline-item"><a href="agent_detail.php?num=<?php echo $getUserDetails['num'];?>"><?php echo $getUserDetails['first_name']." ".$getUserDetails['last_name'];?></a></li>
										</ul>
										<div class="fp_pdate float-right">1 years ago</div>
									</div>
								</div>
							</div>
						</div>
						<?php endforeach;?> 
						
						<?php //} else if($_REQUEST['cat']=="4") {?>
						
						<!--<div class="col-md-6 col-lg-4">
							<div class="feat_property">
								<a href="details.php?num=3"><div class="thumb">
									<img class="img-whp" src="<?php echo WEBSITE_URL;?>images/beaches.jpg" alt="fp1.jpg" style="opacity:1;">
								</div></a>
								<div class="details">
									<div class="tc_content">
										<h4>Hotel Tour</h4>
										<p><span class="flaticon-placeholder"></span> Donegal, Ireland</p>
										<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
									</div>
									<div class="fp_footer">
										<ul class="fp_meta float-left mb0">
											<li class="list-inline-item"><a href="agent_detail.php?num=1"><img src="https://vvt.theflexstudio.com/<?php echo WEBSITE_URL;?>images/ph1.jpg" style="width:40px; height:40px; border-radius:100px;" alt="pposter1.png"></a></li>
											<li class="list-inline-item"><a href="agent_detail.php">Ali Tufan</a></li>
										</ul>
										<div class="fp_pdate float-right">6 months ago</div>
									</div>
								</div>
							</div>
						</div>-->
						
						 <?php //} else {?>
                    				<!--<div class="col-lg-10 offset-lg-1 text-center">
                    					<div class="error_page footer_apps_widget">
                    						<img class="img-fluid" src="<?php echo WEBSITE_URL;?>images/404.png" alt="error.png">
                    						<div class="erro_code"><h1>Oops!</h1></div>
                    						<p>We don’t seem to have a photo for you</p>
                    					</div>
                    					<a class="btn btn_error btn-thm" href="index.php">Back To Home</a>
                    				</div>-->
						 <?php //} ?>
						
						<div class="col-lg-12 mt20">
							<div class="mbp_pagination">
								<ul class="page_navigation">
								    
								    <?php
								    if($homesearchfilter=="1"){
								         $sql = "SELECT COUNT(*) FROM manage_tours WHERE keywords LIKE '%".$searchkeywords."%' OR num IN (".$tourids.")";
								    } else {
								        $sql = "SELECT COUNT(*) FROM manage_tours";
								    }
                                      
                                    $rs_result = mysqli_query($conn, $sql);  
                                    $row = mysqli_fetch_row($rs_result);  
                                    $total_records = $row[0];  
                                      
                                    // Number of pages required.
                                    $total_pages = ceil($total_records / $limit); 
                                    $k = (($pn+4>$total_pages)?$total_pages-4:(($pn-4<1)?5:$pn));
                                    $pagLink = "";      
                                    
                                    
                                    if($pn>=2){
                                        echo "<li class='page-item'><a class='page-link' href='listing.php?page=1'> << </a></li>";
                                        echo "<li class='page-item'><a class='page-link' href='listing.php?page=".($pn-1)."'> < </a></li>";
                                    } else {
                                        echo "<li class='page-item disabled'>
								    	<a class='page-link' href='javascript:void(0);' tabindex='-1' aria-disabled='true'> <span class='flaticon-left-arrow'></span> Prev</a></li>";
                                    }
                                    for ($i=-4; $i<=4; $i++) {
                                      if($k+$i==$pn)
                                        $pagLink .= "<li class='page-item active'><a class='page-link' href='listing.php?page=".($k+$i)."'>".($k+$i)."</a></li>";
                                      else
                                        $pagLink .= "<li class='page-item'><a class='page-link' href='listing.php?page=".($k+$i)."'>".($k+$i)."</a></li>";  
                                    };  
                                    echo $pagLink;
                                    if($pn<$total_pages){
                                        echo "<li class='page-item'><a class='page-link' href='listing.php?page=".($pn+1)."'> > </a></li>";
                                        echo "<li class='page-item'><a class='page-link' href='listing.php?page=".$total_pages."'> >> </a></li>";
                                    } 
                                    
                                  ?>
								    
								</ul>
							</div>
						</div>
					</div><br><br>
					
				</div>
			</div>
		</div>
	</section>

	<!-- Our Footer -->
	<section class="footer_one">
		<div class="container">
			<div class="row">
				<div class="col-sm-6 col-md-6 col-lg-3 col-xl-3 pr0 pl0">
					<div class="footer_about_widget">
						<h4>About Virtual Visit Tours</h4>
						<p>We are here to bring 360° photographs, virtual tours and photographers together from destinations around the globe, expose their work to an ever growing audience of admirers and allow you - the viewer - to be in the picture.</p>
					</div>
				</div>
				<div class="col-sm-6 col-md-6 col-lg-3 col-xl-3">
					<div class="footer_qlink_widget">
						<h4>Quick Links</h4>
						<ul class="list-unstyled">
							<li><a href="index.php">Home</a></li>
							<li><a href="listing.php">Explore</a></li>
							<li><a href="#">Learn</a></li>
							<li><a href="about.php">About</a></li>
							<li><a href="faq.php">FAQ’s</a></li>
							<li><a href="contact.php">Contact</a></li>
						</ul>
					</div>
				</div>
				<div class="col-sm-6 col-md-6 col-lg-3 col-xl-3">
					<div class="footer_contact_widget">
						<h4>Contact Us</h4>
						<ul class="list-unstyled">
							<li><a href="#">Virtual Visit Tours<br>Northern Ireland</a></li>
							<li><a href="#">info@virtualvisittours.com</a></li>
							<li><a href="#">+ 44 (0) 2895 811 334</a></li>
							<li><a href="#">+ 353 (1) 442 8995</a></li>
						</ul>
					</div>
				</div>
				<div class="col-sm-6 col-md-6 col-lg-3 col-xl-3">
					<div class="footer_social_widget">
						<h4>Follow us</h4>
						<ul class="mb30">
							<li class="list-inline-item"><a href="#"><i class="fa fa-facebook"></i></a></li>
							<li class="list-inline-item"><a href="#"><i class="fa fa-twitter"></i></a></li>
							<li class="list-inline-item"><a href="#"><i class="fa fa-instagram"></i></a></li>
							<li class="list-inline-item"><a href="#"><i class="fa fa-pinterest"></i></a></li>
							<li class="list-inline-item"><a href="#"><i class="fa fa-dribbble"></i></a></li>
							<li class="list-inline-item"><a href="#"><i class="fa fa-google"></i></a></li>
						</ul>
						<h4>Subscribe</h4>
						<form class="footer_mailchimp_form">
						 	<div class="form-row align-items-center">
							    <div class="col-auto">
							    	<input type="email" class="form-control mb-2" id="inlineFormInput" placeholder="Your email">
							    </div>
							    <div class="col-auto">
							    	<button type="submit" class="btn btn-primary mb-2"><i class="fa fa-angle-right"></i></button>
							    </div>
						  	</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</section>

	<!-- Our Footer Bottom Area -->
	<section class="footer_middle_area pt40 pb40">
		<div class="container">
			<div class="row">
				
				<div class="col-lg-6 col-xl-6">
					<div class="copyright-widget text-left">
						<p>© 2022 Virtual Visit Tours. MADE for 360. <a href="terms.php" style="color:#fff;">Terms of Use</a> | <a href="privacy.php" style="color:#fff;">Privacy</a></p>
					</div>
				</div>
			</div>
		</div>
	</section>
<a class="scrollToHome" href="#"><i class="flaticon-arrows"></i></a>
</div>
<!-- Wrapper End -->
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/jquery-migrate-3.0.0.min.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/popper.min.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/jquery.mmenu.all.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/ace-responsive-menu.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/snackbar.min.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/simplebar.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/parallax.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/scrollto.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/jquery-scrolltofixed-min.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/jquery.counterup.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/wow.min.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/progressbar.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/slider.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/pricing-slider.js"></script>
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/timepicker.js"></script>
<!-- Custom script for all pages --> 
<script type="text/javascript" src="<?php echo WEBSITE_URL;?>js/script.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("#alertMessage").hide();
    $("#alertLoginMessage").hide();
    
    var siteurl = $('#siteurl').val();
    
    $("#exampleInputPassword3").on('keyup', function() {
        var password = $("#exampleInputPassword2").val();
        var confirmPassword = $("#exampleInputPassword3").val();
        if (password != confirmPassword)
          $("#CheckPasswordMatch").html("Password does not match !").css("color", "red");
        else
          $("#CheckPasswordMatch").html("Password match!").css("color", "green");
      });
    
    $("#phototgrapherForm").submit(function() {
        var dataString = $(this).serialize();
        $.ajax({
            type: "POST",
            url: "cms/includes/process.php",
            data: dataString,
            success: function(data){
                if(data=="success") {
                    $("#alertMessage").show();
                    $("#alertLoginMessage").hide();
                    $("#alertMessage").html("Thank you! You have registered successfully and will receive a confirmation email from us shortly.");
                } else {
                    $("#alertLoginMessage").show();
                    $("#alertMessage").hide();
					$("#alertLoginMessage").html("Sorry! There is something wrong. Please check login details and try again.");
                }
            }
        });
        return false;
    });
    
    $(".search_option_button").click(function() {
        var keyword = $("#exampleInputName1").val();
        var subject = $("#photosubject").val();
        var country = $("#country").val();
        window.location.replace("https://vvt.theflexstudio.com/search.php?keyword="+keyword+"&subject="+subject+"&country="+country);
    });
    
    $("#loginform").submit(function() {
        var string = $( this ).serialize();//'width='+ width + '&action=registrationform';
		$.ajax({
			type: 'POST',
			url: 'cms/includes/process.php',
			async: true,
			cache: false,
			data: string,
			success: function(data)	{
				dataa = $.trim(data);
				if(dataa=='frontloogedIn') {
					window.location.href = "https://vvt.theflexstudio.com/cms/index.php";
				} else {
				    $("#alertLoginMessage").show();
				    $("#alertMessage").hide();
					$("#alertLoginMessage").html("Sorry! There is something wrong. Please check login details and try again.");
				}
			}
		});
		return false;
        
        
        /*if(username=="photo@theflexstudio.com") {
            return true;
        } else {
            $("#alertLoginMessage").show();
            $("#alertMessage").hide();
            $("#alertLoginMessage").html("Sorry! There is something wrong. Please check login details and try again.");
            return false;
        }*/
    });
});
</script>
</body>
</html>