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.
Allow multiple votes from same IP in Ajax Voting Script
-
- Posts:5
Allow multiple votes from same IP in Ajax Voting Script
Admin
Posts:805
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:
With this code:
2. Line 269 (in votstdyTxt()). Replace:
With this code:
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;
Code: Select all
return array();
Code: Select all
return $re;
Code: Select all
return array('all'=>array(), $this->tdy=>array());
purcelly
Posts:5
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.
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
Posts:805
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):
With this:
2. In the readme.php page it is:
Code: Select all
ivot.parentNode.innerHTML = '<i><b>Thanks</b></i>';
votAjax(elm, vote);
Code: Select all
votAjax(elm, vote);
alert('Thanks');
So, set the value of NRVOT to 1, in voting.php.- 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);
purcelly
Posts:5
This worked perfectly! You're a star, thank you!