Description:
displays the referers collected by referer_catch in a list, sorted by hits in.
Box Code:
# This box displays the referer information
# collected by referer_catch. It requires a
# table called 'referer' in your database;
# please see the comments in referer_catch.
my $title = "External links in";
my $content = "<UL>\n";
my ($rv, $sth) = $S->db_select({
WHAT => '*',
FROM => 'referer',
ORDER_BY => 'hits DESC'
});
while ( my $referers = $sth->fetchrow_hashref ) {;
# now to format and print them
#foreach my $ref ( %$referers ) {
# my $url = $ref->{url};
# my $hits = $ref->{hits};
my $url = $referers->{url};
my $hits = $referers->{hits};
if ( $url =~ /^-$/ ) {
$content .= qq{<LI>no referer ($hits)\n};
} else {
$content .= qq{<LI><A href="$url">$url</A> ($hits)\n};
}
}
$content .= "</UL>\n";
return $title, $content;
|