<?php
	header("Content-type: application/xml");
	define("BASEPATH","thisisset");
	$base_url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
	$base_url .= "://".$_SERVER['HTTP_HOST']."/";
	//$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
	echo "<?";
?>xml version="1.0" encoding="UTF-8"?>
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
  <loc><?php echo $base_url; ?></loc>
</url>
<?php
	include("./application/config/database.php");
	$dbc = new mysqli($db[$active_group]["hostname"],$db[$active_group]["username"],$db[$active_group]["password"],$db[$active_group]["database"]);
	$result = $dbc->query("SELECT * FROM entries WHERE status = 'published' AND slug IS NOT NULL");
	while (@$row = $result->fetch_assoc()): ?>
<url>
  <loc><?php echo $base_url.$row['slug']; ?></loc>
</url>
<?php endwhile; ?>
</urlset>