Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Hits update bug or was this meant to be ?

Quote Reply
Hits update bug or was this meant to be ?
Hello all,

If you use jump.cgi to a ID and later use jump.cgi to that same ID it will not be hits = hits + 1 (with same IP), no action is taken on hits. I though is this meant to be, because the same IP is used or is this a bug ?

So i followed the code in jump.cgi and watched the data database (mysqlman <--- i can suggest) and figured out that the table Build_Update and Hits_Track is used for keeping track of it and nph-build.cgi will update the counters.

In jump.cgi this code exist:

Code:

# Remove old hit tracks.
$db->do ("DELETE FROM Hits_Track WHERE TO_DAYS(NOW()) - TO_DAYS(created) > 2");

# Add this to the hit track table, and if we were able to add, then
# let's update/insert the hit total table.
$sth = $db->prepare ("SELECT 1 FROM Hits_Track WHERE LinkID = $id AND IP = '$ENV{'REMOTE_ADDR'}'");
$sth->execute();
if (! $sth->rows) {
$sth = $db->prepare ("SELECT 1 FROM Build_Update WHERE LinkID = $id");
$sth->execute();
($sth->rows) ?
$db->do ("UPDATE Build_Update SET Hits = Hits + 1 WHERE LinkID = $id") :
$db->do ("INSERT INTO Build_Update (LinkID, Hits, Votes, Rating) VALUES ($id, 1, 0, 0)");
$db->do ("INSERT INTO Hits_Track (LinkID, IP) VALUES ($id, '$ENV{'REMOTE_ADDR'}')");
}
}
If you following it logical I came to the conclusion that if a IP is logged in hits_track and the ID is the same it will NOT get to the code:

$db->do ("UPDATE Build_Update SET Hits = Hits + 1 WHERE LinkID = $id") :

So no hits = hits + 1 is done.

Only if you try the same ID again after 2 days it will update again or after you used nph-build.cgi Smile i quess!


Is this a bug or was it meant to be this way (or do i have to learn a lot about logical code Smile) ?


Well allready thanks.

Regards startpoint.


Quote Reply
Re: Hits update bug or was this meant to be ? In reply to
It is meant to prevent Link Owners from abusing reloading their sites via jump.cgi and putting their sites in the COOL page. I think this system works fine. What you might want to consider doing is adjusting the time period...edit the UNIX seconds to a shorter period of time. And I believe it is set for two or three hours NOT two days.

Regards,

Eliot Lee

Quote Reply
Re: Hits update bug or was this meant to be ? In reply to
Thanks for the reply AnthroRules.

Wow i am really understanding the code somehow :)....

Well i am still working on my project and there are still some brigdes to take, but i really like
LINKS and have learned a lot with your help .... thanx !!!

Regards startpoint.