I'm building a website which has a feature which ressembles SE's voting system. I'm trying to restrict users from voting more than once per post.
Currently, I was thinking of having a field in my user
mysql database that would keep a list of id
s (corresponding to posts) that the user has already voted on. Each time the user casts a vote, the array is checked against the current post's id
. If it is found an error message is displayed, if not the vote goes through and the id
is now part of the user's "already voted on" list.
This seems like an odd way of doing this. Is it an efficient method? What method would be better/best?