In db.cgi, sub add_record, after
Code:
open (DB, ">>$db_file_name") or &cgierr("error in add_record.
unable to open database: $db_file_name.\nReason: $!");
if ($db_use_flock) {
flock(DB, 2) or &cgierr("unable to get exclusive lock on $db_file_name.\nReason: $!");
}
print DB &join_encode(%in);
close DB; # automatically removes file lock
add
Code:
open (EMAIL, ">>$db_script_path/email.db") or &cgierr("error in add_record.
unable to open database: $email.db.\nReason: $!");
if ($db_use_flock) {
flock(EMAIL, 2) or &cgierr("unable to get exclusive lock on $email.db.\nReason: $!");
}
print EMAIL $db_userid . $db_delim . $in{'Email'} . "\n";
close EMAIL; # automatically removes file lock
In sub modify_record, after
Code:
&auth_logging("modified record: $in{$db_key}") if ($auth_logging);
&html_modify_success;
add
Code:
$found_email=0;
$output_email = '';
open (EMAIL, "<$db_script_path/email.db") or &cgierr("error in modify_records.
unable to open db file: email.db.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
@lines = <EMAIL>; # Slurp the database into @lines..
close DB;
LINE: foreach $line (@lines) {
if ($line =~ /^$/) { next LINE; }
if ($line =~ /^#/) { $output .= $line; next LINE; } # Comment Line
chomp ($line);
@data = &split_decode($line);
if ($data[1] eq $in{$db_userid}) {
$output_email .= $in{$db_userid} . $db_delim . $in{'Email'} . "\n";
$found_email=1;
}
else {
$output_email .= $line . "\n";
}
}
unless ($found_email) {
$output_email .= $in{$db_userid} . $db_delim . $in{'Email'} . "\n";
}
open (EMAIL, ">$db_script_path/email.db") or &cgierr("error in modify_records.
unable to open db file: email.db.\nReason: $!");
if ($db_use_flock) {
flock(EMAIL, 2) or &cgierr("unable to get exclusive lock on
$email.db.\nReason: $!");
}
print EMAIL $output_email;
close EMAIL;
Has any of the other code I've given you worked? You have never said.
------------------
JPD
[This message has been edited by JPDeni (edited July 07, 1999).]