So, I implemented a voting system
http://ad1987.blogspot.com/2009/02/reddit-style-voting-with-php-mysql-and.html
on my website. It works perfectly, except for the fact that each time you vote up or vote down it can add anywhere from 1-5 or so votes. The source code is pretty much the same to that on that website, so if you’d like to see it, please check it out there. For a live example:
http://www.campusbasement.com/cornell/entertainment/articles/927/electro-is-taking-over-the-world
Thanks
votes.php: http://pastie.org/1369778
I had a somewhat similar problem. Chrome for some still unknown reason downloaded each page twice, so the views counter was getting +2 each time.
I suppose you have a user table with user_id, and an article table with article_id.
So you can implement the check connecting this two tables with many-to-many relation. You should create an intermediate table with fields post_id – the post being voted for, user_id and optionally a value field (if the user decides to change his vote).
The first two fields might be a composite primary key.
So when user votes, you search for the row with the same post and user ids. If there are non – you add it.