#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
$event = param('event');
$eventtype = param('eventype');
$s = param('s');
$n = param('n');
opendir my $dir, "/home/tdnthivnstbs/public_html/$eventtype/$event" or die "Cannot open directory: $!";
my @files = readdir $dir;
closedir $dir;
foreach $file(@files){
if ($file =~ /.jpg$|.JPG$/){ push @images , $file}
}
foreach $img(@images){
if (-e "/home/tdnthivnstbs/public_html/$eventtype/$event/$img.txt"){
open(TXT,";
close TXT;
#$txt{$img} = join ( ",",@imgtxt)
foreach $bit(@imgtxt){
($parm, $val) = split(/=/, $bit);
$txtbit{$img}{$parm} = $val ;
}
}
}
@days = qw/Mon Tue Wed Thu Fri Sat Sun/;
@limimages = @images[$s..($s+11)];
print "Content-Type: text/html\n\n";
print " $event $eventtype
start: $s
Number: $n ";
foreach $img(@limimages){
$x++;
if (($x+2)/3 == int(($x+2)/3)){
print "