ส่วน Code ที่ผมใช้เช็คเป็นแบบนี้ครับ
$morning=0600;
$affter=1100;
$evening=1600;
<?
if(file_exists("../piswin/$filename")){
$file = fopen("../piswin/$filename", "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
while(!feof($file))
{
$data=fgets($file);
$empid=substr($data,0,6);
$rg=substr($data,16,4);
if($empid=="$rs[EmpId]" and $rg>=$morning and $rg<=$affter)
{
echo"<img src='../Icon/tik.gif' border='0'>";break;
}
}
fclose($file);
}
else{echo "<strong>?</strong>";}
?>
/////////////////////////////////////////ช่วงเช้า
<?
if(file_exists("../piswin/$filename")){
$file = fopen("../piswin/$filename", "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
while(!feof($file))
{
$data=fgets($file);
$empid=substr($data,0,6);
$rg=substr($data,16,4);
$rt=($empid=="$rs[EmpId]" and $rg>=$morning and $rg<=$affter);//echo"$rt"."<br>";
//$rr=($empid=="$rs[EmpId]" and $rg>=$affter and $rg<=$evening);//echo"$rr"."<br>";
if($rt==1 and $empid=="$rs[EmpId]" and $rg>=$affter and $rg<=$evening)
{
echo"<img src='../Icon/tik.gif' border='0'>";break;
}
}
fclose($file);
}
else{echo "<strong>?</strong>";}
?>
/////////////////////////////////////////ช่วงบ่าย