Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
06-26-2012, 01:19 PM #1
- Join Date
- Oct 2010
- Thanked 0 Times in 0 Posts
Limiting votes by users without an account
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?
06-26-2012, 08:28 PM #2
- Join Date
- Apr 2012
- St. Louis, MO
- Thanked 101 Times in 101 Posts
Option a is easiest to implement, and easiest to get around. Option b is useless unless you can guarantee that all visitors aren't on ISPs that force IP address changes.^_^
If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
* The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
Users who have thanked WolfShade for this post: