Gossamer Forum
Home : Products : Links 2.0 : Customization :

Honest rating mod?

Quote Reply
Honest rating mod?
Anybody happen to have made a mod that records the voters IP and will not let him vote twice on the same link?

I really wanna push this rating thing, but I know that some jerk out there is going to abuse it by voting a bunch of times for one site. If it could quietly reject those votes coming back to back from the same IP it would cull these for me.

If anybody is feeling really bored and wants to write one that would be cool too. Smile

Daniel Alexander
Quote Reply
Re: Honest rating mod? In reply to
Its already in the rate.cgi file.
Code:
# Increase the rating.

if (open (HIT, "<$db_rates_path/$id")) {
my $input = <HIT>; chomp $input;
($votes, $old_rating) = split /\s/, $input;
chomp ($old_time = <HIT> );
chomp (@IP = <HIT> );
(($time - $old_time) > 21600) and (@IP = ());
foreach $ip (@IP) {
$ip eq $ENV{'REMOTE_ADDR'} and ($visited++ and last);
}
close HIT;

if (!$visited) {
push (@IP, $ENV{'REMOTE_ADDR'});
$votes = $votes + 1;
$rating = $rating + $old_rating;
open (HIT, ">$db_rates_path/$id") or &cgierr ("Can't open for output counter file. Reason: $!");
if ($db_use_flock) { flock (HIT, 2) or &cgierr ("Can't get file lock. Reason: $!"); }
local $" = "\n";
print HIT "$votes $rating\n$time\n@IP";
close HIT;
&site_html_rate_success;
}
else {
&site_html_rate_failure ("Sorry, you've already rated for this resource once recently.");
}
}
else {
open (HIT, ">$db_rates_path/$id") or &cgierr ("Can't increment counter file '$db_rates_path/$id'. Reason: $!");
print HIT "1 $rating\n$time\n$ENV{'REMOTE_ADDR'}";
close HIT;
&site_html_rate_success;
}
}
OR do you mean that you don't want the user to know if his multiple tries at being a jerk succeeded or not?
------------------
------------------------------------------
Lavon Russell
LookHard! Search
www.lh.yi.org
webmaster@lh.yi.org


[This message has been edited by Bmxer (edited August 17, 1999).]
Quote Reply
Re: Honest rating mod? In reply to
DOH!

I had no idea that was in there. heh

Yeah that's good enuf. I could care less if the jerk is notified or not.

I'm not very perl literate tho; could you tell me what exactly thats doing? Does it just stop 2 in a row from the same IP or is it more complex that? Thanks.

Daniel Alexander
Quote Reply
Re: Honest rating mod? In reply to
It basically logs the ip and names it hit, then logs the time and puts that with the ip address, then it converts the ip to hostname which this line is for :
Code:
$ip eq $ENV{'REMOTE_ADDR'} and ($visited++ and last);
Visited means that they were there and it shows the last time they submitted. Before that theres this line :
Code:
(($time - $old_time) > 21600) and (@IP = ());
which says that the time they have to wait has to be more than 21600 seconds for that ip. I think thats 360 minutes, which is 6 hours. If you wanted the user to think he was still submitting(somewhat tricking him) you can change this
Code:
&site_html_rate_failure ("Sorry, you've already rated for this resource once recently.");

to this
Code:
&site_html_rate_success ("The link has been rated.");
This will change the output page. Of course the script still knows its them and won't add it to the database but, they think it does.

------------------
------------------------------------------
Lavon Russell
LookHard! Search
http://www.lh.yi.org
webmaster@lh.yi.org
Quote Reply
Re: Honest rating mod? In reply to
this is Not a solution, a person can log off then log in and still be able to vote for the same link. some isp like aol gives you a different ip eveytime you visit a page.
also when you build the pages all ip# are deleted. let's say you voted at 9:00 and i rebuilt at 9:01 you still can vote again for the same link at 9:02.
there is no way to avoid this. if he wants to vote 100 times let him vote, if he is so stupid to care about something like this.
Quote Reply
Re: Honest rating mod? In reply to
One use for a more persistent logging of votes, aside from blocking ballot stuffing, is to allow registered users to go back and -change- their vote, as CGI Resource Index does. This mod would obviously require cookies to overcome the dynamic IP address issue. I am investigating the feasibility (technical and time-wise) of building this mod now.
Quote Reply
Re: Honest rating mod? In reply to
It is a solution because if voter thinks he's succeeding in flooding your database, he'd have no reason to sign off. You can keep a seperate logfile that will log ip's. Just put a log call at the bottom of the rate script. I don't even use the rate script anyway. Smile

------------------
------------------------------------------
Lavon Russell
LookHard! Search
www.lh.yi.org
webmaster@lh.yi.org

[This message has been edited by Bmxer (edited August 17, 1999).]