Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.1
Author Message
paranor
Worker
Worker



Joined: Aug 28, 2003
Posts: 227

PostPosted: Mon Mar 15, 2004 12:16 pm Reply with quote

Running 7.1 from this site (chatserv patch) and I can vote multiple times while anonymous on the same PC without having to close the browser.

I'm allowed the same when logged in as a user. I know this wasn't doable in 6.9. Bug in 7.1?
 
View user's profile Send private message
Lateron
Worker
Worker



Joined: May 10, 2003
Posts: 119
Location: Katoomba, NSW, Australia.

PostPosted: Mon Mar 15, 2004 3:02 pm Reply with quote

I am reasonably sure visitors and members have always been able to multiple-vote.

Sometime last year I remember seeing a script fix for this on a support site. Now for the bad news: I have no idea which site, however, in my travels today I will see if I can find it.


Ron..
 
View user's profile Send private message Visit poster's website
paranor







PostPosted: Mon Mar 15, 2004 3:07 pm Reply with quote

Another reason why we need a fork. This is a "like duh, we should fix this."

sheesh
Very Happy
 
Lateron







PostPosted: Mon Mar 15, 2004 3:14 pm Reply with quote

Here is one solution. Not very elegant and not the one I am looking for but perhaps a start.

http://www.nukecops.com/postlite20804-survey.html%2A
 
Lateron







PostPosted: Mon Mar 15, 2004 8:09 pm Reply with quote

Sorry but I haven't been able to find it.

I seem to remember it was a fairly complex fix requiring an extra field in the database.

I'll keep looking.
 
paranor







PostPosted: Tue Mar 16, 2004 8:22 am Reply with quote

Thanks for the nukecops post - I tried that and the same problem. I could have sworn on my mothers grave that this isn't a problem in 6.9.

And you would think this wouldn't be a problem in 7.1! That's 7.1 versions to fix this! Smile
 
Lateron







PostPosted: Tue Mar 16, 2004 2:23 pm Reply with quote

Sometimes I think the only difference between versions is the number Mr. Green
 
paranor







PostPosted: Tue Mar 16, 2004 2:43 pm Reply with quote

That's good philosophy!
Laughing
 
Dacubz
Worker
Worker



Joined: Apr 27, 2004
Posts: 156
Location: Homer Glen, Illinois

PostPosted: Wed May 19, 2004 5:00 am Reply with quote

I have the same problem in 7.2. Can it be fixed? I increaded the seconds in the file, and it seems to be OK for now.
 
View user's profile Send private message Visit poster's website
paranor







PostPosted: Wed May 19, 2004 6:09 am Reply with quote

I'm willing to pay $25 to anyone who gets this fixed. Unless we are talking hundreds of hours of work. Smile
 
sixonetonoffun
Spouse Contemplates Divorce



Joined: Jan 02, 2003
Posts: 2496

PostPosted: Wed May 19, 2004 6:57 am Reply with quote

Did you try this one? [ Only registered users can see links on this board! Get registered or login! ]
 
View user's profile Send private message
paranor







PostPosted: Wed May 19, 2004 7:18 am Reply with quote

Nope - I gave up and this was a recent post. Thanks though!!! I'll give it a try.
 
chatserv
Member Emeritus



Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico

PostPosted: Wed May 19, 2004 8:26 am Reply with quote

Try changing your pollCollector function to the following:
Code:
function pollCollector($pollID, $voteID, $forwarder) {

    global $HTTP_COOKIE_VARS, $prefix, $db;
    /* Fix for lamers that like to cheat on polls */
    if (empty($ip)) {
   $ip = $_SERVER["REMOTE_ADDR"];
    }
    $pollID = intval($pollID);
    $past = time()-1800;
    $db->sql_query("DELETE FROM ".$prefix."_poll_check WHERE time < '$past'");
    $row = $db->sql_fetchrow($db->sql_query("SELECT ip FROM ".$prefix."_poll_check WHERE (ip='$ip') AND (pollID='$pollID')"));
    $ips = $row['ip'];
    $ctime = time();
    $pollID = intval($pollID);
    if ($ip == $ips) {
   $voteValid = 0;
    } else {
   $db->sql_query("INSERT INTO ".$prefix."_poll_check (ip, time, pollID) VALUES ('$ip', '$ctime', '$pollID')");
   $voteValid = "1";
    }
    /* Fix end */
    /* update database if the vote is valid */
    if($voteValid>0) {
        $db->sql_query("UPDATE ".$prefix."_poll_data SET optionCount=optionCount+1 WHERE pollID='$pollID' AND voteID='$voteID'");
        if ($voteID != "") {
       $db->sql_query("UPDATE ".$prefix."_poll_desc SET voters=voters+1 WHERE pollID='$pollID'");
       update_points(8);
        }
   Header("Location: $forwarder");
    } else {
    include ('header.php');
    OpenTable();
    echo "<center>You Have Already Voted - [ <a href=\"javascript:history.go(-1)\">Go Back</a> ]</center>";
    CloseTable();
    include ('footer.php');

    }
    /* a lot of browsers can't handle it if there's an empty page */

}
 
View user's profile Send private message Visit poster's website
paranor







PostPosted: Wed May 19, 2004 12:14 pm Reply with quote

is that a copy from that link chatserv?

it works! you da man!

Smile

How does it know I voted? I voted once while not logged in and was not able to vote. I then logged in and still couldn't vote. So this is good!

Anyway to change this to where you can only vote if you are logged and then tracked by user id? So if I'm a family and I want to vote versus my wife.
 
chatserv







PostPosted: Wed May 19, 2004 12:20 pm Reply with quote

No, it's not from that link, i edited the function myself, it tracks users by ip, what i did is re-code the conditional, it somehow seems the $forwarder option was not working.
 
paranor







PostPosted: Wed May 19, 2004 12:29 pm Reply with quote

you amaze me. Smile

How hard to go by user ID and IP address?

1) Can't vote if I'm anonymous
2) Can vote *again* from same IP address if different user ID.

I will donate!
 
chatserv







PostPosted: Wed May 19, 2004 12:59 pm Reply with quote

Ok, this requires a table modification and i haven't tested it so make a copy of the file and keep a copy of the file you are using now just in case.

modify the table:
Code:
ALTER TABLE nuke_poll_check ADD puname varchar(25) NOT NULL default '';


The Function:
Code:
function pollCollector($pollID, $voteID, $forwarder) { 

    global $user, $cookie, $HTTP_COOKIE_VARS, $prefix, $db;
    /* Fix for lamers that like to cheat on polls */
    if (empty($ip)) {
   $ip = $_SERVER["REMOTE_ADDR"];
    }
    $pollID = intval($pollID);
    $past = time()-1800;
    $db->sql_query("DELETE FROM ".$prefix."_poll_check WHERE time < '$past'");
    if(is_user($user)) {
    cookiedecode($user);
    $row = $db->sql_fetchrow($db->sql_query("SELECT ip, puname FROM ".$prefix."_poll_check WHERE (ip='$ip') AND (pollID='$pollID')"));
    $ips = $row['ip'];
    $puname = $row['puname'];
    $ctime = time();
    $pollID = intval($pollID);
    if ($ip == $ips && $cookie[1] == $puname) {
   $voteValid = 0;
    } else {
   $db->sql_query("INSERT INTO ".$prefix."_poll_check (ip, time, pollID, puname) VALUES ('$ip', '$ctime', '$pollID', '$cookie[1]')");
   $voteValid = "1";
    }
    } elseif(!is_user($user)) {
    $row = $db->sql_fetchrow($db->sql_query("SELECT ip FROM ".$prefix."_poll_check WHERE (ip='$ip') AND (pollID='$pollID')"));
    $ips = $row['ip'];
    $ctime = time();
    $pollID = intval($pollID);
    if ($ip == $ips) {
   $voteValid = 0;
    } else {
   $db->sql_query("INSERT INTO ".$prefix."_poll_check (ip, time, pollID) VALUES ('$ip', '$ctime', '$pollID')");
   $voteValid = "1";
    }
}
    /* Fix end */
    /* update database if the vote is valid */
    if($voteValid>0) {
        $db->sql_query("UPDATE ".$prefix."_poll_data SET optionCount=optionCount+1 WHERE pollID='$pollID' AND voteID='$voteID'");
        if ($voteID != "") {
       $db->sql_query("UPDATE ".$prefix."_poll_desc SET voters=voters+1 WHERE pollID='$pollID'");
       update_points(8);
        }
   Header("Location: $forwarder");
    } else {
    include ('header.php');
    OpenTable();
    echo "<center>You Have Already Voted - [ <a href=\"javascript:history.go(-1)\">Go Back</a> ]</center>";
    CloseTable();
    include ('footer.php');

    }

}


