I figured out one problem I posed on this board awhile back - how to compile a list of the top hit listings - in my case, top 2. I've added the following to the nph-build.cgi script at the beginning of the 'main' subroutine:
@rinfo = <FILE>;
close(FILE);
$rdata = @rinfo;
for ($ra = 0; $ra < $rdata; $ra++) {
chomp(@rinfo[$ra]);
($rID[$ra], $rURL[$ra], $rhits[$ra], $rmisc[$ra]) = split(/\|/,@rinfo[$ra]);
}
for ($ra = 0; $ra < $rdata; $ra++) {
for ($rb = ($rdata - 1); $rb > $ra; $rb--) {
if ($rhits[$rb] > $rhits[$rb-1]) {
$rtemp3 = $rhits[$rb-1];
$rhits[$rb-1] = $rhits[$rb];
$rhits[$rb] = $rtemp3;
$rtemp4 = $rURL[$rb-1];
$rURL[$rb-1] = $rURL[$rb];
$rURL[$rb] = $rtemp4;
}
}
}
$referer1=$rURL[0];
$referer2=$rURL[1];
Yeah
This gives me the daily (based on previous day results) top 2 which are linked at the top of each index.html page (generated by site_html.cgi). And of course this can very easily be modified to write X number top sites to a file.
Now, my other question - can anyone help me convert (standardize) the hits to daily hits. This is critical in my case as listings are ordered in descending numerical order from highest hits to lowest hits.
Thanks... Dan
Code:
open(FILE, "/home/serve/links/scripts/addlink/admin/data/url.db"); @rinfo = <FILE>;
close(FILE);
$rdata = @rinfo;
for ($ra = 0; $ra < $rdata; $ra++) {
chomp(@rinfo[$ra]);
($rID[$ra], $rURL[$ra], $rhits[$ra], $rmisc[$ra]) = split(/\|/,@rinfo[$ra]);
}
for ($ra = 0; $ra < $rdata; $ra++) {
for ($rb = ($rdata - 1); $rb > $ra; $rb--) {
if ($rhits[$rb] > $rhits[$rb-1]) {
$rtemp3 = $rhits[$rb-1];
$rhits[$rb-1] = $rhits[$rb];
$rhits[$rb] = $rtemp3;
$rtemp4 = $rURL[$rb-1];
$rURL[$rb-1] = $rURL[$rb];
$rURL[$rb] = $rtemp4;
}
}
}
$referer1=$rURL[0];
$referer2=$rURL[1];
Yeah
Now, my other question - can anyone help me convert (standardize) the hits to daily hits. This is critical in my case as listings are ordered in descending numerical order from highest hits to lowest hits.
Thanks... Dan

