#!/usr/bin/perl
print "Content-type:text/html\n\n";
#Program to open a database of merchants and display a list
#Display is for either ALPHABETICAL or CATAGORY list, plus a list of ALL Merchants
#Needs a either POST from a Form or GET including:-
# "List" which is the type of list (alpha or category or all), and
# "db" which is the name of the database to be opened
$localtime = localtime();
$header = "html/catheader.html";
$footer = "html/catfooter.html";
$fontcolor = "000000";
$fontsize = "2";
$fontface = "Verdana";
&parse_input;
&variables;
&print_header;
&get_data;
&print_footer;
#print "end of script";
exit;
#====================================================================================
# Parse User Input
sub parse_input{
if ($ENV{'REQUEST_METHOD'} eq 'GET') { $buffer = $ENV{'QUERY_STRING'}; }
else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); }
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
}
#====================================================================================
sub variables{
$list = "$FORM{'list'}";
$database = "$FORM{'db'}";
$pageopen = $list;
$pageopen .= $database;
$datafile = $database;
$datafile .= ".dat";
}
exit;
#====================================================================================
sub get_data{
$longdesc = "";
$banner = "";
$count = "0";
open(LIST2, "<../database/$list/$datafile") || &error("Cannot open HTML source file : $pageopen, Error $!\n");
@list = \n";
print "
EndHTML
$longdesc = "";
$banner = "";
}
}
if($count eq "0"){
print <
$company
$banlink
$bansrc
Accreditation Number
$memid
$websitename
$desc
$longdesc
Accredited since: $mytime
Sorry there are no members for your selection
EndNOWT
}
}
exit;
#====================================================================================
sub get_longdesc{
$banlink = "";
$bansrc = "Web Site";
open(LIST3, "<../database/longdescription/total.dat");
@list3 =
";
}
return;
}
}
}
#====================================================================================
sub print_header {
$show = $list;
if($list eq "alpha"){
$show = "Alphabetical";
}
# print "Content-type:text/html\n\n";
open(FILE,"$header") || &error("The header file failed to open.");
@data =
Please press the Button below and try again
Thank you
$error
EndHTML exit; } exit; #=======================================================================