Mologogo altURL sample code pack v0.0.6

*********************** WARNING ***********************
NOTE: If you update to this code from an older version 
of this code package and you start getting funky errors,
you may need to DROP the old table you were using and 
let this code re-create if for you. See drop.php for
details.
*******************************************************

Original code by Gabriel at sff1 d0t com, and other
unknown contributors at the Mologogo Wiki.

Package, and all features added since then have been
added by djv at exis d0t net

Files included in this package:

  molo_config.php
    Contains all the database info, and other
    variables that are used by multiple parts of
    the package. You MUST edit this file.

  alturl_CHANGE_THIS_FILE_NAME.php
    Script that adds rows to the database when
    hit by the mologogo client's altURL setting.

  minimap.php
    This code creates a simple, non-draggable map with no
    navigation tools and a single point for your most recent
    waypoint. This page is intended to be inserted as a small
    iframe in another document (think: blog sidebar, myspace,
    facebook, etc), or as a small self-refreshing pop-up
    window for tracking. It uses very small (16x16) triangles
    for pinpoints.

  bigmap.php
    This code writes the latest GPS point to a marker
    in a Google map with simple navigation tools and
    keyboard interaction, and maps the number of
    points defined in molo_config.php to a polyline.
    This file is intended to be placed in a medium to
    large iframe on a page dedicated to tracking, or
    as a large (720x480 or so) self-refreshing popup.

  spreadsheet.php
    This code writes all saved points for all users to
    a table. There is no formatting applied here, so
    it's pretty darn ugly. Feel free to edit away at
    this file to make it fit your needs, it's simply
    intended as a sample implementation of how to
    jam the data into a spreadsheet style format.

  allmaps.php
    Shared code for minimap and bigmap. Don't mess
    with this unless you're a developer.

  navmap.php and simplemap.php
    Legacy files that just redirect to bigmap and minimap,
    respectively. These are only here for people who
    installed a version of this package prior to 0.0.5,
    and are too lazy to change their web page. If you
    are performing a fresh install for the first time,
    or if you are not too lazy to make the changes,
    you can skip these files. You will want to start
    using minimap and bigmap soon, as these files
    may go away in future releases.

What do do with these files:

  * (OPTIONAL) Create a new MySQL database. If your
    site already has an existing MySQL databse, you
    can just use the information for that database in
    the next step. Just be SURE the name you chose for
    your table in molo_config.php in the next step does
    NOT step on an existing table's name. The default
    table name (molo_points) should be fairly safe.

  * Edit molo_config.php to reflect your database login
    info, table name (no need to create it, the code in
    this package will do that for you), your google maps
    key, the number of points you wish to save, your
    Mologogo nickname, your preferred style of distance
    units, zoom levels, map types, and auto-refreshing.

  * CHANGE THE NAME OF alturl_CHANGE_THIS_FILE_NAME.php!
    Make it something you can enter into mologogo, and
    make sure you keep it private. If this file name gets
    out, people can potentially screw with your tracking
    data. One day, there might be some kind of security
    added here. Today is not that day, and it's not going
    to happen any time Real Soon Now. For now, you will
    have to make do with "security by obscurity". Sorry.

  * Set your Mologogo client's "alturl" setting to the URL
    of the file you just renamed in the last step, followed
    by a question mark. For instance, if you've renamed the
    file "squorntz.php" and placed it in the root of your 
    server at www.example.com, your setting should look 
    like...

    http://www.example.com/squorntz.php?

    Note that question mark at the end. It's very important!

  * If you want to have multiple users, you'll need to add
    a little more to that URL. Add "name=YOURNAMEHERE&" to
    it. So, if your name is BobDylan, that line will now
    look like...

    http://www.example.com/squorntz.php?name=BobDylan&

    Note that this time, there's an ampersand (&) at the
    end. Again, that's really important. Each user of the
    database should have a unique name, and the names
    must be all alphanumeric; No punctuation, no spaces.
    Pin and track colors are assigned in the PHP code,
    you can not set them for a particular user. Codes are
    assigned to users in ASCIIbetical order (0-9,A-Z,a-z)
    in the order Red, Orange, Yellow, Green, Blue, Violet,
    Gray, White, Black, Brown. Yes, I shuffled the order 
    since last time. It looks better this way.

  * Use the files in your web page. I suggest adding them
    in <iframe> tags, so slowdowns from loading the map
    do not effect loading speeds for the rest of your page,
    and so that you don't have issues with variables
    stepping on eachother as you might have with dropping
    the code into an existing PHP file. 

    For instance, I used the following code to add a small
    copy of minimap.php to my blog's side-bar, with a link
    below it that spawns a pop-up window with bigmap.php. To
    use this code on your site, replace "WWW.YOURSITE.COM"
    with the path to the files on your web site. You can
    see this code in action at http://www.pwn3d.us/

<iframe src="/minimap.php" frameborder="0" height="120" width="160" marginwidth="0" scrolling="no"></iframe><br />
<A HREF="javascript:void(0);" onclick="window.open('http://WWW.YOURSITE.COM/bigmap.php','_blank','height=480,width=720,location=0,menubar=0,scrollbars=0,resizable=1,status=0,toolbar=0')">View Details</A><br />
Powered by <a href="http://www.mologogo.com" target="_blank">Mologogo</a>

  * If you want a map to only show the track for a particular
    user, add "?only=THEUSERNAME" to the URL for the map. Of
    course, replace THEUSERNAME with the user name you want
    to limit the map to. So, for instance, to show only the
    track for BobDylan on that server at www.example.com,
    you would call the map with this URL...

    http://www.example.com/bigmap.php?only=BobDylan

    This works for both the minimap and bigmap.

What else can you do with these files?

  * Anything you darn well please. There are no restrictions
    on the use of this code, you can feel free to copy,
    modify, use, and distribute this code for free. 

  * If you use this code in a bigger project, I'd like
    to know about it. It gives me the warm fuzzies. My
    e-mail address is djv at exis d0t net.