<?

session_start();

header( 'Content-type: text/html; charset=windows-1251' );

if ( $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' ) exit();
if ( !isset( $_SESSION['iduser'] ) ) exit();

define( 'ROOT', 'http://'.$_SERVER['HTTP_HOST'] );
define( 'ROOT_DIR', $_SERVER['DOCUMENT_ROOT'] );

include_once ROOT_DIR . '/engine/config.php';

?>

<table class="cuserstat">
<?
$groupCity = mysql_query( "SELECT city_code, country, COUNT(id) as count FROM user WHERE city_code != '' GROUP BY city_code ORDER BY country" );
while ( $groupCityRow = mysql_fetch_array( $groupCity ) ) {
    ?>
    <tr>
        <td style="width: 30px; text-align: center;"><img src="<?=ROOT?>/theme/images/flags/<?=$groupCityRow['city_code']?>.png" width="16" height="11" /></td>
        <td><?=$groupCityRow['country']?></td>
        <td style="width: 50px; text-align: center;"><?=$groupCityRow['count']?></td>
    </tr>
    <?
}
?>
</table>