<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";

require_once INCLUDES."countries.php";

if (file_exists(INFUSIONS."member_location_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."member_location_panel/locale/".$settings['locale'].".php";
} else { include INFUSIONS."member_location_panel/locale/English.php"; }

opentable($locale['MLP_000']);

$result = dbquery("SELECT COUNT(user_id) as total, user_location FROM ".$db_prefix."users
	WHERE user_location != '' GROUP BY user_location ORDER BY total DESC, user_location"
);
if (dbrows($result) != 0) {
	echo "<table cellpadding='0' cellspacing='1' align='center' class='tbl-border'>\n";
	while($data = dbarray($result)) {
		if (isset($ft_csm['countries'][$data['user_location']])) {
			$mlp_country = csm_getCountry($data['user_location']);
			echo "<tr>
<td class='tbl2'><a href='".BASEDIR."members.php?sortby=location&amp;country=".$data['user_location']."' title='$mlp_country'>".csm_getFlag($data['user_location'])." $mlp_country</a></td>
<td align='center' class='tbl2' style='white-space:nowrap'><b>".$data['total']."</b></td>
</tr>\n";
		}
	}
	echo "</table>\n";
} else { echo "<center>".$locale['MLP_001']."</center>"; }

closetable();

require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>