Gossamer Forum
Home : General : Perl Programming :

Unknow problem

Quote Reply
Unknow problem
I have a script, to show member info in my Top Sites program, but i try to execute the script at http://netsites.hypermart.net/top/info.cgi and i receive one Unknow problem...

My info.cgi script:
Code:
#!/usr/local/bin/perl


eval {
require "variables.pl";
};

if ($@) {
print "Content-type: text/html\n\n";
print <<EOF;
A Fatal Error has occurred in the running of Top Sites.
<BR><BR>
Something is wrong with your variables.pl file. Please look carefully at the error
listed below and double check the settings in the variables.pl file.<BR><BR>
The error is:
<BR><font color=red>
$@</FONT>
<BR><BR>
EOF

exit;
}

$version ="2.0";

print "Content-type: text/html\n\n";

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($fields{$name}) { $fields{$name} = $fields{$name}.",".$value; }
else { $fields{$name} = $value; }
}

unless ($ENV{'CONTENT_LENGTH'}) {

print <<EOF;
<p align="center">Fill out the following form to join $topsite_name</b></font> <br>
</p>
<form METHOD="POST" ACTION="info.cgi">
<table cellspacing="0" bgcolor="white" border="0" cellpadding="5">
<tr>
<td><font SIZE="-1" FACE="Verdana">Your Email address</font></td>
<td> <input TYPE="text" NAME="email" size="20"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value=" Join $topsite_name "></td>
</tr>
</table>
<p><br>
</p>
</form>

<br>

EOF

exit;
}

unless ($fields{'email'}=~/\@/) {
$error_email =1;

if ($error_email) {


print "<B>Errors have been detected in your sign up form.</B><br><br>\n";
print "Please go back and fix the following:<BR><font color=red>\n";
if ($error_email) {
print "Invalid email address: $fields{'email'}<br>";
}

print "</FONT><BR><BR>";
exit;

}
open (DAT,"<members.db");
if ($use_flock) {
flock DAT, 2;
}
@database_array = <DAT>;
close (DAT);


foreach $line(@database_array) {
@info_array = split(/\|/,$line);
}

if ($info_array[6] eq $fields{'email'}) {
&info;
} else {
&error;
}

sub info {

print <<EOF;
<center><font size=2><B>Info about the user $info_array[9]</B></FONT><BR><BR></CENTER>
For your site to be ranked, you need to complete the following three steps.<BR><BR>
<font color=red>1.</FONT> Put this html code into your web pages. The more places the better.<BR><BR>
<font color=blue>
</FONT>
<BR><BR>
<font color=red>2.</FONT> Once the above html is on your web site,
click the image that appears once to activate your account.
<BR><BR>
<font color=red>3.</font> Get as many of the visitors to your web site to click the image, and
check your rank
<a href="$topsite_location/topsites.html"><B>here</B></A> and watch your site move up, up, up....
<BR><BR>
Any and all questions should be directed to <a href="mailto:$your_email"><B>$your_email</B></a>
<BR><BR>
EOF

exit;
}


sub error {

print <<EOF;
<b>Invalid user's e-mail. Try again</B><BR><BR>
EOF

}

Can someone help?

------------------
[]'s

Lucas Saud - #19815087









Quote Reply
Re: Unknow problem In reply to
Your error logs saying:

Code:

Errors:
Missing right bracket at /data1/hypermart.net/netsites/top/info.cgi line 130, at end of line
syntax error at /data1/hypermart.net/netsites/top/info.cgi line 130, at EOF
Execution of /data1/hypermart.net/netsites/top/info.cgi aborted due to compilation errors.
[Thu Apr 22 13:33:04 1999] access to /data1/hypermart.net/netsites/top/info.cgi failed for 153.34.184.6, reason: Premature end of script headers

I don't see anything suspicious in you code, but check it in the again near the line 130. Smile


Regards,

Pasha

------------------
webmaster@find.virtualave.net
http://find.virtualave.net
Quote Reply
Re: Unknow problem In reply to
It looks to me like the second "unless" block was not terminated. You need a "}" just before the line containing "sub info {".

I hope this helps.
Quote Reply
Re: Unknow problem In reply to
Tanks Bobsie, now my script works fine. Smile

------------------
[]'s

Lucas Saud - #19815087