<?php
$file = file_get_contents('whazzup.txt');
preg_match('#\!CLIENTS(.*)\!SERVERS#usU', $file, $matches);
$res = explode(PHP_EOL, $matches[1]);
$output = '';
foreach($res as $str){
if(strlen($str)>0){
$temp = explode(':', $str);
$output .= "['".$temp[0]."',".$temp[5].",".$temp[6]."],";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Online maps</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var beaches = [
<?php echo $output; ?>
];
function initialize() {
var mapOptions = {
zoom: 3,
center: new google.maps.LatLng(32.4942768,19.0286076)
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
setMarkers(map, beaches);
}
function setMarkers(map, locations) {
var image = {
url: '1.png',
size: new google.maps.Size(32, 32),
origin: new google.maps.Point(0,0),
anchor: new google.maps.Point(0, 32)
};
var shape = {
coord: [1, 1, 1, 20, 18, 20, 18 , 1],
type: 'poly'
};
for (var i = 0; i < locations.length; i++) {
var beach = locations[i];
var myLatLng = new google.maps.LatLng(beach[1], beach[2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image,
shape: shape,
title: beach[0],
zIndex: 500//beaches[3]
});
}
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>