[Wolves] Problem with code
Wayne Morris
wayne at machx.co.uk
Wed Feb 16 20:00:52 GMT 2005
Can someone interpret this code for me - on my old server it correctly
displayed the newest image added to
a webcam directory, on my new server it is displaying the biggest file?
Anyone know why?
<head><meta http-equiv="refresh" content="5"></head> <pre>
<?php
$latest_num = 0;
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if (preg_match("/^test(\d+)/", $file, $matches)) {
if ($matches[1] > $latest_num) {
$biggest = $matches[1];
$latest_file = $file;
}
// echo " $file\n";
}
}
closedir($handle);
}
echo "Latest file: $latest_file\n";
echo "<img src='$latest_file'>";
?>
</pre>
More information about the Wolves
mailing list