One Vote per IP
I have a application where users can vote for submission, and i want to make sure users dont spam it, how can i make this one vote per IP?
var clicks2 = 0;
document.getElementById('clicked2').value = ++clicks2;
document.write('<a href="#" onclick="linkClick2()" class="vote_link">Vote for this Submission</a>');
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
how would i go about doing that tho?
Originally Posted by Philip M
Ask in the PHP forum. You will need to keep a database of IP addresses that have voted.
Originally Posted by Hydrian
Or ASP forum or Java forum...depending on what kind of server-side language you want to use.
It isn't exactly going to be fair though - where 1000 people are sharing the same IP only the first of them to vote will have their vote accepted while someone else whose IP address changes regularly will still be able to cast multiple votes.
Of course that may not matter depending on the requirements.
use the ip as the primary key of a 2-col poll table.
the vote is an integer 0-5 or whatever.
i use zero here to 'cancel' a vote for a given ip. looks like #2 is winning...
in this way, someone can update their vote, but they can't vote more times than you can reasonably screen against without sign-in.
yes, they can vote at the coffee shop, on their phone, and at work, but they can't sit there and vote 500 times in a row...
But Felgall's point needs to be considered as well: Many people use large-scale ISPs or are on machines behind a company firewall. In such cases, you can have hundreds or even thousands of users (e.g., Microsoft has only a handful of outward facing IP addresses for all its thousands of emploeyees) with the same IP address. So if one person using that ISP or from that company votes, nobody else will be able to.
Now, maybe you don't care about these people, and that's really fine. Just be aware that the problem exists.