Home : Products : Links 2.0 : Customization :

Products: Links 2.0: Customization: Re: [King Junko II] Toplist mod??: Edit Log

Here is the list of edits for this post
Re: [King Junko II] Toplist mod??
Also untested, but here's a program to update your links.db....
Code:
#!/usr/local/bin/perl
use CGI qw(:standard);
require "admin/links.def";
require "admin/links.cfg";

open (OLD, "admin/data/links.db") or die $!;
open (NEW, ">admin/data/links.db.new") or die $!;
while (<OLD>) {
my @tmp = ();
my $id = $1 if (/^\d+\|/);
my $hits = 0;
if (open (HIT, "admin/data/in/$id")) {
chomp ($hits = <HIT>);
close HIT;
unlink "admin/data/in/$id";
}
if ($hits) {
@tmp = split /\|/;
$tmp[$db_def{inHits}[0]] += $hits;
print NEW join "|", @tmp;
}
else {
print NEW;
}
}
close NEW;
close OLD;

rename("admin/data/links.db.new", "admin/data/links.db") or die $!;

You'll need to create a new field called "inHits" to %db_def and update your database accordingly.

--Philip
Links 2.0 moderator

Last edited by:

King Junko II: Mar 12, 2002, 3:46 AM

Edit Log: