Feedback correction
It is rather a general strategy that can be combined with many other methods. Do not let the spammer know if he succeeds.
You can either completely hide current results, only show percentages without an absolute number of votes or delay the display of votes.
- Pro: good against all methods
- Con: if the fraud is massive, percentage display and delay will not be effective.
Voting Mark
Also a general strategy. If you have reason to believe that the vote is being taken by a spammer, count their vote and mark it invalid and delete the invalid votes at the end.
- Pro: good against all detected spam attacks
- Con: echoes the vote, harder to set up, false positives
security code
Use CAPTCHA . If your Captcha is broken, use the best.
- Pro: good for all automated scripts.
- Con: useless against pharygulation
IP check
Limit the number of votes that an IP address can use for a period of time.
- Pro: Good against random guys who constantly get into F5 in their browser.
- Pro: easy to implement
- Con: it's useless against pharyngulation and developing scripts that use proxies.
- Con: The IP address is sometimes displayed to different users.
Referrer Check
If you assume that one user maps one IP address, you can limit the number of votes for that IP address. However, this assumption is usually true only for private households.
- Pro: easy to implement
- Pro: Good versus simple pharyngulation to some degree
- Con: very easy to get around automated scripts
Email Verification
Use email confirmation and allow only one vote per email. Check your database manually to see if they use emails.
Please note that you can add +foo to your username at the email address. username@example.com and username+foo@example.com will send mail to the same account, so remember that when checking who has already voted.
- Pro: good against simple spam scripts
- Con: harder to implement
- Con: Some users will not like this.
HTML form randomization
Randomize the selection order. It may take some time to get to know them.
- Pro: nice to have anyways
- Con: Once discovered, very easy to get around.
Https
One way to fake a vote is to capture an HTTP request from a live browser such as Firefox, and simulate it using a script, it is not so easy when you use encryption.
- Pro: nice to have anyway
- Pro: good versus very simple scripts
- Con: harder to configure
Proxy Check
If the spammer voted through a proxy, you can check the X-Forwarded-For header.
- Pro: well suited to more advanced proxy scripts
- Con: some legitimate users may be affected
Cache check
Try to check if the client is loading all unused resources. Many spam bots do not. I have never tried this, I just know that this is usually not checked by voting sites.
An example would be the embedding <img src="a.gif" /> in your html, with a.gif being a 1x1 pixel image. Then you must set the http header for the GET /a.gif request GET /a.gif using Cache-Control "no-cache, must-revalidate" . You can set the http headers in Apache with your .htaccess file like this . (thanks Jaco)
- Pro: an unusual method, as far as I know.
- Con: a little harder to set up
[Edit 2010-09-22]
Evercookie
- The so-called evercookie can be useful for tracking spammers in a browser.