PHP
  Home arrow PHP arrow Page 2 - Creating a Fraud-proof Voting System
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Creating a Fraud-proof Voting System
By: Ian Felton
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 117
    2004-12-21


    Table of Contents:
  • Creating a Fraud-proof Voting System
  • One Person, Multiple Addresses, Still One Vote
  • One Vote.php, Two States
  • Trust but Verify

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Creating a Fraud-proof Voting System - One Person, Multiple Addresses, Still One Vote
    ( Page 2 of 4 )

    Sending the email is only the first step for fraud prevention because some people have a thousand email addresses. Someone could (and would) vote for the same song using all of their email addresses and skew the results in that way. Because of situations like that, the system also needs to verify that fans aren’t using multiple email addresses. The verification email also needs some sort of key so that the verification script cannot be easily hacked.

    Two scripts comprise the bulk of the system. One script, vote.php, casts the vote and sends the verification email. Another script, verify.php sets the vote as valid after Dick clicks the link in his inbox. A table in the database will need to be created to store votes.

    First, we’ll setup the table in the database to store the votes that are cast. We need a basic primary key called ID. We’ll store the email address of the voter. We’ll timestamp the vote. We need a column that shows whether the vote has been verified. It will be a Boolean flag. We’ll store the ID of the band receiving the vote. We’ll store the song name and finally the IP address of the voter.

    CREATE TABLE `votes` (
    `ID` int(10) unsigned NOT NULL auto_increment,
    `email` varchar(255) NOT NULL default '0',
    `time` timestamp(14) NOT NULL,
    `pending` tinyint(1) unsigned NOT NULL default '0',
    `bandID` int(10) unsigned NOT NULL default '0',
    `song` varchar(255) default NULL,
    `IP` varchar(15) NOT NULL default '0',
    PRIMARY KEY (`ID`),
    UNIQUE KEY `ID` (`ID`),
    KEY `ID_2` (`ID`)
    ) TYPE=MyISAM AUTO_INCREMENT=0;



     
     
    >>> More PHP Articles          >>> More By Ian Felton
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek