Gossamer Forum
Home : Products : Links 2.0 : Installation -- Windows :

Re: Error: Unable to Add Link?

Quote Reply
Re: Error: Unable to Add Link? In reply to
Hi Eliot,

The only mod I added was the "3 Level of New Graphics" mod. Here's the info you asked about:

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);
my (%rec) = @_;

if ($rec{'add_record'}) { # don't need to worry about duplicate key if modifying
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;
chomp;
@data = &split_decode($_);
($data[$db_key_pos] eq $rec{$db_key}) and return "duplicate key error";
}
close DB;
}
foreach $col (@db_cols) {
if ($rec{$col} =~ /^\s*$/) { # entry is null or only whitespace
($db_not_null{$col}) and # entry is not allowed to be null.
push(@input_err, "$col (Can not be left blank)"); # so let's add it as an error
}
else { # else entry is not null.
($db_valid_types{$col} && !($rec{$col} =~ /$db_valid_types{$col}/)) and
push(@input_err, "$col (Invalid format)"); # but has failed validation.
(length($rec{$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($rec{$col});
}
}
}
if ($#input_err+1 > 0) { # since there are errors, let's build
foreach $err (@input_err) { # a string listing the errors
$errstr .= "<li>$err"; # and return it.
}
return "<ul>$errstr</ul>";
}
else {
return "ok"; # no errors, return ok.
}
}


See anything?

Thanks!

Mike
Subject Author Views Date
Thread Error: Unable to Add Link? Mikeach 6980 May 5, 2000, 4:03 AM
Post Re: Error: Unable to Add Link?
Mikeach 6848 May 6, 2000, 3:11 AM
Post Re: Error: Unable to Add Link?
Stealth 6850 May 7, 2000, 10:51 PM
Post Re: Error: Unable to Add Link?
Mikeach 6867 May 8, 2000, 1:47 AM
Post Re: Error: Unable to Add Link?
Stealth 6842 May 8, 2000, 8:33 AM
Post Re: Error: Unable to Add Link?
Mikeach 6878 May 8, 2000, 10:40 AM
Post Re: Error: Unable to Add Link?
Stealth 6856 May 8, 2000, 11:04 AM
Post Re: Error: Unable to Add Link?
Mikeach 6847 May 8, 2000, 11:46 AM
Post Re: Error: Unable to Add Link?
Stealth 6853 May 8, 2000, 12:17 PM
Post Re: Error: Unable to Add Link?
Mikeach 6852 May 8, 2000, 12:31 PM
Post Re: Error: Unable to Add Link?
Mikeach 6858 May 8, 2000, 12:39 PM
Post Re: Error: Unable to Add Link?
Mikeach 6844 May 8, 2000, 1:55 PM
Post Re: Error: Unable to Add Link?
Stealth 6851 May 8, 2000, 2:15 PM
Post Re: Error: Unable to Add Link?
Mikeach 6858 May 8, 2000, 2:30 PM
Post Re: Error: Unable to Add Link?
Stealth 6862 May 8, 2000, 2:43 PM
Post Re: Error: Unable to Add Link?
Mikeach 6847 May 8, 2000, 3:25 PM
Post Re: Error: Unable to Add Link?
Stealth 6863 May 8, 2000, 5:22 PM
Post Re: Error: Unable to Add Link?
Mikeach 6855 May 9, 2000, 3:32 AM
Post Re: Error: Unable to Add Link?
Stealth 6863 May 9, 2000, 5:53 AM