#!/bin/perl $webmaster="webmaster\@mycompany.com"; if ($ENV{'REQUEST_METHOD'} eq 'POST') { # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } elsif ($ENV{'REQUEST_METHOD'} eq 'GET') { $buffer = $ENV{'QUERY_STRING'}; } else { &error_page; exit(1); } # Split the name-value pairs @pairs = split(/&/, $buffer); # Load the FORM variables 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; } if ($FORM{tablename} eq "") { &blank_message } else { $from_table = $FORM{tablename}; $html_file = `/usr/local/robelle/sx_extract.script $from_table`; if ($html_file eq "failed\n") { &error_page } else { print "Location: http://www.mycompany.com/~httpdusr/$html_file", "\n\n" } } sub error_page { # Format an error message for the user print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "Comment Form Error\n"; print "\n"; print "\n"; print "

Comment Form Error

\n"; print "
\n"; print "

\n"; print "Form input was not proccessed. Please mail your "; print "remarks to $webmaster"; print "Request method is $ENV{'REQUEST_METHOD'}"; print "

\n"; print "Content of Suprtool task logfile"; print "

";
    print `cat /tmp/sx_extract.log`, "\n";
    print "
", "\n"; print "Content of STexport logfile"; print "
";
    print `cat /tmp/stexport.log`;
    print "
", "\n"; print "\n"; print "\n"; } sub blank_message { print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "Blank Message\n"; print "\n"; print "\n"; print "

Blank Message

\n"; print "
\n"; print "

\n"; print "You did not indicate which table you wanted to extract from."; print "Please back up and correct, then resubmit.\n"; print "\n"; print "\n"; }