Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent users from voting more than one time?

I want to prevent users from voting more than one time in my website, I used two methods to do that, but no one do that well !!

  1. using cookie.
    the problem : users can delete the cookie and return to vote again and again ..

  2. using database table.
    The problem : users shouldn't forced to register in my website !

So, How i can solve this problem ?

like image 917
Dot Freelancer Avatar asked Dec 28 '11 15:12

Dot Freelancer


2 Answers

You have your two answers, you need to decide which is best. No option is going to be bulletproof. It's all about slowing them down, and what level of effectiveness is acceptable for you.

A cookie is generally the acceptable way to do this. Yes, cookies can be cleared, but if the desire to prevent duplicate voting is that important, than registration is the only effective way to prevent it. Any other mechanism could probably be beaten by those that want to. You could use something like Evercookie, but I don't generally think it's a good practice to do so. If you make your registration process simple, but effective, some users will do that.

An IP address is just as flawed as most redisential IPs are not statically assigned. Someone could reset their modem, and get a new IP address. Or worse, someone could reset their modem, get an IP address that has already visited the site, and be unable to vote. Another scenario is users behind NAT. If 200 people are sharing an IP with NAT, then only one of them will be able to vote.

You could get creative with the IP address though. Keep using the cookie, because that will be effective. If you start detecting multiple votes from the same IP address (because they cleared their cookies), display a CAPTCHA. If it isn't someone trying to abuse the system, then they still get the opportunity to vote. This will help defeat automated voting, and slow down users enough that abusing your voting system isn't worth their time. This as well, can be defeated, it's what level of effectiveness is acceptable to you. Even registration isn't purely 100% effective, but probably the most effective. What would stop someone from registering many times with different email addresses?

like image 189
vcsjones Avatar answered Nov 15 '22 09:11

vcsjones


I dont think you have many options as you are not forcing users to register. You need to use session or cookies. As pointed out in comments you can also check the IP Address. But if intended audience uses dynamic IP address assigned by their ISP, then this solution also failed.

If possible you can ask user to registered with their facebook/google id, like stackoverflow is doing

like image 37
Aniruddha Avatar answered Nov 15 '22 09:11

Aniruddha