JP,
Made the change, but got a different error!
Code:
CGI ERROR==========================================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: syntax error at ./html.pl line 1685, near "$count_up = "$counter_dir/$rec{$db_key"
syntax error at ./html.pl line 1689, near "print qq|
Here's the updated subroutine code...
Code:
sub html_topten {
# --------------------------------------------------------
# The subroutine to display the Top Ten most visited records
opendir (TEMPDIR, "$counter_dir") or &cgierr("unable to open directory $counter_dir. Reason: $!");
@files = readdir(TEMPDIR); # Read in list of files in directory..
closedir (TEMPDIR);
FILE: foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
open (COUNTER, "<$counter_dir/$file") or &cgierr("unable to open file $counter_dir/$file. Reason: $!");
$count{$file} = int(<COUNTER> ); close COUNTER;}
foreach $key (sort {$count{$b} <=> $count{$a} } keys %count) {
push (@top_ten,$key);}&html_print_headers;
print qq| <html>
<head><title>$html_title: Top Ten Articles</title><style>A:hover {color: #AB0303}</style></head>
<body background="http://www.warningtrack.net/images/background.gif" link="#008000" vlink="#008000" alink="#FF0000">
<table width="400" align="center" valign="top">
<tr><td><img src="http://www.warningtrack.net/images/articlearchive.jpg"></tr></td>
</table>
|;
for ($i=0;$i<10 ;$i++) { $toparray .= "$top_ten[$i],";
}chop $toparray;
$i = 1;
print qq|"<table width=470 align="center" valign="top">";
foreach my $toplist (split(/,/,$toparray)) {
if ($i%2) {
print qq|<tr bgcolor="#DEDCDC">|;
}
else {
print qq|<tr bgcolor="#FFFFFF">|;
}
%rec = (&get_record($toplist));
$count_up = "$counter_dir/$rec{$db_key}";
open (COUNT, "<$count_up");
$countup = <COUNT>;
close COUNT;
print qq|<td width="385">
<a href="$db_script_link_url&$db_key=$rec{$db_key}&view_records=1&ww=1">$rec{'Title of Article'}</a>
</td>
<td width="85"><b>$countup views</b></td>
</tr>|;
++$i;
}
print "</table>";
&html_footer;print qq|</body></html>|;
}
Thanks!
Chris