<?php
@set_time_limit(0);
error_reporting(0);
header('Content-Type: text/xml; charset=utf-8');

include 'fun.php';
include 'zcypz.php';
$http_type = isset($_GET['type']) ? ($_GET['type'].'://') : 'http://';
$host = isset($_GET['host']) ? $_GET['host'] : '';	
$host = rtrim($host, '/');
if(empty($host)){
  exit;
}
if($total_keyword == 0 || $total_link == 0){
	exit;
}
$host_domain = $http_type.$host;

$XML_page_Num = ceil($total_link / $xmlNum);

$sitemap = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"></sitemapindex>');
for ($i = 1; $i <= $XML_page_Num; $i++) {
    $url = $sitemap->addChild('sitemap');
    $url->addChild('loc', htmlspecialchars($host_domain."/sitemap".$i.".xml"));
} 
$dom = dom_import_simplexml($sitemap)->ownerDocument;
$dom->formatOutput = true;
echo $dom->saveXML();
?>