Right. Here goes. I have a logfile the contents of which is:
06/04/2004 15:38:13#zerver#00:00:00#0#0#0#0#0#0.000#0#0
06/04/2004 15:58:25#zerver#00:00:00#0#0#0#0#0#0.000#0#0
06/04/2004 16:00:04#zerver#00:00:00#0#0#0#0#0#0.000#0#0
06/04/2004 16:03:16#zerver#00:00:00#0#0#0#0#0#0.000#0#0
06/04/2004 16:06:06#zerver#00:00:00#0#0#0#0#0#0.000#0#0
06/04/2004 16:23:02#zerver#00:00:00#0#0#0#0#0#0.000#0#0
06/04/2004 16:29:43#zerver#00:00:00#0#0#0#0#0#0.000#0#0
06/04/2004 16:44:33#zerver#00:00:00#0#0#0#0#0#0.000#0#0
Now, I have written a script to get the time from the LAST of those logs. It goes something like the below. The trouble is, the seconds seem to mess up. Even the minutes go up, although they are getting their info from the log file, which doesnt change! You can see the results at http://82.0.247.166/testing/lines.php (note, keep pressing refresh)
here goes:
<?
$lines = file("C:/Program Files/ftp/Log_Transfer.log");
$num_lines = count($lines);
if($num_lines == 0){
echo "NO LINES!";
exit;
}
$number = $num_lines - 1;
$last_line = $lines["$number"];
//
// Make the explosion!
//
$part_array = explode('#', $last_line);
$spaces = $part_array[0];
unset($part_array);
echo "<BR>";
echo "\r\n";
//
// Make the second explosion (spaces)
//
$timedate = explode(' ', $spaces);
//
// Date Array
//
$explode_date = $timedate[0];
$date = explode("/", $explode_date);
//
// Time Array
//
$explode_time = $timedate[1];
$time = explode(":", $explode_time);
//
// Make times!!!!
//
$mk_middle = $time[0];
$mk_middle .= ",";
$mk_middle .= $time[1];
$mk_middle .= ",";
$mk_middle .= $time[2];
$mk_middle .= ",";
$mk_middle .= "0";
$mk_middle .= ",";
$mk_middle .= "0";
$mk_middle .= ",";
$mk_middle .= "0";
$big_time = mktime($mk_middle);
$print = date("H:i:s", $big_time);
echo $print;
echo "<b> // This value is made by the date() function.</b>";
echo "<BR>";
echo "<BR>";
echo $mk_middle;
echo "<b> // This is the value going INTO mktime</b>";
echo "<BR>";
echo "<BR>";
echo "\r\n";
echo "\r\n";
print_r($time);
?>