1
這是我的註冊網頁的Perl代碼。它應該將值附加到csv頁面。它完美地編譯,但是當我將它提供給我的HTML程序時,web pae實際上顯示一個錯誤。這是網頁 http://cs.mcgill.ca/~zviran1/register.html HELPPerl HTML CGI網頁錯誤
#!/usr/loca/bin/perl
use CGI;
my $q = CGI->new();
use strict;
my $username = $q->param('username');
my $name = $q->param('name');
my $password = $q->param('password');
my @array = ($name, $username, $password, "\r");
my $line = join(' , ', @array);
print "Content-type: text/html \n\n";
my $file = 'Members.csv';
open (FILE, '+>>$file') or die "Cannot open file";
my $inputLine = <FILE>;
while($inputLine = <FILE>)
{
if(index($line, $username) != 4){
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE> Error Page </TITLE> \n";
print "</HEAD>\n";
print "<BODY>\n";
print "The username you have entered is already in use.";
print "<br><a href=\"index.html\">Home Page</a> \n";
print "<br><a href=\"register.html\">Registration Page</a> \n";
print "</BODY>\n";
close(FILE);
}
else {
#seeking to the end of the file to append
seek(FILE, 0, 2);
print FILE $line;
}
}
close(FILE);
「實際顯示錯誤」 - 什麼錯誤? – Quentin 2014-12-01 21:04:42
點擊鏈接並嘗試註冊。 「內部服務器錯誤」 – Maya 2014-12-01 21:05:30
什麼是內部服務器錯誤?它記錄在你的服務器日誌中,沒有發送到瀏覽器,所以我不能從這裏知道。 – Quentin 2014-12-01 21:05:58