PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
paranor
Client


Joined: Aug 28, 2003
Posts: 227

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

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: 118
Location: Katoomba, NSW, Australia.

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

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
Client


Joined: Aug 28, 2003
Posts: 227

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

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

sheesh
Very Happy
View user's profile Send private message
Lateron
Worker
Worker


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

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

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 to the forums!
View user's profile Send private message Visit poster's website
Lateron
Worker
Worker


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

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

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.
View user's profile Send private message Visit poster's website
paranor
Client


Joined: Aug 28, 2003
Posts: 227

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

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
View user's profile Send private message
Lateron
Worker
Worker


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

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

Sometimes I think the only difference between versions is the number Mr. Green
View user's profile Send private message Visit poster's website
paranor
Client


Joined: Aug 28, 2003
Posts: 227

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

That's good philosophy!
Laughing
View user's profile Send private message
Dacubz
Worker
Worker


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

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

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
Client


Joined: Aug 28, 2003
Posts: 227

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

I'm willing to pay $25 to anyone who gets this fixed. Unless we are talking hundreds of hours of work. Smile
View user's profile Send private message
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2363

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

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


Joined: Aug 28, 2003
Posts: 227

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

Nope - I gave up and this was a recent post. Thanks though!!! I'll give it a try.
View user's profile Send private message
chatserv
The Mouse Is Extension Of Arm


Joined: May 02, 2003
Posts: 1393

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

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
Client


Joined: Aug 28, 2003
Posts: 227

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

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.
View user's profile Send private message
chatserv
The Mouse Is Extension Of Arm


Joined: May 02, 2003
Posts: 1393

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

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.
View user's profile Send private message Visit poster's website
paranor
Client


Joined: Aug 28, 2003
Posts: 227

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

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!
View user's profile Send private message
chatserv
The Mouse Is Extension Of Arm


Joined: May 02, 2003
Posts: 1393

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

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
View user's profile Send private message Visit poster's website
chatserv
The Mouse Is Extension Of Arm


Joined: May 02, 2003
Posts: 1393

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

Tested the code, do not use it for now, i will check it in a bit.
View user's profile Send private message Visit poster's website
chatserv
The Mouse Is Extension Of Arm


Joined: May 02, 2003
Posts: 1393

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

Ok, code corrected.
View user's profile Send private message Visit poster's website
paranor
Client


Joined: Aug 28, 2003
Posts: 227

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

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.
View user's profile Send private message
chatserv
The Mouse Is Extension Of Arm


Joined: May 02, 2003
Posts: 1393

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

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.
View user's profile Send private message Visit poster's website
paranor
Client


Joined: Aug 28, 2003
Posts: 227

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

maybe I fubarred something. I'll try again later tonight - busy moving another site over to php-nuke. w00t!
View user's profile Send private message
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

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

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
Client


Joined: Aug 28, 2003
Posts: 227

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

the index.php file (or did I mistake your question?)
View user's profile Send private message
sqzdog
Involved
Involved


Joined: Sep 22, 2003
Posts: 252

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

Which file do I edit? The index.php file? Under the Survey modules folder?
View user's profile Send private message Send e-mail
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum