Gossamer Forum
Home : Products : Links 2.0 : Customization :

Mod: Automatic Duplicate URL Check

Quote Reply
Mod: Automatic Duplicate URL Check
Trying to use the above mod,

It works from the add.html template, when i try submiting from the add_error.html mod i get the following message.

"Unkown Tag: Title"
(comes from the add.cgi)

Code i have inserted is;

db_utils.pl -

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;
}

add.html

<input type="SUBMIT" value="SUBMIT" name="process_form">

add_error.html

<input type="SUBMIT" value="SUBMIT" name="process_form">

Any Ideas?

Help would be greatly appreciated.

Thanks
Michael

Subject Author Views Date
Thread Mod: Automatic Duplicate URL Check 0michael0 2896 Jan 18, 2001, 7:58 PM
Thread Re: Mod: Automatic Duplicate URL Check
Paul 2852 Jan 19, 2001, 5:07 PM
Thread Re: Mod: Automatic Duplicate URL Check
0michael0 2824 Jan 22, 2001, 7:20 PM
Thread Re: Mod: Automatic Duplicate URL Check
0michael0 2817 Jan 22, 2001, 7:26 PM
Thread Re: Mod: Automatic Duplicate URL Check
0michael0 2813 Jan 22, 2001, 8:06 PM
Post Re: Mod: Automatic Duplicate URL Check
Stealth 2797 Jan 22, 2001, 9:29 PM