<?php
include_once "../../../tools/inc.php";
include "../../common.php";
$table='ipcountry'.$config["table_prefix"];
$table_s='subscribers'.$config["table_prefix"];

header('Content-type: text/xml');
$page = new Template("templates/statistics/charts/ammap/data.tpl");
$page->dictionary("common/dict.ru");
$sql="select ip.code, ip.name, count(ip.code) as count from $table_s s, $table ip where
	s.ip>=ip.from_ip and
	s.ip<=ip.to_ip
group by ip.code";
$rs=$db->execute($sql);
while ($row=$db->get_row($rs)) {
	$page->addrow('AREA', $row);
}
print $page->evaluate();
$db->close();
exit;
?>