<?php

header('Content-type: application/xml');
date_default_timezone_set('Europe/London');

include "accommodation-code/connect.php";

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">
	<url>
		<loc>http://www.bedposts.org.uk/</loc>
		<priority>0.9</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/about/about.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/about/association.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/about/community.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/about/advertise.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/about/sponsor.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/about/contact.htm</loc>
		<priority>0.3</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/overview.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/history.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/organisation.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/benefits.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/reviews-scheme.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/news.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/conference-programme.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/conference-programme-2013.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/conference-programme-2012.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/breakaway.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/breakaway-2013.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/breakaway-2012.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/newsletter4.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/newsletter3.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/newsletter2.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/club/newsletter1.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/marketing/overview.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/marketing/advertise.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/marketing/badge.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/marketing/book-direct-and-save.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/marketing/home-swaps.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/marketing/business-sitters.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/marketing/customer-reviews-scheme.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/marketing/conference.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/marketing/featured-accommodation.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/marketing/photo-competition.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/services/services.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/services/website-design.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/services/photography.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/services/booking-system.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/services/credit-cards.htm</loc>
		<priority>0.5</priority>
	</url>
	<url>
		<loc>http://www.bedposts.org.uk/discounts/discounts.htm</loc>
		<priority>0.5</priority>
	</url>";
	
	$query = "SELECT * FROM a1_towns2 WHERE type = 'city' AND list = 'y' ORDER BY town ASC";
	$result = mysql_query($query);
	while ($row = mysql_fetch_array($result)){
		
		$pageURL = $row['pageURL'];
		
		echo "<url>
				<loc>http://www.bedposts.org.uk/accommodation/$pageURL</loc>
				<priority>0.9</priority>
			</url>";
	}
	
	$query = "SELECT * FROM a1_towns2 WHERE type = 'town' AND list = 'y' ORDER BY town ASC";
	$result = mysql_query($query);
	while ($row = mysql_fetch_array($result)){
		
		$pageURL = $row['pageURL'];
		
		echo "<url>
				<loc>http://www.bedposts.org.uk/accommodation/$pageURL</loc>
				<priority>0.8</priority>
			</url>";
	}
	
	$query = "SELECT * FROM a1_towns2 WHERE type = 'village' AND list = 'y' ORDER BY town ASC";
	$result = mysql_query($query);
	while ($row = mysql_fetch_array($result)){
		
		$pageURL = $row['pageURL'];
		
		echo "<url>
				<loc>http://www.bedposts.org.uk/accommodation/$pageURL</loc>
				<priority>0.7</priority>
			</url>";
	}

	$query = "SELECT * FROM a1_accounts WHERE formsComplete = 'y' AND active = 'y' ORDER BY town ASC";
	$result = mysql_query($query);
	while ($row = mysql_fetch_array($result)){
		
		$advert = $row['advert'];
		$estCategory = $row['category'];
			if ($estCategory == "hotel" OR $estCategory == "countryhouse" OR $estCategory == "inn" OR $estCategory == "Restaurant with Rooms" OR $estCategory == "hostel"){$urlCategory = "hotel";}
			elseif ($estCategory == "guesthouse"){$urlCategory = "guesthouse";}
			elseif ($estCategory == "bedbreakfast" OR $estCategory == "self_bandb" OR $estCategory == "farmhouse"){$urlCategory = "bed-and-breakfast";}
			elseif ($estCategory == "self" OR $estCategory == "apartments"){$urlCategory = "self-catering";}
		
		echo "<url>
				<loc>http://www.bedposts.org.uk/$urlCategory/$advert</loc>
				<priority>0.6</priority>
			</url>";
	}

	echo "</urlset>";


?>
