12-08-2008, 06:55 PM
I'm pretty new to php and the forums, but I have a dying question and can't seem to find an answer that works for me!
Bascially I am setting up a voting poll and want to know if there is anyway to allow only 1 person to vote, to avoid people voting load of times.
12-08-2008, 07:15 PM
Find a pre-made script ...
like this: http://www.hscripts.com/scripts/php/starrating.php
or like this: http://www.hscripts.com/scripts/php/licensed/yes-no-rating.php
Customize it for your own use (if needed).
Not having to re-invent a script (use an existing one) is probably the fastest way to go.
12-09-2008, 09:58 AM
Will give that a try!
12-10-2008, 02:34 AM
No you can't, not for anonymous users anyway.
The only way to actually control this is to create a user system to track people. There is no reliable way using PHP to identify a specific user.
That being said, there are a few ways to kinda help. Cookies, ip addresses, etc. For functionality, just use one of the systems from mlseim's links.
12-10-2008, 04:32 AM
If you have a login system on your website then it is easy.
When a new poll is created, when it inserts into the database, also update the users poll field to 0. Then when they vote it changes to 1. Block voting if users poll is equal to 1.
If you have multiple polls going, you can put like poll1, poll2, poll3 in your users table, and update it by poll id.
12-10-2008, 11:47 AM
Cheers guys. unfortunatley I dont have a login system, but I have heard of a way to do it using the cokies, but the only problem I might face is that people may clear their cookie files. I think IP is the one here! I'm gonn ahave a scout around and see what I can find!!!
12-10-2008, 02:33 PM
Ok then yes IP will be the way to go. If they have a router they can get a new IP in minutes.
12-10-2008, 03:25 PM
Voting polls are like web page hit counters.
They can show any number, they are meaningless, and nobody really cares about them.
Questions misread, answers skewed ... and reliant on demographics.
12-16-2008, 06:58 PM
Okay..sorted this now..decided to use a cookie..alllows only one person per pc to vote..thats really the only way i could narrow it down!