<?php
/* 
	POMM  v1.3
	Player Online Map for MangOs

	Show online players position on map. Update without refresh.
	Show tooltip with location, race, class and level of player.
	Show realm status.

	16.09.2006		http://pomm.da.ru/
	
	Created by mirage666 (c) (mailto:mirage666@pisem.net icq# 152263154)
*/

require_once "pomm_conf.php";
require_once "JsHttpRequest/Php.php";
$JsHttpRequest =& new Subsys_JsHttpRequest_Php("windows-1251");
	$i=0;
 	$mangos_db = new DBLayer($host, $user, $password, $db);
	$mangos_db->query("SET NAMES $database_encoding");
	$query = $mangos_db->query("SELECT * FROM `character` WHERE `online`='1' ORDER BY `name`");
	while($result = $mangos_db->fetch_assoc($query))
	{
	$char_data = explode(' ',$result['data']);
	$char_gender = dechex($char_data[36]);
	$char_gender = str_pad($char_gender,8, 0, STR_PAD_LEFT);
	$pos = get_player_position($result['position_x'],$result['position_y'],$result['map']); 
 	$arr[$i]['x'] = $pos['x'];
	$arr[$i]['y'] = $pos['y'];
	$arr[$i]['name']=$result['name'];
	$arr[$i]['zone']=get_zone_name($result['map'], $result['position_x'], $result['position_y']);
	$arr[$i]['cl'] = $result['class'];
	$arr[$i]['race'] = $result['race'];
	$arr[$i]['level']=$char_data[34];
	$arr[$i]['gender'] = $char_gender{3};
	$i++;
 	}
	$mangos_db->close();
	unset($mangos_db);
$_RESULT =$arr; 
?>