Home arrow PHP arrow Page 4 - Creating a Fraud-proof Voting System

Trust but Verify - PHP

Setting up polls or voting systems is a great way to get users more involved in your website, and keep them coming back for more. But with fraud hanging over the professional political elections, how do you keep your visitors from screaming for a recount--or worse, stuffing the ballot box? Ian Felton describes a simple system for setting up an online poll and preventing abuses.

TABLE OF CONTENTS:
  1. Creating a Fraud-proof Voting System
  2. One Person, Multiple Addresses, Still One Vote
  3. One Vote.php, Two States
  4. Trust but Verify
By: Ian Felton
Rating: starstarstarstarstar / 143
December 21, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Now that there is a vote in the system, we need a simple verification script that will determine if the vote is legitimate. We’ll call this script, Verify.php. It looks like this:

//Select the database
mysql_select_db($database, $db);
//Update the record to set the Boolean flag to true if the timestamp in the verification email matches the timestamp in the database record.
$selectSQL = sprintf("UPDATE votes set pending=1 where bandID=%s AND email=%s AND time=%s", GetSQLValueString($_GET['band'], "int"),
GetSQLValueString($_GET['email'], "text"),
GetSQLValueString($_GET['time'], "text"));
$Result2 = mysql_query($selectSQL, $UB_DATA);
//Message for voter.
$messages = "Thanks for voting. Remember, you can only vote once a day for a band , but you can vote for as many bands a day as you want.";

This completes the general design of a fraud-proof voting system. There are a few ways to get around this system. ‘Fraud-proof’ is used in the general sense. Dick could obviously go around from computer to computer in the White House and keep voting for his favorite band. There’s some other ways around this system too, but I’ll let you figure that out. However, with this basic design, a voting system that prevents the basest level of fraud can be setup to your specific purpose relatively simply. Happy voting



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

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 11 - Follow our Sitemap

Dev Shed Tutorial Topics: