Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Perl CGI help...

hopefulcdhopefulcd Member Posts: 1
Hi all, I'm having a frustrating error that I'm somewhat confused about. I'm writing a simple perl script as a cgi for a login. I've run through a lot of tests to try to figure out where the error is, but so far it's not been successful. The perl code is as follows:
<br />#!/usr/bin/perl -wT<br /><br />use CGI;<br />use CGI::Cookie;<br />use CGI qw(:standard);<br />use CGI::Carp qw(warningsToBrowser fatalsToBrowser);<br />use Fcntl qw(:flock :seek);<br />use Fcntl;<br />use strict;<br /><br />my (<br />$name, #username they type in<br />$pass, #password they type in<br />$sys_name, #username in the member file<br />$sys_pass, #password in the member file<br />@members, #array of all members<br />$dirto_members_list, #directory to members file<br />$valid_name, #variable to determine name validity<br />$valid_pass, #variable to determine password validity<br />$cookie #cookie used to dtermine if they're logged in or not<br />);<br /><br />$name = param('username');<br />$pass = param('password');<br /><br />print header;<br />print start_html('Login Status');<br /><br />#########################################################################<br /># Check the name & password in the members file<br />#########################################################################<br /><br />$dirto_members_list = "/home/hopefulc/public_html/cgi-bin/koh_members_list.cgi";<br /><br />open (MEM, $dirto_members_list) || die("The File could not be opened!"); #open the members file<br />flock (MEM, LOCK_SH);<br />seek (MEM, 0, SEEK_SET);<br />@members = <MEM>;<br />chomp (@members);<br /><br />close(MEM); #close the members file<br /><br />$valid_name = 0;<br />$valid_pass = 0;<br /><br />foreach my $mem (@members)<br />{<br />($sys_name, $sys_pass) = split (/|..|/, $mem);<br /><br />if ($name eq $sys_name)<br />{<br />$valid_name = 1;<br /><br />if ($pass eq $sys_pass)<br />{<br />$valid_pass = 1;<br />print "Congratulations $name, you logged in!<br /><br><br><br />";<br />}<br />else<br />{<br />print "Sorry, you didn't type in the correct password.<br /><br><br><br />";<br />}<br />}<br />}<br /><br />##########################################################################<br /><br />print end_html;<br />

The tests that I've run through include checking the file permissions and setting them to 0755, carefully checking the spelling in the files, checking the html form, and I also ran a slightly modified version of this code from the command line successfully.
The annoying Internal Server error that is in the Apache error log is as follows:

[Mon Jun 16 17:56:46 2008] [error] [client 76.193.171.114] File does not exist: /home/hopefulc/public_html/500.shtml

The error seems very simple, except that I know the file does exist. If anyone has any suggestions to help it would be very much appreciated...
Sign In or Register to comment.