jcrow,
Code:
#!/usr/local/bin/perl
# Script for putting Top Ten Sites in other LINKS associated pages.
# Change the permission of this script to 755.
# Change the path to the links.cfg file if you need to.
# Use it in the following manner:
# <!--#exec cgi="/cgi-bin/links/topsites.cgi"--> in SSI capable
# pages.
###########################################################
# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script locatio
n: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script locatio
n: Windows \
require "admin/links.cfg"; # Change this to full path to links.c
fg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set
correctly.";
exit;
}
#========================================================
open (NAME,"<$db_file_name") or &cgierr("error in numlinks. unable to open database:$db_links_name.\nReason: $!");
LINE: while(<NAME> ){
next LINE if (/^#/);
next LINE if (/^\s*$/);
@data=split (/\|/);
$tophits{$data[0]} = $data[8];
$name{$data[0]} = $data[1];
$url{$data[0]} = $data[2];
}
close (NAME);
my $count=1;
foreach $field (sort { $tophits{$b} <=> $tophits{$a} } keys %tophits) {
if ($count <= 10) {
$output .= "$count. <a href=\"$url{$field}\">$name{$field}</a><br>\n";
}
$count++;
}
return $output;
}
Then add the following codes in your SSI enabled pages:
Code:
<!---#exec cgi="/cgi-bin/links/topsites.cgi"-->
Regards,
------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums