date_default_timezone_set("Asia/Bangkok");
$yy = strtoupper(gmdate("M"));
$now = gmdate('d');
$thaiyear = intval(gmdate("Y"))+543;
//$path ='D:/FTP/'.$thaiyear.'/War/'.$now.'-'.$yy.gmdate('y').'.TXT';
//$pathget = $_GET['path'];
$pathget = "2556/datafile/06-NOV13.TXT";
$path = "D:/FTP2/".$pathget;
//$indx = $_GET['type'];
$indx = "SX";
if($indx == "all"){
if(file_exists($path)){ // ถ้ามีไฟล์ที่เรียก
$file = fopen($path,"r");
while(feof($file) != true){
$read_now = fgets($file);
$read_now = str_replace('ZCZC',' ',$read_now);
echo str_replace('NNNN',' ',$read_now).'
';
}
}else { echo " ไม่มีข้อมูลที่ท่านเรียก";}
}else { //นอกเหนือจาก all
if(file_exists($path)){ // ถ้ามีไฟล์ที่เรียก
$file = fopen($path,"r");
$i =0 ;
$cc = 0;
$k =0;
while(feof($file) != true){
$temp_st = fgets($file);
while(trim($temp_st) != "NNNN"){
$temp_st .= $temp_st;
}
/* if(trim(substr($temp_st,0,2)) == trim($indx) ){
$st[$i] = $temp_st;
$i++;
}*/
}
}else { echo " ไม่มีข้อมูลที่ท่านเรียก";} // ถ้าไม่มีมีไฟล์ที่เรียก
/* $st2 = implode("&",$st); //รวม array แทรก '&' คั่น
$temp = explode("ZCZC",$st2); //แยกลง array โดยใช้ ZCZC เป็นตัวคั่น
$stexplode = array_unique($temp);
$count1 = count($stexplode);
$cnum = strlen($rddata);
$j=1;
while($j!=$count1){
if(trim(substr($stexplode[$j],stripos($stexplode[$j],$rddata,0),strlen($rddata)+2)) == trim($rddata)){
$st3 = trim($stexplode[$j]);
$st4 = explode('&',$st3);
$k = 1;
while($k != count($st4)){
echo ''.str_replace('NNNN','',$st4[$k]).'
';
$k++;
}
$j++;
}else{
$j++;
}
}
fclose($file);
}else{
echo 'NO Data';
} */
}
function notime($dutc) // สร้างเวลา
{
if($dutc >= 21){return '21';}
elseif($dutc >= 18){ return '18';
}elseif($dutc >= 15){ return '15';
}elseif($dutc >= 12){ return '12';
}else{return $dutc;}
}
?>