"; if (strcmp($ext,"txt") !== 0 && strcmp($ext,"nc") !== 0 && strcmp($ext,"gz") !== 0 && strcmp($ext,"zip") !== 0) { echo ' '; // exit(0); } $extension = $file[sizeof($file)-1]; if(strcmp($extension,"php")!=0 || strcmp($extension,"html")!=0 || strcmp($extension,NULL)!=0) { } // $DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"]; // echo "{=====================}"; if( file_exists($file_name) ) { $filesize = filesize($file_name); if(strstr($HTTP_USER_AGENT, "MSIE 5.5") ) { Header("Content-Type: application/x-msdownload"); Header("Content-Disposition: attachment; filename=$filename"); Header("Content-Length: $filesize"); Header("Pragma: no-cache"); Header("Expires: 0"); } else { Header("Content-type: file/unknown"); Header("Content-Length: $filesize"); Header("Content-Disposition: attachment; filename=$filename"); Header("Content-Description: PHP3 Generated Data"); } if (is_file($file_name)) { $fp = fopen("$file_name", "r"); if (!fpassthru($fp)) fclose($fp); } // -- 다운로드 로그를 기록함. @include("../REF/web/db_connect.php"); // echo "[$file_name1]
"; // -- 대양별 : downlog_ocean if (strstr($file_name1,"tar.gz")) { // -- $file_name1 = [korea_20070101.tar.gz] $a = explode("_",$file_name1); // -- $mode_flag = ($mode=="R"?"0":"1"); // -- 0:실시간, 1:지연모드 $yyyymmdd = date("Y-m-d"); // -- 다운로드 일자 $TBL = "downlog_ocean"; $ocean_name = $a[0]; $data_year=substr($a[1],0,4); $data_month=substr($a[1],4,2); $sql = "select count(*) from $TBL where ocean_name='$ocean_name' and data_year='$data_year' and data_month='$data_month' and mode_flag='$mode_flag' and down_date='$yyyymmdd'"; // echo "[$sql]
"; $result = @mysql_query($sql,$sql_connect); $row = @mysql_fetch_array($result); if ($row[0] == 0) { $sql = "insert into $TBL values('','$ocean_name','$data_year','$data_month','$mode_flag','$yyyymmdd',1)"; $result = @mysql_query($sql,$sql_connect); } else { $sql = "select no,(cnt+1) from $TBL where ocean_name='$ocean_name' and data_year='$data_year' and data_month='$data_month' and mode_flag='$mode_flag' and down_date = '$yyyymmdd'"; $result = @mysql_query($sql,$sql_connect); $row = @mysql_fetch_array($result); $sql = "update ".$TBL." set cnt=".($row[1])." where no = ".$row[0]; $result = @mysql_query($sql,$sql_connect); } // -- wmoid별 : downlog_prof } else if (strstr($file_name1,"prof.nc")) { $a = explode("_",$file_name1); // -- $mode_flag = ($mode=="R"?"0":"1"); // -- 0:실시간, 1:지연모드 $yyyymmdd = date("Y-m-d"); // -- 다운로드 일자 $TBL = "downlog_prof"; $sql = "select count(*) from ".$TBL." where wmoid='".$a[0]."' and mode_flag='".$mode_flag."' and down_date = '".$yyyymmdd."'"; $result = @mysql_query($sql,$sql_connect); $row = @mysql_fetch_array($result); if ($row[0] == 0) { $sql = "insert into ".$TBL." values('','".$a[0]."','".$mode_flag."','".$yyyymmdd."',1)"; $result = @mysql_query($sql,$sql_connect); } else { $sql = "select no,(cnt+1) from ".$TBL." where wmoid='".$a[0]."' and mode_flag='".$mode_flag."' and down_date = '".$yyyymmdd."'"; $result = @mysql_query($sql,$sql_connect); $row = @mysql_fetch_array($result); $sql = "update ".$TBL." set cnt=".($row[1])." where no = ".$row[0]; $result = @mysql_query($sql,$sql_connect); } // -- 개별 프로파일 : downlog_wmoid } else { // -- $filename1 --> [D6900234_101.nc|d_6900234_101.txt] $mode_flag = ($mode=="R"?"0":"1"); // -- 0:실시간, 1:지연모드 $data_flag = (strstr($file_name1,".nc")?"0":"1"); // -- 0:NC, 1:TXT $a = explode("_",$file_name1); // -- if ($data_flag == "0") { $wmoid = substr($a[0],1); // -- wmoid $pn = substr($a[1],0,3); // -- pn } else { $wmoid = $a[1]; // -- wmoid $pn = substr($a[2],0,3); // -- pn } $yyyymmdd = date("Y-m-d"); // -- 다운로드 일자 $TBL = "downlog_wmoid"; $sql = "select count(*) from ".$TBL." where wmoid='".$wmoid."' and pn=".$pn." and data_flag='".$data_flag."' and mode_flag='".$mode_flag."' and down_date = '".$yyyymmdd."'"; $result = @mysql_query($sql,$sql_connect); $row = @mysql_fetch_array($result); if ($row[0] == 0) { $sql = "insert into ".$TBL." values('','".$wmoid."',".$pn.",'".$data_flag."','".$mode_flag."','".$yyyymmdd."',1)"; $result = @mysql_query($sql,$sql_connect); } else { $sql = "select no,(cnt+1) from ".$TBL." where wmoid='".$wmoid."' and pn=".$pn." and data_flag='".$data_flag."' and mode_flag='".$mode_flag."' and down_date = '".$yyyymmdd."'"; $result = @mysql_query($sql,$sql_connect); $row = @mysql_fetch_array($result); $sql = "update ".$TBL." set cnt=".($row[1])." where no = ".$row[0]; $result = @mysql_query($sql,$sql_connect); } } } else { echo ' '; } exit; ?>