<?
//header ("Content-Type: text/xml");

$url = strtolower('http://market-1c.ru/');

$file = $_SERVER["DOCUMENT_ROOT"].'/inc/struct.txt';
$temp = file ($file);
for ($j=1;$j<sizeof($temp);$j++)
{
	$struct[$j-1] = explode(';',$temp[$j]);
}

echo '<?xml version="1.0" encoding="UTF-8"?>
<urlset 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"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
';

for ($j=0;$j<sizeof($struct);$j++)
if (!($struct[$j][5]==0)) 
{
  if (empty($struct[$j][3]))
	{
	  echo  '<url>
<loc>'.$url.'?id='.$struct[$j][0].'</loc>
</url>
';
	} 
	else
	{
	  echo  '<url>
<loc>'.$url.$struct[$j][3].'</loc>
</url>
';
	}
}

echo '</urlset>';

?>
