#!/usr/bin/perl
$photo_path = "D:webgta3_images";
$photo_url = "http://chris.iphq.co.uk/gta3_images";
my(@dirs, $file, $number);
opendir(DIR,"$photo_path");
foreach $file (sort readdir(DIR)) {
if ($file =~ /.jpg/) {
push (@dirs, "$file");
}
}
closedir(DIR);
srand(time ^ $$);
$number = rand(@dirs);
$image = qq!<img src="$photo_url/$dirs[$number]" alt="Random GTA3 Screenshot" border="0" />!;
print "Content-type: text/htmlnn";
print "$image";
exit;