#!/usr/bin/perl
###############################
# Hot Links Pro 3 hotlinks.cgi
# Created by Mike Ramirez
# Nothing below here is configurable
###############################
require './source/headerfooter.pl';
require './source/config.pl';
require './source/banner.pl';
require './source/linkbuild.pl';
require './lang/langset.pl';
###############################
use CGI;
my $q = CGI->new;
print $q->header;
&header;
print <<"HTML";
|
HTML
if ($displayadverts == 1) {&showall}
print <<"HTML";
|
HTML
##########
opendir (DIR, "$hitfilespath/");
@hotlinks = grep (!/^\.\.?$/, readdir (DIR));
closedir DIR;
foreach $hot (@hotlinks) {
chomp($hot);
my $filetolock = $hot;
my $tempfile = $filetolock . ".lock";
open (LOCK, ">$hitfilespath/$tempfile");
if ($useflock == 1) {flock (LOCK, 2)}
open (FILE, "$hitfilespath/$hot");
$hitcount = ;
close(FILE);
close(LOCK);
unlink ("$hitfilespath/$tempfile");
if ($hot =~ m/.hittotal/i) {
$hot =~ s/.hittotal//i;
$hithash{$hot} = "$hitcount|$hot";
}
}
foreach $value (sort values %hithash) {
push(@hitarray, $value);
}
@hitarray = sort {$b <=> $a} @hitarray;
my $filetolock = $datafilepath;
my $tempfile = $filetolock . ".lock";
open (LOCK, ">$tempfile");
if ($useflock == 1) {flock (LOCK, 2)}
open (FILE, "$datafilepath");
@linklist = ;
close(FILE);
close(LOCK);
unlink ($tempfile);
$hotcount = 0;
foreach $line (@hitarray) {
chomp($line);
@temparray = split(/\|/, $line);
if ($temparray[0] >= $hotcutoff) {$hotcount++}
}
print qq| $hltext1 - $hotcount $hltext2 |
|;
foreach $line (@hitarray) {
chomp($line);
@temparray = split(/\|/, $line);
if ($temparray[0] >= $hotcutoff) {
foreach $link (@linklist) {
chomp($link);
@linkinfo1 = split(/\|/, $link);
if ($linkinfo1[0] == $temparray[1]) {
$linkinfo = $link;
}
}
@linkinfo = split(/\|/, $linkinfo);
$addedon = $linkinfo[8];
$addedon =~ s/_/ /g;
$sendto = $linkinfo[3];
$sendto =~ s/([\W])/"%" . uc(sprintf("%2.2x",ord($1)))/eg;
&dolinkbuild;
}
}
############
print <<"HTML";
HTML
&footer;