<?require ("global.php");?>
<?php

$ID = 0;
if (isset($_POST['ID'])) { $ID = $_POST['ID']; }

$stageID = 0;
if (isset($_POST['stageID'])) { $stageID = $_POST['stageID']; }

if ($ID != 0)
{
    $query = "UPDATE maps SET "
	. "zoom = '" . $_POST['zoom'] . "', "
	. "map_type = '" . $_POST['map_type'] . "', "
	. "center_lat = '" . $_POST['center_lat'] . "', "
	. "center_lon = '" . $_POST['center_lon'] . "' "
	. "WHERE ID = '$ID'";
    $result = mysql_query($query, $db);
}
else
{
    $query = "INSERT INTO maps (stageID, zoom, map_type, center_lat, center_lon) VALUES (" 
	. "'" . $stageID . "',"
	. "'" . $_POST['zoom'] . "',"
	. "'" . $_POST['map_type'] . "',"
	. "'" . $_POST['center_lat'] . "'," 
	. "'" . $_POST['center_lon'] . "')";
    $result = mysql_query($query, $db);
}

staticify($stageID);
header("Location: /tick/stages.php");

?>
