CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
HTTP 500 Internal Server Error from my login page

 



ningji
Novice

Nov 26, 2012, 12:45 PM

Post #1 of 2 (1221 views)
HTTP 500 Internal Server Error from my login page Can't Post

Hi guys, another cgi question if some one can help.

i find 2 files for login webpage using perl cgi.pm,
after i give the user name and password, click login,
i get this,
HTTP 500 Internal Server Error

Any help appreciated.

following is the login.pl, don't think index1.pl is needed here.



#!/usr/bin/perl

# login.pl
use CGI;
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
use CGI::Session ( '-ip_match' );

my $q = new CGI;

my $usr = $q->param('usr');
my $pwd = $q->param('pwd');

if($usr ne '')
{
# process the form
if($usr eq "demo" and $pwd eq "demo")
{
$session = new CGI::Session();
print $session->header(-location=>'index1.pl');
}
else
{
print $q->header(-type=>"text/html",-location=>"login.pl");
}
}
elsif($q->param('action') eq 'logout')
{
$session = CGI::Session->load() or die CGI::Session->errstr;
$session->delete();
print $session->header(-location=>'login.pl');
}
else
{
print $q->header;
print $q->start_html;
print $q->start_form(-name=>'myLogin', -method=>'GET');
# print $q->start_form(-name=>'myLogin', -method=>'POST');
print $q->h4("username");
print $q->textfield(-name=>'usr');
print $q->h4("password");
print $q->textfield(-name=>'pwd');
print $q->submit(-name=>'login');
print $q->end_form;
print $q->end_html;

}


(This post was edited by ningji on Nov 26, 2012, 12:46 PM)


wickedxter
User

Nov 28, 2012, 2:19 AM

Post #2 of 2 (1212 views)
Re: [ningji] HTTP 500 Internal Server Error from my login page [In reply to] Can't Post

add this to ur script near the top


Code
print "content-type: text/html\n\n"; 
[\code]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives