1
tjandt
Multiple votes allowed from one IP in poll module?
  • 2005/5/20 16:34

  • tjandt

  • Just popping in

  • Posts: 10

  • Since: 2005/5/6 1


Is there a way to allow more than one vote per IP address in a poll?

I have a site for our company basketball league that is hosted outside of our firewall, so XOOPS thinks that all of the individuals trying to vote are coming from them same IP address (our companie's Internet Gateway), and is not allowing additional votes.

thanks,
Tim

2
tjandt
Re: Multiple votes allowed from one IP in poll module?
  • 2005/5/20 16:52

  • tjandt

  • Just popping in

  • Posts: 10

  • Since: 2005/5/6 1


Guess I solved my own problem...

Just went into the /modules/xoopspool directory, and edited the index.php and starting at line 75 of the file, commented out all references to the tracking cookie and the already voted conditions as follows:

if ( !$poll->hasExpired() ) {
    
//    if ( empty($voted_polls[$poll_id]) ) {
            
if ( $xoopsUser ) {
//                if ( XoopsPollLog::hasVoted($poll_id, xoops_getenv('REMOTE_ADDR'), $xoopsUser->getVar("uid")) ) {
    //                setcookie("voted_polls[$poll_id]", 1, 0);
        //            $msg = _PL_ALREADYVOTED;
            //    } else {
                    
$poll->vote($HTTP_POST_VARS['option_id'], xoops_getenv('REMOTE_ADDR'), $xoopsUser->getVar("uid"));
                    
$poll->updateCount();
                    
setcookie("voted_polls[$poll_id]"10);
                    
$msg _PL_THANKSFORVOTE;
                
//}
            
} else {
        
//        if ( XoopsPollLog::hasVoted($poll_id, xoops_getenv('REMOTE_ADDR')) ) {
            //        setcookie("voted_polls[$poll_id]", 1, 0);
            //        $msg = _PL_ALREADYVOTED;
        //        } else {
                    
$poll->vote($HTTP_POST_VARS['option_id'], xoops_getenv('REMOTE_ADDR'));
                    
$poll->updateCount();
                    
setcookie("voted_polls[$poll_id]"10);
                    
$msg _PL_THANKSFORVOTE;
                }
            
//}
//        } else {
    //        $msg = _PL_ALREADYVOTED;
        //}


Seemed to do the trick.

Tim

3
beanstalk
Re: Multiple votes allowed from one IP in poll module?
  • 2005/11/30 4:37

  • beanstalk

  • Just popping in

  • Posts: 13

  • Since: 2005/11/8


i commented out the 'setcookie' lines in 'xoopspoll/index.php' and in 'xoopspoll/blocks/xoopspoll.php'. now different registered users may vote from one ip/computer.

however, no anonymous votes are allowed. results show when anonymous, unless the vote button is hit. anonymous votes get the 'sorry you already voted' message.

i think this fixes it properly for me. although it would be nice to have the option to allow anonymous votes. i know my hack and allowing anonymous votes can compromise the results, but for certain applications, it is preferred.

we have a youth center. it's a poor area so the only place for them to vote is on our computers. they also don't like to register. case in point...

Login

Who's Online

458 user(s) are online (326 user(s) are browsing Support Forums)


Members: 0


Guests: 458


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits