Hi friends,
Could you please make this work.
Error:
====
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: pass.cgi
If you think this is a server error, please contact the webmaster.
Error 500
localhost
08/22/08 14:33:39
Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8h mod_autoindex_color PHP/5.2.6
Source Code:
=========
#!"C:\xampp\perl\bin\perl.exe"
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use CWT::MySQL;
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use strict;
my $cwt = new CWT::MySQL();
my $url = $cwt->url;
my $cgi = new CGI;
$cwt->set( page_title => "CAVE Software");
my $action = $cwt->param('action');
my %FunctionMap = (
SHOW_ETOOLS => { ROLES => [] },
SHOW_INDEX => { ROLES => [] },
SHOW_LOAD => { ROLES => [] },
SHOW_ML => { ROLES => [] },
SUBMIT_FORM => { ROLES => [] },
AUTO => { ROLES => [] },
);
my $cmd = $cwt->param('CMD') || 'AUTO';
foreach (keys %FunctionMap) {
$cmd = $_ if ($cmd eq $FunctionMap{$_}{BUTTON});
}
$cmd = 'AUTO' unless defined $FunctionMap{$cmd};
$cwt->set( MAN_SECTION => $cmd );
$cwt->require_role($FunctionMap{$cmd}{ROLES});
print $cgi->header();
print $cgi->start_html(-title=>"CAVE Software");
if ($cmd eq 'SHOW_INDEX') {
show_index();
} elsif ($cmd eq 'SHOW_ML'){
show_ml();
} elsif ($cmd eq 'SHOW_LOAD'){
show_load();
} elsif ($action) {
submit_form();
} elsif ($cmd eq 'AUTO') {
main_links();
} elsif ($cmd eq 'SHOW_ETOOLS'){
show_etools();
}
else{
print qq{<P>Invalid command ($cmd)};
}
print $cgi->end_html();
exit 0;
sub show_etools
{
my $ua = LWP::UserAgent->new;
$ua->timeout(30);
$ua->env_proxy;
my $response = $ua->get('http://aristotle.eng.auburn.edu/Version9/index.php');
if ($response->is_success) {
print $response->content;
}else{
die $response->status_line;
}
}
sub show_index
{
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my $response = $ua->get('http://aristotle.eng.auburn.edu/Version2/statistical/index.php');
if ($response->is_success) {
print $response->content;
}else{
die $response->status_line;
}
}
sub show_ml
{
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my $response = $ua->get('http://aristotle.eng.auburn.edu/Version3/MatDB/fload.php');
if ($response->is_success) {
print $response->content;
}else{
die $response->status_line;
}
}
sub show_load
{
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my $response = $ua->get('http://aristotle.eng.auburn.edu/Version3/EnvDB/load.php');
if ($response->is_success) {
print $response->content;
}else{
die $response->status_line;
}
}
sub submit_form
{
my %form;
my $pars;
my $temp;
foreach my $p (param()) {
$form{$p} = param($p);
$temp = $form{$p};
$pars .= qq{$p=>"$temp",};
}
my $faction = qq{http://aristotle.eng.auburn.edu};
$faction .= $action;
my $ua=LWP::UserAgent->new();
my $req= POST "$faction",Content=>\%form;
my $content=$ua->request($req);
if ($content->is_success){
print $content->content;
}else{
print $content->status_line . "\n";
}
}
sub main_links
{
print qq{<p><table align="center" width="100%"><tr><td>\n};
print qq{<table border="0" cellpadding="4" cellspacing="4" width="90%">\n};
print qq{<center><font size=+3>CAVE Software</font></center>};
print qq{<tr><td><br><ul>\n};
print qq{<li>\n};
print qq{<a href="$url?CMD=SHOW_ETOOLS">Click to use eTools</a></li>\n};
print qq{</li></ul></td></tr></table>\n};
print qq{</td></tr></table>\n};
}