[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] BOUNCE macperl-webcgi@macperl.org: Non-member submission from [Amitava Basu <incas@cal3.vsnl.net.in>]



>From macperl@cfcl.com  Mon Feb  7 23:18:15 2000
X-Sent-To: <macperl-webcgi@macperl.org>
Received: from cal3.vsnl.net.in (cal3.vsnl.net.in [202.54.9.23])
	by cfcl.com (8.9.2/8.9.2) with ESMTP id XAA03423
	for <macperl-webcgi@macperl.org>; Mon, 7 Feb 2000 23:18:08 -0800 (PST)
Received: from 203.197.116.107 (ppp116-107.pppcal.vsnl.net.in [203.197.116.107])
	by cal3.vsnl.net.in (8.9.0/8.9.0) with SMTP id MAA14685
	for <macperl-webcgi@macperl.org>; Tue, 8 Feb 2000 12:46:21 +0500 (GMT+0500)
Message-ID: <399FC249.DCC@cal3.vsnl.net.in>
Date: Tue, 08 Feb 2000 12:44:17 +2510
From: Amitava Basu <incas@cal3.vsnl.net.in>
Reply-To: incas@cal3.vsnl.net.in
Organization: Aztec
X-Mailer: Mozilla 3.01-C (Macintosh; U; 68K)
MIME-Version: 1.0
To: macperl-webcgi@macperl.org
Subject: qpq server
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi!

I am trying to test a quest book with perl script. When I fill in the
form 
in the netscape browser and press submit, the quid pro quo 1.0.2 server 
reports "An error occurred while processing your request. An unspecified
internal server error occured."

I am unable to understand the problem.

Does qpq 1.0.2 support perl program? Or the program is unable to find
the file for 
processing?

Can someone please help?

I may be excused for skipping the comments.

Thanks

Amitava

here is the program code:

<html>
<head>
<title>Guest Book</title>

<body>
<center>
<h1 align="CENTER">Guest Book</h1>
<hr>

<FORM ACTION="/LC1/quid pro quo f/rootfolder/addguest.pl" 
METHOD="POST">

<TABLE WIDTH = "50%">

<TR>
<TD><STRONG>First Name</STRONG></TD><TD><STRONG>Last Name</STRONG></TD>
</TR>

<TR>
<TD><INPUT TYPE = "text" NAME= "first_name" SIZE="20"
MAXLENGTH="30"></TD>
<TD><INPUT TYPE = "text" NAME= "last_name" SIZE="20"
MAXLENGTH="30"></TD>
</TR>
</TABLE>

<TABLE WIDTH = "50%">

<TR>
<TD><STRONG>City</STRONG></TD><TD><STRONG>State</STRONG></TD>
</TR>

<TR>
<TD><INPUT TYPE = "text" NAME= "city" SIZE="20" MAXLENGTH="30"></TD>
<TD><INPUT TYPE = "text" NAME= "state" SIZE="20" MAXLENGTH="30"></TD>
</TR>
</TABLE>

<TABLE WIDTH = "50%">

<TR>
<TD><STRONG>Country</STRONG></TD><TD><STRONG>Email Address</STRONG></TD>
</TR>

<TR>
<TD><INPUT TYPE = "text" NAME= "country" SIZE="20" MAXLENGTH="30"></TD>
<TD><INPUT TYPE = "text" NAME= "email" SIZE="20" MAXLENGTH="74"></TD>
</TR>
</TABLE>

<STRONG>Comments</STRONG><BR>
<TEXTAREA NAME="comments" COLS="50" ROWS="6" WRAP="VIRTUAL"></TEXTAREA>

<BR>
<P>
<INPUT TYPE="submit" VALUE="Add Your Name">
<INPUT TYPE="reset" VALUE="Clear Form">
<P>
</form>
</center>
</body>
</html>

code for adding guest book entry:

#!/usr/bin/perl

require ("perl-cgi/guestbook.pm") || die ("Can't find GuestBook header
file");

read(STDIN, $postinfo, $ENV{'CONTENT_LENGTH'});
@InfoArray=split (/&/, $post_info);

for ($n=0; @InfoArray [$n]; $n++) {
($dummy,$temp) = split (/=/, @InfoArray [$n]);
$temp=~tr/+//;
$temp=~s/%([\dA-Fa-f][\dA-Fa-f])/pack("C", hex ($1))/eg;
@InfoArray [$n] = $temp;
}

if((length(@InfoArray[$FirstNameIndex]) !=0) ||
(length(@InfoArray[$LastNameIndex]) !=0))
{
$time=time();
@InfoArray [$NumEntryTime] = $time;

$GuestEntry=pack($GuestEntryStruct, @InfoArray);
open(GUEST_LOG, ">>$GuestBookPath") || die "Can't open guest book: $!";
print GUEST_LOG $GuestEntry;
close (GUEST_LOG)
}

&HTML_Header ("All done");
print "<BODY>\n";
print "<CENTER>\n";
print "<H1>Thanks for taking the time to sign our guest book</H1>\n";
print "<HR>\n";
print "Click <A HREF=guestbook.pl\">Here</A>";
print "to view our Guest Book<BR>\n";


Code for displaying Guest Book entry:

#!/usr/bin/perl

require ("perl-cgi/guestbook.pm") || die ("Die can't find Guest Book
header file: $!\n");
$Title="Guest Book Entries";

open (GUEST_LOG, $GuestBookPath) || die "Can't open guest book: $!";

&HTML_Header($Title);
print"<BODY>\n";
print"<H1 ALIGN=\"CENTER\">$Title</H1>\n";
print "<HR>\n";

while (read (GUEST_LOG,$buffer,$GuestEntrySize))
{
@InfoArray = unpack ($GuestEntryStruct,$buffer);

for ($n=0; $n < ($NumElements -1); $n ++) {
$InfoArray [$n] =~s/\0//g;

($FirstName,$LastName,$City,$State,$Country,$Email,$Comments,$NumAccessTime)=@InfoArray;

print"<STRONG>Name:</STRONG><BR>\n";
printf ("%s %s<BR>\n", $FirstName,$LastName);
print"<STRONG>E-mail Address:</STRONG><BR>\n";
print $Email, "<BR>\n";
print "<STRONG>From:</STRONG><BR>\n";
print $City, ""; $State, '', $Country, "<BR>\n";
print "<STRONG>On:</STRONG><BR>\n";

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime
($NumAccessTime);
print "$WeekDay [$wday, $Month[$mon] $mday, ", $year +2000;
print " at $hour:";
if ($min < 10){
print "0";
}
print "$min:";
if ($sec < 10){
print "0";
}
print "$sec <BR>\n";
print "<STRONG>COMMENTS:</STRONG><BR>\n";
print "<HR>\n";
}
close (GUEST_LOG);
}

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org