<?php require('includes/cmain.inc.php'); ?> 
<?php
$qs1=explode("/",$_SERVER["REQUEST_URI"]);

$countryName=str_replace('-',' ',$qs1[1]);
//echo "<pre>"; print_r($countryName); echo "</pre>";exit();
$banner_match = ucwords(stripslashes($countryName));
$stateName=str_replace('-',' ',$qs1[2]);	 
$location_replace = ucwords(stripslashes($stateName));
$a=SITE_WS_PATH .'/'.$qs1[1].'/'.$qs1[2];

if($location_replace=='Tags'){
   // print_r($location_replace);exit();
    include('blog_tags.php');
}
//start of knowledge-base/ -->
if($countryName=='knowledge base'){
$url = explode('/', rtrim($_SERVER["REQUEST_URI"],"/")); 
$count=count($url);
$menu = $url[$count-1]; 
$menuedit=str_replace('-',' ',$menu);
$menuurl = ucwords(stripslashes($menuedit));

$sqlCat="Select catP_Name from tbl_blogcatp where status='1'";
$sqlCatExec=db_query($sqlCat);
while($blogcatresult=mysqli_fetch_array($sqlCatExec)){
$blogcategory[]=$blogcatresult['catP_Name'];
}
if(in_array($menuurl,$blogcategory)){ include('prototyping.php');exit;}
elseif(!isset($blogcategory['catP_Name']) || $menuurl != $blogcategory['catP_Name']){ include('kb_details.php');exit;}
}


$sql_st = db_query("select state_id,`state_name`, `state_short_name` from tbl_state where `state_name` LIKE '".$location_replace."' and state_status=1 ");
$st_data = mysqli_fetch_assoc($sql_st);
$state_id=$st_data['state_id'] ?? '';
//print_r($state_id);exit();
//print_r("select * from tbl_statecounty where `state` LIKE '%$state_id%' and child_name LIKE '%$countryName%' and county='0' and country_status='1'");exit();

$sqls1=db_query("select * from tbl_statecounty where `state` LIKE '%$state_id%' and child_name LIKE '%$countryName%' and county='0' and country_status='1'");	
$ress1=mysqli_fetch_array($sqls1);
//print_r($ress1);exit();

$sqls=db_query("select * from tbl_country where `country_url` LIKE '".$countryName."' and country_status='1'");	
$ress=mysqli_fetch_array($sqls);
if((mysqli_num_rows($sql_st) !=NULL) &&  (mysqli_num_rows($sqls) !=NULL)) {
	$meta_title = str_replace("LOCATION_REPLACE", $location_replace.', '.$st_data['state_short_name'], $ress['title']);
//	print_r($meta_title);exit();
	$meta_description =str_replace("LOCATION_REPLACE",$location_replace.', '.$st_data['state_short_name'],$ress['description']);
	$meta_keyword = str_replace("LOCATION_REPLACE",$location_replace.', '.$st_data['state_short_name'],$ress['keyword']);
	$meta_url=$a;
} 
elseif((mysqli_num_rows($sql_st) !=NULL) &&  (mysqli_num_rows($sqls1) !=NULL)){	
$meta_title = str_replace("LOCATION_REPLACE", $location_replace.', '.$st_data['state_short_name'], $ress1['title']);
$meta_description =str_replace("LOCATION_REPLACE",$location_replace.', '.$st_data['state_short_name'],$ress1['description']);
$meta_keyword = str_replace("LOCATION_REPLACE",$location_replace.', '.$st_data['state_short_name'],$ress1['keyword']);
$meta_url=$a;
} 
else {
//	include('tMt.php');	exit;
include('404page.php');exit;
}
?>


<?php
 include('header.php');

include('index_banner.php'); ?>
<!-- Service section -->
<? //include('index_img_links.php'); ?>
<!-- Welcome sec -->
<div class="welcome-sec">
<div class="container cf">

<div class="welcome-img">
<?//include('right_menu_state.php'); ?>
</div>

<!--<h1></h1> --><? /*if($ress['country_title'])
{ 
echo str_replace("LOCATION_REPLACE", $location_replace, stripslashes($ress['country_title'])); 
}
else
{ 
echo ucwords(stripslashes($countryName.' in '.$stateName));  
}*/					 
?>
<div>
<ul class="breadcrumb">
		<li><a href="<?php echo SITE_WS_PATH; ?>">Home</a></li> 
		<li><a href="<?php echo SITE_WS_PATH.'/'.$segments[1]; ?>"><?php echo ucwords(str_replace('-',' ',$segments[1])); ?></a></li>
		<li><?php echo ucwords(str_replace('-',' ',$segments[2])); ?></li>
	</ul>
</div>
<p>
<?php  
if((mysqli_num_rows($sql_st) !=NULL) &&  (mysqli_num_rows($sqls1) !=NULL)) 
{
$res_desc = mysqli_fetch_assoc(db_query("select * from tbl_statecounty where `state` LIKE '%$state_id%' and child_name LIKE '%$countryName%' and county='0' and country_status='1'"));
//$res_desc = mysqli_fetch_assoc(db_query("select country_descriptions from tbl_country where `country_url` LIKE '".$countryName."' and country_status='1'"));
$location_replace = '<b>'.ucwords(stripslashes($stateName)).'</b> ';
//LOCATION_REPLACE							 
$desc = stripslashes($res_desc['country_descriptions']);
echo str_replace("LOCATION_REPLACE", $location_replace,$desc);
} 
elseif((mysqli_num_rows($sql_st) !=NULL) &&  (mysqli_num_rows($sqls) !=NULL)){
$res_desc = mysqli_fetch_assoc(db_query("select country_descriptions from tbl_country where `country_url` LIKE '".$countryName."' and country_status='1'"));
$location_replace = '<b>'.ucwords(stripslashes($stateName)).'</b> ';
//LOCATION_REPLACE							 
$desc = stripslashes($res_desc['country_descriptions']);
echo str_replace("LOCATION_REPLACE", $location_replace,$desc);
}
?>
</p>

<?/*  $location_replace = '<b>'.ucwords(stripslashes($countryName)).'</b> ';
$desc = stripslashes($ress['country_descriptions']);
echo str_replace("LOCATION_REPLACE", $location_replace, $desc);

*/?> 


</div>
</div>
</main>
</div>
</div>
<?php include('footer.php'); ?>
