I don't know if you'd call it a "bug," but it's the way the script is set up. But it's easy to fix.
The easiest way is just to replace the entire "offending" subroutine. It's
sub validate_record in the db.cgi script. Replace it with the one below.
Code:
sub validate_record {
# --------------------------------------------------------
# Verifies that the information passed through the form and stored
# in %in matches a valid record. It checks first to see that if
# we are adding, that a duplicate ID key does not exist. It then
# checks to see that fields specified as not null are indeed not null,
# finally it checks against the reg expression given in the database
# definition.
my ($col, @input_err, $errstr, $err, $line, @lines, @data);
if ($in{'add_record'}) {
open (DB, "<$db_file_name") or &cgierr("error in validate_records.
unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); } LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
$line = $_; chomp ($line);
@data = &split_decode($line);
if ($data[$db_key_pos] eq $in{$db_key}) {
return "duplicate key error";
}
}
close DB;
}
foreach $col (@db_cols) {
if ($in{$col} =~ /^\s*$/) {
($db_not_null{$col}) and push(@input_err, "$col (Can not be left blank)");
}
else {
($db_valid_types{$col} && !($in{$col} =~ /$db_valid_types{$col}/)) and
push(@input_err, "$col (Invalid format)");
(length($in{$col}) > $db_lengths{$col}) and
push (@input_err, "$col (Too long. Max length: $db_lengths{$col})");
if ($db_sort{$col} eq "date") {
push (@input_err, "$col (Invalid date format)") unless &date_to_unix($in{$col});
}
}
}
if ($#input_err+1 > 0) {
foreach $err (@input_err) {
$errstr .= "<li>$err";
}
return "<ul>$errstr</ul>";
}
else {
return "ok";
}
}
------------------
JPD