I'm working on a site that allows users to vote on different items. Right now I have it so after they vote the buttons are disabled until the page refreshes. I want to come up with a solution so I can keep users from voting more than once. Currently, I'm storing votes in a mysql database, but I'm not storing who voted.
I have 3 different types of users.
1) members logged in
2)members not logged in
3)site visitors with no user account
I'm trying to think of the best ways to handle each type.
I know for my logged in users I can use their user_id and check if they have voted before for that specific element.
But how should I handle the other two (2 & 3). Here is what I'm thinking...
a) Should I use set a cookie for each of their votes. Then, loop through all of their vote cookies each time they vote before adding the vote to the database? There could be hundreds of votes. If they have cookie turned off this would not work.
b)maybe grab their ipaddress somehow and store that in the database. Then query and loop through all votes looking for a duplicate ipaddress/item combo?
c)something more efficient?