#!c:/perl/bin/perl.exe
##################################################
# Section search 04/06/99 by Jeff Waldock
# Lists pictures
##################################################
$rootdir="h:/landscapeimage/photos/main/";
$rooturl="/photos/main/";
$cgiroot="h:/landscapeimage/photos/";
$imageurl="/images";
$cgibin="/photos";
$cgilocation = "$cgibin/sectionsearch.pl";
###################################################
# Get Date and Time from Server
@days=("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
@longdays=("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
@month=("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
# Get Date and Time from Server
$date = localtime();
($sec,$min,$hour,$mday,$mon,$yr,$wday,$yday,$isdst) = localtime(time);
if ($min < 10) {$min="0".$min; }
$shorttime="$hour:$min";
$year=$yr+1900;
$date1="$days[$wday] $mday $month[$mon] $year at $shorttime";
$date2="$longdays[$wday] $mday $month[$mon] $year at $shorttime";
$thisyear=$year;
print "Content-Type: text/html\n\n";
$request_method=$ENV{'REQUEST_METHOD'};
if ($request_method eq "GET") {
$form_info=$ENV{'QUERY_STRING'};
} else {
$size_of_info=$ENV{'CONTENT_LENGTH'};
read(STDIN, $form_info, $size_of_info);
}
@key_value_pairs=split(/&/,$form_info);
foreach $key_value (@key_value_pairs)
{
($key,$value)=split(/=/,$key_value);
$value=~ tr/+/ /;
$value=~ s/%([\dA-Fa-f][\dA-Fa-f])/pack("C",hex($1))/eg;
$INPUT{$key} = $value;
#print "",$key," = ",$value,"
\n";
}
$searchstring=$INPUT{'section'};
#$searchstring =~ s/ //g;
$searchstring =~ s/_/ /g;
$sstring=$searchstring;
#$searchstring =~ s/ //g;
$searchstring =~ tr/A-Z/a-z/;
$picsperframe=$INPUT{'n'};
unless(($searchstring)||($picsperframe)) {
#first call - set up the list of search words
$searchform=1;
&ShowSearchForm;
} else {
unless ($picsperframe) { $picsperframe=4; }
if ($searchstring) {
#generate the search index
&SearchSetup;
}
$pic1=$INPUT{"first"};
unless ($pic1) { $pic1=1; }
&Header;
&GetPhotoData;
}
&Footer;
print "