yeah, now that I think about it, you would have to change the way the url.db file is built in order for this to work. this is NOT tested, use at your own risk.
in nph_build.cgi, find:
Code:
sub build_url_index {
# --------------------------------------------------------
# This routine builds a quick URL lookup database so the script
# does not have to search the links.db for every hit.
my $time = time();
my @values = ();
my $count = 0;
open (DB, "<$db_file_name") or &cgierr("unable to open database: $db_file_name.\nReason: $!");
open (URL, ">$db_url_name") or &cgierr("unable to open url index: $db_url_name. Reason: $!");
if ($db_use_flock) { flock (URL, 2) or &cgierr ("unable to get exclusive lock. Reason: $!"); }
LINE: while (<DB>) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
@values = &split_decode($_);
print URL "$values[$db_key_pos]$db_delim$values[$db_url]\n";
$count++;
}
close DB;
close URL;
# Build the count file used to do random links.
open (CNT, ">$db_hits_path/index.count") or &cgierr("unable to open count file: '$db_hits_path/index.count'. Reason: $!");
if ($db_use_flock) { flock (CNT, 2) or &cgierr ("unable to get exclusive lock on $db_hits_path/index.count. Reason: $!"); }
print CNT $count;
close CNT;
}
and replace it with:
Code:
sub build_url_index {
# --------------------------------------------------------
# This routine builds a quick URL lookup database so the script
# does not have to search the links.db for every hit.
my $time = time();
my @values = ();
my $count = 0;
open (DB, "<$db_file_name") or &cgierr("unable to open database: $db_file_name.\nReason: $!");
open (URL, ">$db_url_name") or &cgierr("unable to open url index: $db_url_name. Reason: $!");
if ($db_use_flock) { flock (URL, 2) or &cgierr ("unable to get exclusive lock. Reason: $!"); }
LINE: while (<DB>) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
@values = &split_decode($_);
print URL join ($db_delim, ($values[$db_key_pos], $values[$db_url], $values[$mirror_1], $values[$mirror_2])) . "\n";
$count++;
}
close DB;
close URL;
# Build the count file used to do random links.
open (CNT, ">$db_hits_path/index.count") or &cgierr("unable to open count file: '$db_hits_path/index.count'. Reason: $!");
if ($db_use_flock) { flock (CNT, 2) or &cgierr ("unable to get exclusive lock on $db_hits_path/index.count. Reason: $!"); }
print CNT $count;
close CNT;
}
where $mirror_1 and $mirror_2 are the field positions for the mirrors.
you could also use the same jump.cgi, just pass a parameter when you want to use one of the mirrors.
Code:
while (<URL>) {
/^$id$delim/ or next;
my @cut = split /$delim/, $_;
$goto = $cut[1 + ($in{mirror} =~ /^1|2$/ ? $in{mirror} : 0)];
last;
}
Philip
------------------
Limecat is not pleased.