<?
    $pds_no 
$HTTP_GET_VARS['pds_no'];
    
    
// 기본 설정 파일, 함수 파일 인쿨르드    
    
require_once "/www/web_2007/include/common.php";
    require_once 
$setup[dir_path] . "/include/function.php";
    require_once 
$setup[dir_path] . "/include/dbset_news.php";

    
// 파일 정보 가져오기
    
$query_news "select no, news_id, title, pds_date, ori_filename, save_filename, extension from news_pds where no = '$pds_no'";
    
$stmt_news ociparse($db_news$query_news);
    
ociexecute($stmt_news);
    
ocifetchinto($stmt_news, &$dataOCI_ASSOC);

    
$filename $data[ORI_FILENAME].".".$data[EXTENSION];
    
$filepath $setup[dir_pds]."/".substr($data[NEWS_ID], 04)."/".$data[SAVE_FILENAME].".".$data[EXTENSION];

    
$dn "1"// 1 이면 다운 0 이면 브라우져가 인식하면 화면에 출력 
    
$dn_yn = ($dn) ? "attachment" "inline"
    
$bin_txt "1";
    
$bin_txt = ($bin_txt) ? "r" "rb"

    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-Length: ".(string)(filesize("$filepath"))); 
            
Header("Content-Disposition: filename=$filename"); 
            
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=$filename"); 
            
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=$filename"); 
            
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("$filepath"))); // 이부부을 넣어 주어야지 다운로드 진행 상태가 표시
            
Header("Content-Disposition: attachment; filename=$filename"); 
            
Header("Content-Transfer-Encoding: binary"); 
            
Header("Pragma: no-cache"); 
            
Header("Expires: 0"); 
        }
    } 
    else
    { 
        
Header("Content-type: file/unknown"); 
        
Header("Content-Length: ".(string)(filesize("$filepath"))); 
        
Header("Content-Disposition: $dn_yn; filename=$filename"); 
        
Header("Content-Description: PHP3 Generated Data"); 
        
Header("Pragma: no-cache"); 
        
Header("Expires: 0"); 
    } 

    if (
is_file("$filepath"))
    { 
        
$fp fopen("$filepath""rb"); 
        if (!
fpassthru($fp)) fclose($fp); 
    }
    else echo 
"해당 파일이나 경로가 존재하지 않습니다."
?>