Allow multiple votes from same IP in Ajax Voting Script

Place for comments, problems, questions, or any issue related to the JavaScript / PHP scripts from this site.
purcelly
Posts: 5

Allow multiple votes from same IP in Ajax Voting Script

Sorry, one last one from me as I just keep breaking the JS, it's not my stong point.

Is there a way to allow multiple votes from the same IP address, in the Ajax Voting script?
One of the pages we want to use this on is an internal website so all the PCs share an IP address and once the first person has voted, no one else can vote.

It doesn't matter if someone can vote more than once either, just that it's not restricted.

Admin
Hi
If it doesn't matter that someone can vote multiple times the same item; make these changes in the "class.voting.php" file:

1. Line 247 (in votstdyDb(), for mysql). Replace:

Code: Select all

return $votstdy;
With this code:

Code: Select all

return array(); 
2. Line 269 (in votstdyTxt()). Replace:

Code: Select all

return $re;
With this code:

Code: Select all

return array('all'=>array(), $this->tdy=>array()); 

purcelly
Sorry to be a pain, that worked perfectly in allowing to vote from different PCs thanks!

It's made the "Thanks" message disappear really quickly, is there anyway that can be extended to show for longer? Or indefinitely after a vote.

If I have four buttons on one page is the code simple enough to change to only allow someone to vote on one of them, not all four, but still allowing any PC on the network to do it? If not that's fine.

Admin
1. You can display an alert box with the "Thanks" message. For that, replace this two lines of code in voting.js (line 66-67):

Code: Select all

ivot.parentNode.innerHTML = '<i><b>Thanks</b></i>';
votAjax(elm, vote);
With this:

Code: Select all

votAjax(elm, vote);
alert('Thanks');
2. In the readme.php page it is:
- If you want the user to can vote only a single item in one day, change the value of the constant NRVOT from 0 to 1.
define('NRVOT', 0);
So, set the value of NRVOT to 1, in voting.php.

purcelly
This worked perfectly! You're a star, thank you!

Similar Topics