<?
$code 
$_GET["code"];
$name $_GET["name"];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>MBCanada.com - Member Map</title>
 
<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAA2dla9QbvIh6iRlj6BqLKLRS6xWytvu1jpGp9JTu19LCb9SdttxTjV47b4b1lRlh3MeZNcXyKJGTEJw" type="text/javascript"></script>

</head>

<body>
<a href="http://www.mbcanada.com/"><img border='0' src="./mbc_img/mbc.gif"></a>


<div id="map" style="width: 650px; height: 500px; float: left; padding: 10px; border: 1px solid #666699; margin-right: 10px;"></div>

<script type="text/javascript">
//<![CDATA[

var map = new GMap(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());

<?

if ($code == 200) {
    
$link mysql_connect("dbserver.com""user""pass") or die("Could not connect: " mysql_error());
    
mysql_selectdb("mbcanada",$link) or die ("Can\'t use dbmapserver : " mysql_error());
        
$query "SELECT name, latitude, longtitude from points where name='$name'";
    
$result mysql_query($query) or die("query failed " mysql_error());
    while(
$row mysql_fetch_array($result)) {
    echo 
"map.centerAndZoom(new GPoint(" $row[2] . ", " $row[1] . "), 10);\n";
    }
} else {
    echo 
"map.centerAndZoom(new GPoint(-101.074219, 54.059388), 14);\n";
}

?>

// Creates a marker whose info window displays the given number
function createMarker(point, number)
{
var marker = new GMarker(point);
// Show this markers index in the info window when it is clicked
var html = number;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
return marker;
};

<?php
$link 
mysql_connect("dbserver.com""user""pass") or die("Could not connect: " mysql_error());
mysql_selectdb("mbcanada",$link) or die ("Can\'t use dbmapserver : " mysql_error());

$result mysql_query("SELECT * FROM points",$link);
if (!
$result)
{
echo 
"no results ";
}
while(
$row mysql_fetch_array($result))
{
echo 
"var point = new GPoint(" $row[2] . "," $row[1] . ");\n";
echo 
"var marker = createMarker(point, '" $row[3] . "');\n";
echo 
"map.addOverlay(marker);\n";
echo 
"\n";
}

mysql_close($link);
?>

//]]>
</script>

            

<div id="controls" style="width: 222px; height: 500px; float: left; padding: 10px; border: 1px solid #666699;">
<font style="font-weight: bold; font-family: arial;">Member Map</font>
<p>
<font style="font-weight: bold; font-family: arial; font-size: 10px;">Where the heck is everybody?! Add yourself to our map
using your postal code and see where your MBCanada.com neighbours are.
<p>
<form action="handler.php" method="GET">
Username: <input type="text" size="20" name="name"><br>
Postal code:
<input type="text" size="4" name="pc1">
<input type="text" size="4" name="pc2"><br><br>
<input type="submit" value="Submit">
</form>
</font>
<p>
<font style="font-weight: bold; font-family: arial;">News/Updates</font>
<p>
<font style="font-weight: bold; font-family: arial; font-size: 10px;">This is a total ALPHA job. No warranty is expressed or implied. Some upcoming enhancments:
<br>
- US Zip codes<br>
- Other country postals<br>
- more info in info boxes, other than name (avatar pic, custom message, etc)<br>
- cosmetic improvements<br>
- code optimization for speed<br>
</font>



</div>

<div id="mice" style="position: absolute; left: 10px; top: 610px;">
<font style="font-weight: bold; font-family: arial; font-size: 10px;">Powered by:     <a href='http://maps.google.com'>Google Maps</a>     |     <a href='http://www.geocoder.ca'>Geocoder.ca</a>     |     <a href='http://www.networkscience.com'>NetworkScience</a>
</div>

</body>

</html>