URGENT:-( Problem with cgi script.

Problems with the Windows version of XAMPP, questions, comments, and anything related.

URGENT:-( Problem with cgi script.

Postby bogasrikanth » 22. August 2008 20:34

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};
}
Last edited by bogasrikanth on 22. August 2008 21:08, edited 1 time in total.
bogasrikanth
 
Posts: 18
Joined: 13. August 2008 19:02

plzz...

Postby bogasrikanth » 22. August 2008 20:42

Dear Members,


I knew nothing about this .cgi scripting language... please help me...

I got to fix this.

Thanks
sri
bogasrikanth
 
Posts: 18
Joined: 13. August 2008 19:02

Postby Wiedmann » 22. August 2008 21:28

I knew nothing about this .cgi scripting language

The scripting language is "Perl".
--> you have installed any Perl?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby bogasrikanth » 22. August 2008 21:56

Hey the perl has been installed. But the error it says is some thing which I am not able to understand at all
bogasrikanth
 
Posts: 18
Joined: 13. August 2008 19:02

Postby Wiedmann » 22. August 2008 22:14

Something in the "error.log"?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Hi...

Postby bogasrikanth » 26. August 2008 17:14

Hi Weidmann,

Could you please fix the issue in there.

I got to tell you the problem in here.

ISSUE:
====

I had to login to the server X, After the login it executes the pass.cgi file to display the link click to use the etools.

when I click this link I want the server X to redirect the user to the aristotle.eng.auburn.edu server as mentioned. I donot want the user to redirect using an <a> tag. I WANT THE SERVER X TO DO THIS JOB. Could you please fix this in the script. I know nothing about the cgi

Thanks
sreekanth
bogasrikanth
 
Posts: 18
Joined: 13. August 2008 19:02


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 82 guests