AKalair Posted March 30, 2009 Share Posted March 30, 2009 Hello, I am creating a site where people can vote for a podcast if they like it. The number of votes received is stored in a table as are all the members details. Once a member has voted how can I prevent them from voting again. I could use cookies but it will get messy if they vote for lots of podcasts and could easily be got around. Any Ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/151776-preventing-people-from-voting-multiple-times/ Share on other sites More sharing options...
ober Posted March 30, 2009 Share Posted March 30, 2009 Create a table in the database that is nothing more than: PollId | userId Then when they vote on a poll, add their user id to this table associated with the poll they are voting on. Then before they are allowed to vote, check this table to see if they already voted there. You can take it one step further and only show the results of the poll if they already voted on it. Link to comment https://forums.phpfreaks.com/topic/151776-preventing-people-from-voting-multiple-times/#findComment-796976 Share on other sites More sharing options...
Brian W Posted March 30, 2009 Share Posted March 30, 2009 Are you storing each vote individually and doing the math everytime someone requests the page or are you simply doing the math then updating one field with the newest vote data? Link to comment https://forums.phpfreaks.com/topic/151776-preventing-people-from-voting-multiple-times/#findComment-796980 Share on other sites More sharing options...
AKalair Posted March 30, 2009 Author Share Posted March 30, 2009 Im storing the votes in a table. Then when someone votes incrementing the value in the table by 1. Link to comment https://forums.phpfreaks.com/topic/151776-preventing-people-from-voting-multiple-times/#findComment-796985 Share on other sites More sharing options...
Brian W Posted March 30, 2009 Share Posted March 30, 2009 Oh, then your will need to use ober's method. Link to comment https://forums.phpfreaks.com/topic/151776-preventing-people-from-voting-multiple-times/#findComment-796989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.