#!/Perl/bin/perl ############### #merge.pl?mew=thumbs§ion=dump&top=-1&perpage=10 #merge.pl?mew=thumbs§ion=sketches&top=-1&perpage=10 #merge.pl?mew=thumbs§ion=color&top=-1&perpage=10 ############### #call merge.pl?mew=view§ion=dump&num=2 #call merge.pl?mew=view§ion=sketches&num=2 #call merge.pl?mew=view§ion=color&num=2 ############### #If there is a fatal error show it to the browser use CGI::Carp qw(fatalsToBrowser); use CGI; $in = new CGI; #Tell The browser that its going to get some text print "Content-type: text/html\r\n\r\n"; #Get header open(FILE,"header.txt") || die; @FILE = ; close(FILE); #output header print "@FILE"; $section = $in->param('section'); #Open the file $info_file = "$section.txt"; #Specify how each line is separated $spacing = "\n"; #Open save and close the file open(FILE,"$info_file") || die; @FILE = ; close(FILE); #Make @FILE into one big string as $teh_list $teh_list = join('',@FILE); #Make $teh_list into an array with divides at $spacing (/n) @teh_list = split(/$spacing/,$teh_list); #Are we doing thumbs or just a spefic view $mew = $in->param('mew'); # it's the same for view and thumbs until... if ($mew eq thumbs) { #################*********################# #################Do thumbs################# #################*********################# #Grab the info from the url entered $top = $in->param('top'); $perpage = $in->param('perpage'); $total = $teh_list[0]; $perpage = $in->param('perpage'); ##################### ##Look for bad inputs if ($top > $total) { $top = $total; } if ($top < 1) { $top = $total; } $stop = $top - $perpage + 1 ; if ($stop < 1) { $stop = 1; } ##Done the input mods ##################### $i = 1; $k = $top; #From top to stop make the thumbs and links while ($k >= $stop) { # print "$k "; $temp1 = ($total - $k)*2 + 1; $temp2 = $teh_list[$temp1]; #Put the link print ""; #call merge.pl?mew=view§ion=color&num=2 #Put the thumb print ""; #If there have been five out go to next line $i = $i +1; $k = $k -1; if ($i == 6) { print "

"; $i = 1; } else { print ""; } } print "
"; ################## #Are there thumbs before this? if ($top != $total) { #Then link to them print ""; } else { #If not put the other image out print ""; } #Woo divider print " - - - - - "; #Are the more thumbs? if ($stop != 1) { #Then link to them print ""; } else { #If not put the other image out print ""; } } if ($mew eq view) { #################*********################# #################*Do view*################# #################*********################# print ""; #Grab the info from the url entered $number = $in->param('num'); #Get the file name $total = $teh_list[0]; $temp1 = ($total - $number)*2 + 1; $temp2 = $teh_list[$temp1]; if ($number < $total) { print ""; #Put the thumb print ""; print ""; } else { print ""; } print ""; print ""; print ""; if ($number > 1) { print ""; #Put the thumb print "

"; } else { print "

"; } #Out the picture print "
"; #Out the description $temp1 = $temp1+1; $temp2 = $teh_list[$temp1]; print "$temp2"; } #Get footer open(FILE,"footer.txt") || die; @FILE = ; close(FILE); #output footer print "@FILE";