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

if (isset($_GET['ID']))
{
  $ID = $_GET["ID"];

  $query = "SELECT image FROM markers WHERE ID = $ID LIMIT 1";
  $result = mysql_query($query, $db);
  if ($result)
    {
      if ($r = mysql_fetch_array($result))
	{
	  $image = $r['image'];
	  if ($image != '')
	  {
	    unlink("$DOCUMENT_ROOT/tick/images/gallery/${image}");
	    unlink("$DOCUMENT_ROOT/tick/images/gallery/t_${image}");
	  }
	}
      mysql_free_result($result);
    }

  $query = "DELETE FROM markers WHERE ID = $ID LIMIT 1";
  $result = mysql_query($query, $db);
}

header("Location: /tick/markers.php");

?>
