Re: Voting methodology

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 26, 2008 at 9:23 AM, tedd <tedd@xxxxxxxxxxxx> wrote:
> Hi gang:
>
> What methodology would be the best for online voting?
>
> I have a client who is a Union and they want members to vote online, but
> don't want someone to stuff the voting box.

    Because this is going to be a member-only vote, half of your
decision is already made.  The rest of it is as Lynch described.  And
to preserve anonymity, don't attach the actual vote to the UserID of
the account, just flip a boolean that they have, indeed, voted in that
poll, or add their UserID to the list of voters.  Then something like
this:

<?php

// Just done to save run-on lines via email.
function m($data) {
    return mysql_real_escape_string($data);
}

$sql  = "SELECT COUNT('UserID') FROM `polls` WHERE ";
$sql .= "`id` = '".m($pollID)."' AND `UserID` = '".m($userID)."'";

$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);

$voted = $row[0] == '1' ? True : False;
?>

    And you can switch()/case your way to whether or not the voting
form is shown or if that UserID is blocked from voting.  This also
lets you expand to control by groups if need be now or later, and
disables people from voting from multiple computers.  They have to be
logged in to vote, and they can only vote once, but it allows for
anonymity in elections, etc.  Which, as a Teamster for the last twelve
years, is something I personally appreciate.  ;-P

-- 
</Daniel P. Brown>
http://www.parasane.net/
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux