Next Page gets downloaded in Perl

P

Praki

Greetings All

I have a Perl file in which i m doing all the operaions in one file
based on the command line arguments.
login.cgi
..
..
..
$query = new CGI;
$sid = $query->cookie('CGISESSID') || $query->param('CGISESSID') ||
undef;
$submit_value=$query->param("submit");

if ($sid ne ""){
print $query->header( -cookie=>$cookie );}
else{
print "Content-type: text/html";}

if ($sid eq "" && $submit_value eq "") {
&auth_page(" Login Authentication"," Login Authentication");
print "Session id: ";
print $sid;
print "\n Submit value:";
print $query->param("submit");

print $FORM{'uid'};
print $query->header( -cookie=>$cookie );
&print_trailer();
exit(0);
}
elsif ($sid eq "" && $submit_valu ne "") {
&print_header(" Login Authentication"," Login Authentication");
&print_trailer();
exit(0);
}
..
..
..
when i open the for the first time it should go to

if ($sid eq "" && $submit_value eq "") this condition as both will be
empty. and here i m getting the login information and again i m
calling the same file(login.cgi). now as the sumbit value will not be
empty it has to go the next condtion

elsif ($sid eq "" && $submit_valu ne "") .i m validating the
credentials here. but the problem here i face is the page info which
is to be displayed in the browser is automaticaly asks for File
Download. when downloaded that file and check by open in the new
window it displays the ouput. i could not understand the problem so
plz can u help me in clearing this problem...

where i m going wrong..
thanks,
Prakash
 
P

Paul Lalli

Greetings All

I have a Perl file in which i m doing all the operaions in one file
based on the command line arguments.
login.cgi
.
.
.
$query = new CGI;
$sid = $query->cookie('CGISESSID') || $query->param('CGISESSID') ||
undef;
$submit_value=$query->param("submit");

if ($sid ne ""){
print $query->header( -cookie=>$cookie );}
else{
print "Content-type: text/html";}

if ($sid eq "" && $submit_value eq "") {
&auth_page(" Login Authentication"," Login Authentication");
print "Session id: ";
print $sid;
print "\n Submit value:";
print $query->param("submit");

print $FORM{'uid'};
print $query->header( -cookie=>$cookie );
&print_trailer();
exit(0);}

elsif ($sid eq "" && $submit_valu ne "") {
&print_header(" Login Authentication"," Login Authentication");
&print_trailer();
exit(0);}

.
.
.
when i open the for the first time it should go to

if ($sid eq "" && $submit_value eq "") this condition as both will be
empty. and here i m getting the login information and again i m
calling the same file(login.cgi). now as the sumbit value will not be
empty it has to go the next condtion

elsif ($sid eq "" && $submit_valu ne "") .i m validating the
credentials here. but the problem here i face is the page info which
is to be displayed in the browser is automaticaly asks for File
Download. when downloaded that file and check by open in the new
window it displays the ouput. i could not understand the problem so
plz can u help me in clearing this problem...

where i m going wrong..

Your content-type header is wrong. It's missing newlines. You're
using the $query->header() method in the if statement. Why not in the
else statement?

if ($sid ne ""){
print $query->header( -cookie=>$cookie );
}
else{
print $query->header( );
}

(A completely separate problem is that you're later trying to print
the header with some cookies, after you've already printed both header
and content. That's not going to work. You need to rework your
logic).

Paul Lalli
 
P

Praki

Your content-type header is wrong. It's missing newlines. You're
using the $query->header() method in the if statement. Why not in the
else statement?

if ($sid ne ""){
print $query->header( -cookie=>$cookie );}

else{
print $query->header( );

}

(A completely separate problem is that you're later trying to print
the header with some cookies, after you've already printed both header
and content. That's not going to work. You need to rework your
logic).

Paul Lalli

Thanks for that info i corected and its working fine....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top