Author |
Message |
paranor
Worker


Joined: Aug 28, 2003
Posts: 227
|
Posted:
Mon Mar 15, 2004 12:16 pm |
|
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? |
|
|
|
 |
Lateron
Worker


Joined: May 10, 2003
Posts: 119
Location: Katoomba, NSW, Australia.
|
Posted:
Mon Mar 15, 2004 3:02 pm |
|
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.. |
|
|
|
 |
paranor

|
Posted:
Mon Mar 15, 2004 3:07 pm |
|
Another reason why we need a fork. This is a "like duh, we should fix this."
sheesh
 |
|
|
|
 |
Lateron

|
Posted:
Mon Mar 15, 2004 3:14 pm |
|
Here is one solution. Not very elegant and not the one I am looking for but perhaps a start.
Only registered users can see links on this board! Get registered or login! |
|
|
|
 |
Lateron

|
Posted:
Mon Mar 15, 2004 8:09 pm |
|
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

|
Posted:
Tue Mar 16, 2004 8:22 am |
|
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!  |
|
|
|
 |
Lateron

|
Posted:
Tue Mar 16, 2004 2:23 pm |
|
Sometimes I think the only difference between versions is the number  |
|
|
|
 |
paranor

|
Posted:
Tue Mar 16, 2004 2:43 pm |
|
That's good philosophy!
 |
|
|
|
 |
Dacubz
Worker


Joined: Apr 27, 2004
Posts: 156
Location: Homer Glen, Illinois
|
Posted:
Wed May 19, 2004 5:00 am |
|
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. |
|
|
|
 |
paranor

|
Posted:
Wed May 19, 2004 6:09 am |
|
I'm willing to pay $25 to anyone who gets this fixed. Unless we are talking hundreds of hours of work.  |
|
|
|
 |
sixonetonoffun
Spouse Contemplates Divorce

Joined: Jan 02, 2003
Posts: 2496
|
Posted:
Wed May 19, 2004 6:57 am |
|
|
|
 |
paranor

|
Posted:
Wed May 19, 2004 7:18 am |
|
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
|
Posted:
Wed May 19, 2004 8:26 am |
|
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 */
}
|
|
|
|
|
 |
paranor

|
Posted:
Wed May 19, 2004 12:14 pm |
|
is that a copy from that link chatserv?
it works! you da man!
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

|
Posted:
Wed May 19, 2004 12:20 pm |
|
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

|
Posted:
Wed May 19, 2004 12:29 pm |
|
you amaze me.
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

|
Posted:
Wed May 19, 2004 12:59 pm |
|
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

|
Posted:
Wed May 19, 2004 1:14 pm |
|
Tested the code, do not use it for now, i will check it in a bit. |
|
|
|
 |
chatserv

|
Posted:
Wed May 19, 2004 1:37 pm |
|
|
|
 |
paranor

|
Posted:
Wed May 19, 2004 7:27 pm |
|
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

|
Posted:
Wed May 19, 2004 7:39 pm |
|
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

|
Posted:
Wed May 19, 2004 7:42 pm |
|
maybe I fubarred something. I'll try again later tonight - busy moving another site over to php-nuke. w00t! |
|
|
|
 |
sqzdog
Involved


Joined: Sep 22, 2003
Posts: 252
|
Posted:
Wed May 19, 2004 8:07 pm |
|
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( ;
}
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 */
} |
|
|
|
|
 |
paranor

|
Posted:
Wed May 19, 2004 8:17 pm |
|
the index.php file (or did I mistake your question?) |
|
|
|
 |
sqzdog

|
Posted:
Wed May 19, 2004 8:20 pm |
|
Which file do I edit? The index.php file? Under the Survey modules folder? |
|
|
|
 |
|