<?php
	echo "<script language='javascript'>location.href='http://kong.kbs.co.kr/image/download_v3/download.php';</script>";
	exit;

	//echo "<script>alert(\"Äá(KONG)ÀÇ ´Ù¿î·Îµå´Â 10¿ù 24ÀÏ 12:00 ºÎÅÍ °¡´ÉÇÕ´Ï´Ù. ÀØÁö¸»°í ²À! ´Ù¿î·Îµå ¹ÞÀ¸¼¼¿ä!!\");</script>";
	//exit;
	
	/*if(!isset($HTTP_COOKIE_VARS[userid])) {
		echo "<script>alert('·Î±×ÀÎ ÈÄ »ç¿ëÇÏ¼¼¿ä.');</script>";
		echo "<script>location.replace(\"http://www.kbs.co.kr/asx/login/SSOLogon.php?from_url=http://www.kbs.co.kr/radio/kong/\");</script>";
		exit;
	}*/
	
	$filename = 'setup.exe';
	//$file = "http://img.kbs.co.kr/kong/download/".$filename;
	$file = $filename;
	$dnfile = $filename;
	
	if(eregi("(MSIE 5.0|MSIE 5.1|MSIE 5.5|MSIE 6.0)", $HTTP_USER_AGENT)) {
		if(strstr($HTTP_USER_AGENT, "MSIE 5.5")) {
			header("Content-Type: doesn/matter");
			header("Content-disposition: filename=$dnfile");
			header("Content-Transfer-Encoding: binary");
			header("Pragma: no-cache");
			header("Expires: 0");
		}
		
		if(strstr($HTTP_USER_AGENT, "MSIE 5.0")) {
			Header("Content-type: file/unknown");
			header("Content-Disposition: attachment; filename=$dnfile");
			Header("Content-Description: PHP3 Generated Data");
			header("Pragma: no-cache");
			header("Expires: 0");
		}
		
		if(strstr($HTTP_USER_AGENT, "MSIE 5.1")) { 
			Header("Content-type: file/unknown");
			header("Content-Disposition: attachment; filename=$dnfile");
			Header("Content-Description: PHP3 Generated Data");
			header("Pragma: no-cache");
			header("Expires: 0");
		}
		
		if(strstr($HTTP_USER_AGENT, "MSIE 6.0")) {
			Header("Content-type: application/x-msdownload");
			Header("Content-Length: ".(string)(filesize("$file")));
			Header("Content-Disposition: attachment; filename=$dnfile");
			Header("Content-Transfer-Encoding: binary");
			Header("Pragma: no-cache");
			Header("Expires: 0");
		}
	}
	else {
		Header("Content-type: file/unknown");
		Header("Content-Length: ".(string)(filesize("$file")));
		Header("Content-Disposition: attachment; filename=$dnfile");
		Header("Content-Description: PHP3 Generated Data");
		Header("Pragma: no-cache");
		Header("Expires: 0");
	}
	
	if (is_file("$file"))	{
		$fp = fopen("$file", "rb");
		
		if (!fpassthru($fp)) {
			fclose($fp);			
		}
		
		$user_id = $HTTP_COOKIE_VARS[userid];
		include "log/download_log_writer.php";
	}
	else {
		echo "ÇØ´ç ÆÄÀÏÀÌ³ª °æ·Î°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
		return;
	}
?>