// 3/17/09, 8/26/08  --
                $result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
                dump($query);
                unset($result);
            }
            // end if (count())
        }
        // end for ()
    }
    // end if (count())
    //		}		// end while
}
// end function do_instam()
$instam_key = get_variable("instam_key");
if (!empty($instam_key)) {
    do_my_instam($instam_key);
}
?>
<!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>
	<META NAME="ROBOTS" CONTENT="INDEX,FOLLOW">
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
	<META HTTP-EQUIV="Expires" CONTENT="0">
	<META HTTP-EQUIV="Cache-Control" CONTENT="NO-CACHE">
	<META HTTP-EQUIV="Pragma" CONTENT="NO-CACHE">
	<META HTTP-EQUIV="Content-Script-Type"	CONTENT="text/javascript">
	<TITLE>Tickets <?php 
print get_variable('_version');
?>
</TITLE>
            if (count($the_position) == 8) {
                //
                list($device, $user, $when, $lat, $lng, $course, $speed, $altitude) = $the_position;
                //						0		1		2	3		4		5		6		7
                $updated = mysql_format_date($when);
                $query = "UPDATE `{$GLOBALS['mysql_prefix']}responder` SET \n\t\t\t\t\t`lat`= '{$lat}' ,\n\t\t\t\t\t`lng`= '{$lng}',\n\t\t\t\t\t`updated` = '{$updated}',\n\t\t\t\t\t`user_id` = 0\n\t\t\t\t\tWHERE (`instam` = 1 \n\t\t\t\t\tAND  (`lat` != '{$lat}' OR `lng` != '{$lng}'  ) \n\t\t\t\t\tAND  `callsign` = '{$device}')";
                // 7/25/09
                $result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
                if (mysql_affected_rows() > 0) {
                    // if any movement
                    //					snap(__LINE__, mysql_affected_rows($result));
                    $query = "DELETE FROM `{$GLOBALS['mysql_prefix']}tracks_hh` WHERE `source`= " . quote_smart(trim($user));
                    // remove prior track this device  3/20/09
                    $result = mysql_query($query);
                    // 7/28/10
                    //
                    $query = sprintf("INSERT INTO `{$GLOBALS['mysql_prefix']}tracks_hh`(`source`,`utc_stamp`,`latitude`,`longitude`,`course`,`speed`,`altitude`,`updated`,`from`)\n\t\t\t\t\t\t\t\t\t\tVALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)", quote_smart($user), quote_smart($when), quote_smart($lat), quote_smart($lng), quote_smart($altitude), round($speed), quote_smart($course), quote_smart(mysql_format_date($when)), quote_smart($speed));
                    $result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
                    unset($result);
                }
                // end if (mysql_affected_rows>0)
            }
            // end if (count())
        }
        // end for ()
    }
    // end if (count())
}
// end function do_instam()
do_my_instam("7746755003372629669");