Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP BEGINNER!!

Status
Not open for further replies.

dadms

Technical User
Mar 8, 2003
67
US
I have been looking over this code for a few hours. I have removed each different if statement to see if it was causing the error..nope. I am getting a 500 error. Please help my poor eyes.

#!/usr/bin/perl
require "cgi-lib.pl";
&ReadParse;
#remove '$' character from price field
$in{'price'} =~ s/\$//g;
if ($in{'password'}eq"" || $in{'year'}eq"" || $in{'winery'}eq"" || $in{'wine'}eq"" || $in{'price'}eq"")
{
print &PrintHeader;
print <<&quot;PrintTag&quot;;
<HTML>
<HEAD>
<TITLE>Error!</TITLE>
</HEAD>
<BODY BGCOLOR=&quot;white&quot; TEXT=&quot;black&quot;>
<form action=&quot; method=&quot;POST&quot;>
<P>You forgot to fill in one or more of the fields below. Please try again.</P>
<P>Password: <BR>
<input type=&quot;password&quot; name=&quot;password&quot; value=&quot;$in{'password'}&quot;></P>
<P>Year: <BR>
<input type=&quot;text&quot; name=&quot;year&quot; value=&quot;$in{'year'}&quot;>
</P>
<P>Winery:<BR>
<input type=&quot;text&quot; name=&quot;winery&quot; value=&quot;$in{'winery'}&quot;>
</P>
<P>Wine:<BR>
<input type=&quot;text&quot; name=&quot;wine&quot; value=&quot;$in{'wine'}&quot;>
</P>
<P>Price:<BR>
<input type=&quot;text&quot; name=&quot;price&quot; value=&quot;$in{'price'}&quot;>
</P>
<input type=&quot;submit&quot;>
</form>
</body>
</html>
PrintTag
exit(0);
}
if ($in{'password'} ne &quot;test&quot;)
{
print &PrintHeader;
print <<&quot;PrintTag&quot;;
<HTML>
<HEAD>
<TITLE>Error!</TITLE>
</HEAD>
<BODY BGCOLOR=&quot;white&quot; TEXT=&quot;black&quot;>
<H1>Sorry, Charlie!</H1>
<BLOCKQUOTE>
I am sorry, but you do not have permission to modify this database.
</BLOCKQUOTE>
</BODY>
</HTML>
PrintTag
exit(0);
}
if (-e &quot;lock.fil&quot;)
{
print &PrintHeader;
print <<&quot;PrintTag&quot;;
<HTML>
<HEAD>
<TITLE>File in use</TITLE>
</HEAD>
<BODY BGCOLOR=&quot;white&quot; TEXT=&quot;black&quot;>
<H1>Try again!</H1>
<BLOCKQUOTE>
The database is in use. Please try again later.
</BLOCKQUOTE>
</BODY>
</HTML>
PrintTag
exit(0);
}
#everything is okay. Create lock file.
open(LOCK_FILE, &quot;>lock.fil&quot;);
#open, append record, and close database
open(FILE,&quot;>>data.txt&quot;) || die &quot;Can't find database\n&quot;;
print FILE &quot;$in{'year'}|$in{'winery'}|$in{'wine'}|$in{'price'}\n&quot;;
close(FILE);
#close lock file
close(LOCK_FILE);
#delete lock file
unlink(&quot;lock.fil&quot;);
#print database contents
print &quot;Location: #end of program
 
What is a '500' error? What does it mean???

Have you checked &quot;perl -c thisscript.pl&quot;

--Paul
 
> I have removed each different if statement
>to see if it was causing the error..nope.

If that didn't narrow it down, you must have more than one error. Try removing them all and then adding them in, one by one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top