<?php

include ("includes/mysql.php");

$Type = ($_GET['t']);

if ($Type == 1)
{
	$sql_command = "SELECT BestandsNaam FROM mod_FileUpload WHERE Publiceren = 1 AND Type = 'menu' ORDER BY id DESC LIMIT 0,1 ";
}
if ($Type == 2)
{
	$sql_command = "SELECT BestandsNaam FROM mod_FileUpload WHERE Publiceren = 1 AND Type = 'drank' ORDER BY id DESC LIMIT 0,1 ";
}

if ($Type == 3)
{
	$sql_command = "SELECT BestandsNaam FROM mod_FileUpload WHERE Publiceren = 1 AND Type = 'dessert' ORDER BY id DESC LIMIT 0,1 "; 
}

if ($Type == 4)
{
	$sql_command = "SELECT BestandsNaam FROM mod_FileUpload WHERE Publiceren = 1 AND Type = 'specials' ORDER BY id DESC LIMIT 0,1 ";
}
	
	$sql_result = (mysql_query($sql_command)) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());

	while ($row=mysql_fetch_array($sql_result)) 
		{
		$tmp = $row['0'];
		}
	header("Location: http://www.hetkompas.be/CMS/menus/".$tmp."");


?>
