= 0 && intval(date("H")) <= 6){ // ทำเวลาให้เป็น UTC ซึ่งน่าจะมีวิธีที่ดีกว่านี้ $d = intval(date("H")) + 24; }else{ $d = intval(date("H")); } $dutc = $d - 7; $hh1 = notime($dutc); if($hh1 < 10 ){ $hh = '0'.$hh1; }else{$hh = $hh1;} if($d >= 24 && $d <= 30){ // ถ้ายังไม่ถึง 07.00 น. ยังไม่ต้องขึนวันใหม่ $now1 = intval(date("d")) - 1 ; if($now1 < 10){ $now = '0'.$now1;}else{ $now = $now1;} // เติม 0 ให้วันมีสองหลัก }else{ $now = date("d");} // 07.00 น.เป็นต้นไปขึ้นวันใหม่ $thaiyear = intval(date("Y"))+543; $path ='D:/FTP/'.$thaiyear.'/War/'.$now.'-'.$yy.date('y').'.TXT'; $file = fopen($path,"r"); $i =0 ; $cc = 0; while(feof($file) != true){ $st[$i] = fgets($file); $cdata = strlen($st[$i]); $cc = $cc + $cdata; $i++; } for($i=0;$i < count($st);$i++){ $ddt = str_replace('ZCZC','Date: '.date("d")."-".date("M").'-'.(intval(date("Y"))+543).'
',$st[$i]); echo ''.str_replace('NNNN','
...................................................................................................................',$ddt).'

'; } /* $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;} } ?>