Last edited by chatserv on Wed May 19, 2004 1:35 pm; edited 1 time in total 
chatserv







PostPosted: Wed May 19, 2004 1:14 pm Reply with quote

Tested the code, do not use it for now, i will check it in a bit.
 
chatserv







PostPosted: Wed May 19, 2004 1:37 pm Reply with quote

Ok, code corrected.
 
paranor







PostPosted: Wed May 19, 2004 7:27 pm Reply with quote

I was able to vote more than once after I logged in. Please don't spend too much time on this - it's a nice to have but you've already made my day fixing the initial problem.
 
chatserv







PostPosted: Wed May 19, 2004 7:39 pm Reply with quote

You can vote more than once while logged in? i couldn't on my site but yes i will work more on this, it's worth it.
 
paranor







PostPosted: Wed May 19, 2004 7:42 pm Reply with quote

maybe I fubarred something. I'll try again later tonight - busy moving another site over to php-nuke. w00t!
 
sqzdog
Involved
Involved



Joined: Sep 22, 2003
Posts: 252

PostPosted: Wed May 19, 2004 8:07 pm Reply with quote

How do you edit the poll collector function? What file is that?

Quote:
function pollCollector($pollID, $voteID, $forwarder) {
global $HTTP_COOKIE_VARS, $prefix, $db;
/* Fix for lamers that like to cheat on polls */
if (empty($ip)) {
$ip = $_SERVER["REMOTE_ADDR"];
}
$pollID = intval($pollID);
$past = time()-1800;
$db->sql_query("DELETE FROM ".$prefix."_poll_check WHERE time < '$past'");
$row = $db->sql_fetchrow($db->sql_query("SELECT ip FROM ".$prefix."_poll_check WHERE (ip='$ip') AND (pollID='$pollID')"));
$ips = $row['ip'];
$ctime = time();
$pollID = intval($pollID);
if ($ip == $ips) {
$voteValid = 0;
} else {
$db->sql_query("INSERT INTO ".$prefix."_poll_check (ip, time, pollID) VALUES ('$ip', '$ctime', '$pollID')");
$voteValid = "1";
}
/* Fix end */
/* update database if the vote is valid */
if($voteValid>0) {
$db->sql_query("UPDATE ".$prefix."_poll_data SET optionCount=optionCount+1 WHERE pollID='$pollID' AND voteID='$voteID'");
if ($voteID != "") {
$db->sql_query("UPDATE ".$prefix."_poll_desc SET voters=voters+1 WHERE pollID='$pollID'");
update_points(Cool;
}
Header("Location: $forwarder");
} else {
include ('header.php');
OpenTable();
echo "<center>You Have Already Voted - [ <a href=\"javascript:history.go(-1)\">Go Back</a> ]</center>";
CloseTable();
include ('footer.php');

}
/* a lot of browsers can't handle it if there's an empty page */

}
 
View user's profile Send private message Send e-mail
paranor







PostPosted: Wed May 19, 2004 8:17 pm Reply with quote

the index.php file (or did I mistake your question?)
 
sqzdog







PostPosted: Wed May 19, 2004 8:20 pm Reply with quote

Which file do I edit? The index.php file? Under the Survey modules folder?
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.1

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©