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'];
$path = "D:/FTP2/".$pathget;
$indx = $_GET['type'];
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){
$st[$i] = fgets($file);
if(trim(substr($st[$i],0,2)) == trim($indx) ){
$key[$k] = $i;
$k++;
}
$cdata = strlen($st[$i]);
$cc = $cc + $cdata;
$i++;
}
$maxx = count($key);
for($i = 0;$i < $maxx ;$i++){
$key1 = $key[$i];
while(trim($st[$key1]) != "NNNN"){
echo ''.$st[$key1].'
';
$key1++;
} // end while
echo "
";
} // end for
}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;}
}
?>