If using Templates/Confirmation,
1. On add.html and add_error.html, use:
Code:
<input type="SUBMIT" value="SUBMIT" name="process_form">
2. On modify.html and modify_error.html, use:
Code:
<input type="SUBMIT" value="SUBMIT" name="modify_record">
3. In db_utils.pl, use:
Code:
if ($rec{'process_form'}) { # don't need to worry about duplicate if modifying (unless, however, URL is changed!)
$testURL = $in{'URL'};
$testURL =~ tr/A-Z/a-z/;
$testURL =~ s/www\.//; # disregards www.
$testURL =~ s/\///g; # ignores slashes
$testURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
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($_);
$dataURL = $data[$db_url];
$dataURL =~ tr/A-Z/a-z/;
$dataURL =~ s/www\.//; # disregards www.
$dataURL =~ s/\///g; # ignores slashes
$dataURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
if ($dataURL eq "$testURL") {push(@input_err, "duplicate URL error - already listed!");} # so let's add it as an error
}
close DB;
open (DB, "<$db_valid_name") or &cgierr("error in validate_records. unable to open db file: $db_valid_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
$dataURL = $data[$db_url];
$dataURL =~ tr/A-Z/a-z/;
$dataURL =~ s/www\.//; # disregards www.
$dataURL =~ s/\///g; # ignores slashes
$dataURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
if ($dataURL eq "$testURL") {push(@input_err, "duplicate URL error - already submitted!");} # so let's add it as an error
}
close DB;
}
So far, this is working okay for me. I use templates/confirmation. I've run the gamut of add, add_error, add_confirm, add_success, and modify, modify_error, modify_success, and it worked okay. Everything was either added, modified, or blocked correctly.
The wrinkle with modify.html/modify_error.html (name="modify_record") , as mentioned above by oktrg500 (Nina), should be added to the author's site.
Thanks for this mod!
Hope this helps.
------------------
ARMYNAVY.COM MilitarySurplus Ring
[This message has been edited by TrainedMonkey (edited November 30, 1999).]