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

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

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

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

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

?>
