".$title[$chan]."  Change time zone: "; require 'inc_sel_tz.php'; print '   Return to ErrorFM
'; require 'inc_datformat.php'; $file = "pl$chan.dat"; $t = $date = $lastdate = ''; $fh = @fopen($file, 'rb'); if(!$fh) die("Missing or file busy: $file"); list($dum, $current) = unpack('s', @fread($fh, 2)); if($db) print " current = $current
\n"; if($current < -1 or $current > $recordmax) { @fclose($fh); if($db) print "Damaged file $file
"; } else { if($current >= 0) { unset($list); //First, read all records after current for($r = $current+1; $r <= $recordmax; $r++) $list[] = getRec($fh, $r); //then read all records from 0 to current for($r = 0; $r <= $current; $r++) $list[] = getRec($fh, $r); array_reverse($list); print ''; for($i = count($list)-1; $i >= 0; $i--) if($list[$i][1]) { $t = $list[$i][0]+$timeoffset; $date = date('l M j, Y', $t); if($date != $lastdate) { print ''; $lastdate = $date; } $class = (date('G', $t) % 2); print '' .''; } print '
'.$date.'
'.date($timefmt, $t).''.$list[$i][1].'
'; } else { print "(empty)
"; } @fclose($fh); } if($db) print "
\n"; function getRec($fh, $r) { global $headersize, $recordsize, $titlemax, $db; #if($db) print " $r: "; @fseek($fh, $headersize + $r*$recordsize); list($dum, $time) = unpack('L', @fread($fh, 4)); list($dum, $strlen) = unpack('C', @fread($fh, 1)); #if($db) print dechex($time)." :: "; if($strlen) list($dum, $song) = unpack('a'.$strlen, fread($fh, $titlemax)); #if($db) print "[$lastsong]
\n"; return array($time, $song); } ?>