<?php
header("Expires: Sat, 05 Nov 2005 00:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

if(file_exists("listen/streamconfig.php")) { include("listen/streamconfig.php"); }
else { die("<small><em>Streamstatus-Einstellungen sind (noch) nicht gesetzt</em></small>"); }

if(IsSet($_GET['id']) && $_GET['id']>0 && $_GET['id']<4 && IsSet($_GET['player'])) {
	// Realplayer
	if($_GET['player']=='realplayer') {
		header('Content-type: application/octetstream');
		header('Content-Disposition: attachment; filename="listen.ram"');
		//header("Content-Type: application/force-download");
		echo "http://".$sc_server[$_GET['id']].":".$sc_port[$_GET['id']]."/listen.pls".($sc_id[$_GET['id']]>0 ? "?sid=".$sc_id[$_GET['id']] : "")."\r\n";
	}

	// Mediaplayer
	elseif($_GET['player']=='mediaplayer') {
		header('Content-type: application/octetstream');
		header('Content-Disposition: attachment; filename="listen.asx"');
		header('Content-Type: application/force-download');
		echo "<Asx Version = \"3.0\" >\r\n<Entry>\r\n<Ref href = \"http://".$sc_server[$_GET['id']].":".$sc_port[$_GET['id']]."/".($sc_id[$_GET['id']]>0 ? "?sid=".$sc_id[$_GET['id']] : "")."\" />\r\n</Entry>\r\n</Asx>\r\n";
	}

	// Winamp
	elseif($_GET['player']=='winamp') {
		header('Content-type: application/octetstream');
		header('Content-Disposition: attachment; filename="listen.pls"');
		//header("Content-Type: application/force-download");
		echo "[playlist]\r\nNumberOfEntries=1\r\nFile1=http://".$sc_server[$_GET['id']].":".$sc_port[$_GET['id']]."/listen.pls".($sc_id[$_GET['id']]>0 ? "?sid=".$sc_id[$_GET['id']] : "")."\r\n[/playlist]\r\n";

	}
	else {
		header("Content-type: text/html");
		echo "Ung&uuml;ltiger Parameter.";
	}
}

else {
	header("Content-type: text/html");
	echo "Ung&uuml;ltiger Parameter.";
}
?>