Php – Create unique Poll/vote/survey in php


The unique poll/vote/survey i mean here is, user can only vote once. How do i do that? Track their ip? Login? Beside login, what else? (login is my last option, thus beside login, is there anything else I can do?)

Best Solution

To restrict the number of votes per person, you need to track the person.

Now there can be several ways to do that, and I'll list them with their pros and cons. Its for you to decide which method suits you best.

  1. login: this will offer you ultimate control. But its also a little cumbersome for the user. and its your last preference
  2. IP: how will you handle people behind web proxies? How about people with dialup connections and/or dynamic IPs?
  3. cookies: this is good for short term polls, so you can set the expiration of cookies to a time when the poll has ended. But, a potential drawback is that a user (contrasted with a luser) will know how to delete the cookies!
  4. openId: While this method is not too different from the 'login' method, this saves the user from registration (which really is the part that sux the most about logins).

EDIT: the problem with this situation is that you need to resolve the identity of the user. I think OpenID does this pretty darn well.