[Wolves] Problem with code
Wayne Morris
wayne at machx.co.uk
Fri Feb 18 14:58:24 GMT 2005
Sorry if there has been any replies to this but my mailserver lost 36
messages yesterday.
Please repost any replies please.
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>
_______________________________________________
Wolves LUG mailing list
Homepage: http://www.wolveslug.org.uk/
Mailing list: Wolves at mailman.lug.org.uk
Mailing list home: http://mailman.lug.org.uk/mailman/listinfo/wolves
More information about the Wolves
mailing list