I've created a poll system, only logged in users may vote. I have a table where I store a foreign key to users and polls like this:
poll_voters
| ref_user_id | ref_poll_id |
When a user votes I check if the user id exists with the current poll in the table. If it does, the user has already voted.
I'm wondering if I should do this on every page load to know whether to display vote forms, or the result (in case the user already has voted). Another way would be to have a session that says if the user has voted or not. And when he log in I would need to do the check and set the session of course.
What do you think I should do?