Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can I let the user vote for one time

Status
Not open for further replies.

mad01

Programmer
Jul 30, 2000
23
AE
I got a polling and I need to let the user vote just for one time, I used to store the last IP address, but it seems it's not the best way...some talked about cokies but not all browsers support them...any suggestions are welcomed :)
 
Hi nescafe,

Maybe you could try both.
Sure, storing IP's aint perfect, but it's the best way I know. Certainly if you combine it with a cookie that never expires.

Code:
<cfif IsDefined(cookie.someCookie)>
  <cfquery>
  some sqlstatement to check if IP exists
  </cfquery>
</cfif>

So, if the cookie doesn't exist, the query is executed and if the IP isn't stored you get the poll.
Meaning that if you have a cookie, CF only checks that.
Thus, the loading speed is still optimized.

Those who have cookies turned off will get the query everytime and a relatively slower page.
But then it's their own fault. B-)

Gtz,

Kristof
 
but do you think it's wise to store the IP of each user that participates in the polling?!? I was hopping to find some better way to do this
 
If the users of your website should really get the poll just once, then yes. I don't know a better way to make sure they haven't already answered the question.

If it doesn't matter that much, you might wanna use just cookies. So, those with cookies on will get it only once. The others will get it everytime. But then, ofcourse, you have no control over the score, so usually this isn't acceptable.

I know, it's a bit of a tough choice. Alas, there are always ways to cheat on polls. :-(

Gtz,

Kristof
 
>how can I let the user vote for one time?

you can't

if the user gets on the site via an anonymous proxy(anonymizer, ...), he always is able to vote as many times as he wants.

with this in mind, you should use the cookie-way. but i wouldn't let the user wait, if he has cookies disabled. just set a cookie with a random value to check if the cookies are on and if so, check the database if the user allready voted.

ezbinden

by the way: there is a chance to let every user vote just once, but this would go to far: let him register himself with his address and then send him a password via snail-mail. but even then he could cheat by using different addresses, but this is not the place to tell tales;-), i think
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top