I'm sending you my code and maybe you can help to fix it. If you do not have time, I understand I'm going to keep trying to get it to work. Thanks so much for all of your help, I would not even be this far with out it.
#!/usr/bin/perl -w
# Constants for flock
#
$LOCK_SH = 1;
$LOCK_EX = 2;
$LOCK_NB = 4;
$LOCK_UN = 8;
#
# The database file name
# Always has to have FULL UNIX path in order to work.
# Just in case you're adapting this for another purpose.
#
$db_file = "/usr/local/apache/share/htdocs/helplog/helplog.dat";
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
# Load the FORM variables
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
# Edit line item.
&db_write;
# Thank the user and acknowledge
# the feedback generating a new page. (and then exit)
#
&thank_you;
}
&sub_error;
sub sub_error {
# Format an error message for the user
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Request Form Error</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<H1>Request Form Error</H1>\n";
print "<HR>\n";
print "<P>\n";
print "Form input was not proccessed. Please mail your ";
print "remarks to $FORM{submitaddress}\n";
print "</BODY>\n";
print "</HTML>\n";
}
sub thank_you {
# Generate the "thank you" page for after they have submitted
# their information.
# The information comes from the variable created in the
# database subroutine.
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Thank You!</TITLE>\n";
print "</HEAD>\n";
print "<BODY BGCOLOR=#FFFFFF TEXT=#000000>\n";
print "<H1>Thank You!</H1>\n";
print "\n";
print "<P>\n";
print "<H3>Your log information has been updated.";
print "<P>\n";
print "Your log entry change is as follows:\n<table width=\"60%\"><tr><td><pre>$new</pre></td></tr></table>$
print "<P>\n";
print "If this information is incorrect please e-mail your corrections to: \n";
print "<A HREF='mailto:maiac\@gilmore.ca'>maiac\@gilmore.ca</A>.\n";
print "<P>\n";
print "</BODY>\n";
print "</HTML>\n";
exit;
}
sub db_write {
# open the database file in read mode.
# don't forget to close it after you are done
$count = 1000;
open(DATABASE, "<$db_file"

;
$count++ while<DATABASE>;
close(DATABASE);
# Open database for append and lock it to ensure exclusive access.
open(DATABASE, ">>$db_file"

;
flock(DATABASE, $LOCK_EX);
# Create some variables for the information coming in
$old=$FORM{idnum};
# Build new record.
$new .= "$count\t$old\t$FORM{date}\t$FORM{user}\t$FORM{what}\t";
$new .= "$FORM{why}\t$FORM{machine}\t";
$new .= "$FORM{filemodified}\t$FORM{status}\t\n";
# Pipe everything except the line in question into an array.
# @stuff = <DATABASE>;
# @stuff = splice(@stuff, $old, \n);
# Dump the now changed information back into the file
# @stuff =(DATABASE, $db_file);
# Seek the line number in question in the original database
# seek(DATABASE, $idnum, 1);
# Add the new information to the current database in the same
# location as the previous data.
print DATABASE $new;
# Unlock the file for others then close it
# to finish off.
# Exit takes place in the thank_you subroutine.
flock(DATABASE, $LOCK_UN);
close(DATABASE);
}
Searchlog.
#!/usr/bin/perl -w
if ($ENV {'REQUEST_METHOD'} eq 'POST') {
# Get the information to search for:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split name/value pairs
#$pairs = split(/&/, $buffer);
# Load the variables from the form
foreach $pair (split(/&/, $buffer)) {
# Split the values from the form
($key, $value) = split(/=/,$pair);
# Remove "+" signs
$key =~ tr/+/ /;
$value =~ tr/+/ /;
# Allows for either Upper or lower case
$key=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$parameters{$key} = $value;
}
# Open the file that will be used to display the information
system(": > /usr/local/apache/share/htdocs/helplog/temp.dat"

;
open(TEMP, ">>/usr/local/apache/share/htdocs/helplog/temp.dat"

;
# Open the helplog file that contains the entries
open(FILE, "/usr/local/apache/share/htdocs/helplog/helplog.dat"

;
while($line = <FILE>)
{
($num,$groupid,$date,$user,$what,$why,$machine,$filemodified,$status) =$
if ($num eq $parameters{'num'})
{
@fields = split(/\t/, $line);
$link = '<A HREF="'//help/itdept/editlog.cgi?num=.$fields[0].'">Edit</a$
print TEMP $link;
print TEMP $line;
}
if ($groupid eq $parameters{'groupid'})
{
@fields = split(/\t/, $line);
$link = '<A HREF="' .$fields[0]. '">Edit</a>';
print TEMP $link;
print TEMP $line;
}
elsif ($date eq $parameters{'date'})
{
@fields = split(/\t/, $line);
$link = '<A HREF="' .$fields[0]. '">Edit</a>';
print TEMP $link;
print TEMP $line;
}
elsif ($user eq $parameters{'user'})
{
@fields = split(/\t/, $line);
$link = '<A HREF="' .$fields[0]. '">Edit</a>';
print TEMP $link;
print TEMP $line;
}
elsif ($what eq $parameters{'what'})
{
@fields = split(/\t/, $line);
$link = '<A HREF="' .$fields[0]. '">Edit</a>';
print TEMP $link;
print TEMP $line;
}
elsif ($why eq $parameters{'why'})
{
@fields = split(/\t/, $line);
$link = '<A HREF="' .$fields[0]. '">Edit</a>';
print TEMP $link;
print TEMP $line;
}
elsif ($machine eq $parameters{'machine'})
{
@fields = split(/\t/, $line);
$link = '<A HREF="' .$fields[6]. '">Edit</a>';
print TEMP $link;
print TEMP $line;
}
elsif ($filemodified eq $parameters{'filemodified'})
{
@fields = split(/\t/, $line);
$link = '<A HREF="' .$fields[0]. '">Edit</a>';
print TEMP $link;
print TEMP $line;
}
elsif ($status eq $parameters{'status'})
{
@fields = split(/\t/, $line);
$link = '<A HREF="' .$fields[0]. '">Edit</a>';
print TEMP $link;
print TEMP $line;
}
elsif ($status eq $parameters{'status'})
{
@fields = split(/\t/, $line);
$link = '<A HREF="' .$fields[0]. '">Edit</a>';
print TEMP $link;
print TEMP $line;
}
}
close(TEMP);
close(FILE);
# Generate the page
&thank_you;
# Error sub routine just in case script blows up.
&error;
sub thank_you
{
open (TEMP, "/usr/local/apache/share/htdocs/helplog/temp.dat"

;
@line = <TEMP>;
# Generate the "info" page that spews all the information requested
# in the search.
print "<Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Results of your search</TITLE>\n";
print "</HEAD>\n";
print "<BODY>";
print "<H1>Results</H1>\n";
print "\n";
print "<P>\n";
print "Your results from the search are as follows:\n<TABLE><TR><TD><PR$
print "<P>\n\n";
print "<BR>";
print "<A HREF='
the Database</A>.$
print "<BR><BR><BR>";
print "If you encountered problems with this search, or have questions $
print "<A HREF='mailto:maiac\@gilmore.ca'>Webmaster</A>.\n";
print "<P>\n";
print "</BODY>\n";
print "</HTML>\n";
exit;
close (TEMP);
}
sub error
{
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Request Form Error</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<H1>Request Form Error</H1>\n";
print "<HR>\n";
print "<P>\n";
print "Form input was not processed. Please try again.";
print "</BODY>\n";
print "</HTML>\n";
}
}
[sig][/sig]