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
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- 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...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: