Anda di halaman 1dari 44

ONVS

Global Institute Of Technology

Jaipur

Department Of CSE
Session: 2011-2012

Submitted by: Surabhi Singh

Submitted to: Ms. Nidhi Goyal

ONVS

Project File Of CASE Lab

Project Title ONLINE NATIONAL VOTING SYSTEM


Prepared By:
Surabhi Singh Branch CS 2nd year/4th semester Roll no. 10EGJCS059 Shefali Gupta Branch CS 2nd year/4th semester Roll no. 10EGJCS053

ONVS

INDEX
S No. 1. 2. 3. 4. 4. 5. Software development Phase Feasibility Study Software requirement Specification Data Flow Diagrams ER Diagram Use Case Diagrams Coding Date 12-03-12 20-03-12 27-03-12 27-03-12 17-04-12 24-04-12 Remarks

ONVS

Feasibility Study
Motivation:
The present Voting system, i.e. the system using EVMs (electronic Voting machines) has successfully replaced the old system that used paper ballets. Now, as the e-world is spreading like a wildfire, time has come to apply the online concept to the present Voting System. This would not only increase the percentage of votes cast, but will also bring down the cost of conducting elections. Also, people who do not live in their hometowns will be able to cast votes, thus further increasing the percentage of votes cast and giving us better or more accurate and precise results.

Input Assumptions:
All the voters have their Unique ID. All voters are literate. All voters have access to the internet. Voters will need to register using their unique ID before they can vote. All voters will have a secret password, which will be generated at the time of registration.

Problem Definition:
The conventional voting system using EVMs is easier and safer than ballets, but still its costlier as Voting centers are formed and people assigned to overlook the entire process are given TAs and DAs out of the government reservoir. Not all voters can cast vote as many of them live in other towns and cities. People have to travel long distances to cast their votes. The additional cost of counting of votes. The wait and delay in the results.

The cost of security provided for the EVMs.

Objective:
The online Voting system is a user Friendly online software, where users can register and log in to cast their Votes without the hassle of travelling to a voting centre. The main objective is to maintain a record of all the voters and conduct online polls during election period.

ONVS

Maintain records of all the citizens. Keep records of the eligible vote bank of a particular election being conducted at a given time. Keep a record of the votes cast for all the candidates. Keep a record of all the votes cast. Give result as soon as the end of elections. Calculate the percentage of votes cast. An educational tour will be given to all the users at the time of registration. User manuals will be provided several days before elections. One person can vote only once, though they can log in again to see who they cast vote for. The administrators input all the information about the Candidates before polling opens and can change it after one poll for reuse of the software. The administrators have access to all the data input by voters. At the end of elections, the administrators can announce the winners right away. Voters can change their password after they log in.

ONVS

SOFTWARE REQUIREMENT SPECIFICATION

ONVS

1. Introduction:
1.1 Purpose:
The purpose of our project is to provide an easy and cheaper way of election system, which will ensure secure elections along with bringing down the total cost and increasing the percentage of votes cast. This software can also be used by the ruling Government to conduct polls and know the general opinion of the people on current issues.

1.2 Scope:
IN SCOPE: Administrators can keep record of all the candidates. Administrators can input the number of and the basic information of all the candidates at the start of elections. Administrators can keep record of Voters. Administrators can see and declare the result at the end of poll.

OUT OF SCOPE: People who are illiterate cant vote. People who dont have access to internet will have to go to a nearby online vot ing centre to cast their vote.

1.3 Definitions:
Unique ID: A unique identification alphanumeric code assigned to all the citizens at the time of census. Password: An alphanumeric code that gives you access to the system. Voters: Citizens eligible for casting votes at a given time. Literate: One who can read write and understand in any language. Poll/Elections: Formal decision-making process by which a population chooses an individual to hold public office. Database: Collection of information in a structured form.

ONVS

Administrators: People assigned by the Election Commission to oversee the smooth and safe elections. Server: The computer systems where all the data is stored.

1.4 Abbreviations:
DB: Database ONVS: Online National Voting System SW: Software UID: Unique ID GUI: Graphic User Interface TA: Travel Allowance DA: Daily Allowance CV: Cast Vote

1.5 References:
http://en.wikibooks.org/wiki/PHP_Programming/ http://www.w3schools.com/php/ http://www.w3schools.com/sql Various books on Software Engineering

1.6 Overview:
The rest of the SRS is organized as follows: Section 2 gives an overall description of the sw. It determines the level of proficiency which is expected from user, some general constraints while making this sw and making some assumption and dependencies. Section 3 gives special requirement which the sw is expected to deliver. Functional requirements and some design constraints are also given. Section 4 gives some possible future extensions of the system.

ONVS

2. Overall Description
2.1 Product Perspective:
The online National Voting system is a self contained system that manages all the on goings of national or regional elections. From maintaining database to conducting elections in a fruitful manner, and then giving results right away. The election commission will appoint the authorized body to view, maintain and change the data regarding voters and candidates.

2.2 Product Functions:


The sw should support the following use cases:

Class of use Cases


Use case related installation of sw

Use Cases
to Installation UID

Description
Installing the sw UID and password required by the users and administrators. Admin as well as users can change passwords for enhanced security. Users can see and edit their details change their details stored in the Database Admin can change and edit the Details regarding Candidates as required by the election Commission Users can cast their votes via one click after logging in to

Use cases related to security

Changing Password

Use cases related to details

User Details

Candidate Details

Use Case related to casting of Vote Casting Votes

ONVS
their accounts Use case related to counting Counting of Votes of Votes and result Declaration

10

Votes will be counted automatically through the coding so that the count increases every time a user casts vote The admin can see the result as soon as the voting is closed along with the calculations regarding percentage of votes cast.

Declaration of result

2.3 User Characteristics:


Users must have knowledge about Internet. Users must be literate.

2.4 Principle Actor:


Database: Administrators Result Declaration and Changing Data Regarding Candidates: Administrators Casting of Votes: User

2.5 General Constraints:


GUI is only in English and Hindi. Requirement of a Computer System. Requirement of Internet access.

ONVS

11

3. Specific Requirements
3.1 Functional Requirements:
We describe the functional Requirements using Various Use cases:

3.1.1

Use Case Name: Voter Registration

Primary Actor: Voter Pre-Requisite: Internet Connection, A genuine user with his unique ID for Registration. Purpose: Registering the Voter to the Database Main Scenario: Voter enters the system homepage. He clicks the register now button. The system prompts the application form. He fills in the necessary information related with him in the application form. He sends the request for registration by using send button. If the information is correctly entered the system prints a successful message. Otherwise, it prints appropriate error message, redisplays the application form.

Alternative Scenario: Null

3.1.2

Use Case name: Update Voters

Primary Actor: Administration Pre Requisite: Internet Connection, Updated Database Purpose: To update the newly added Voters to Database and remove or edit information about existing Voters. Main Scenario: Admin selects on Update Voters from menu and displays that page Admin click on Update Now button The system checks online voters with respect to upcoming elections voters list

ONVS
If the voter exists in the list, the system updates the voter with respect to official voter information. If the voter does not exist in the list, the system deletes that voter from database.

12

Alternative Scenario: Null

3.1.3

Use Case name: Log In/ Log Out

Primary Actor: User Pre Requisite: Internet connection, UID and Password Purpose: A voter may log in to see their profile, edit it, change password or cast vote and view their vote cast. Main Scenario: The user enters his login id and password If the login and password is valid, The specific page of every user is loaded If the login or password is not valid, the login screen is redisplayed with an error message the user click on the logout button Alternative Scenario: Null

3.1.4

Use Case name: Change Password

Primary Actor: User Pre Requisite: Internet connection, UID and Password Purpose: The user can change their Password by entering their original password Main Scenario:
User clicks on Update Account. The system opens a new page to enter old password and the new one. The user enters his old password. He then enters his new password User clicks the submit button. If the old password was entered incorrectly, the system will print an error message and the form to change password will re-appear. If the old password was entered correctly the system changes password and prints a success message and redirects to his profile. Alternative Scenario: Null

ONVS 3.1.5 Use Case name: Edit the Candidate Information

13

Primary Actor: Admin Pre Requisite: Candidate information Submitted by candidate, Internet Connection Purpose: Update data about Candidates Main Scenario: The admin Logs in. There is a button labeled, add a new Candidate or edit Candidate Information The admin puts in new data, clicks on Save.

Alternative Scenario: Null

3.1.6

Use Case name: View/Declare Result

Primary Actor: Admin Pre Requisite: Internet Connection Purpose: View and Declare result at the end of elections Main Scenario: The admin opens the result page. He clicks in the Declare result button. The result link is posted in the homepage.

Alternative Scenario: Null

3.1.7

Use Case name: Cast vote

Primary Actor: Voter Pre Requisite: Internet connection, UID and Password Purpose: The voter can cast their vote Main Scenario: Voter logs in on the website. Voter goes to the online ballet page.

ONVS
Voter clicks on their desired Candidate and press save choice. Redirected to their profile

14

Alternative Scenario: Null

3.2 Performance Requirements:


a. b. c. d. e. f. Requires Internet connection. PHP enabled browser PHP runtime Environment. MS-SQL Server. 80 GB Hard Disk at server. Minimum 2 GB RAM.

3.3 Design Constraints:


a. PHP b. PHP enabled browser c. MS-SQL Server as back-end.

ONVS

15

4. Future Extensions
Earlier EVM system of conducting elections took up a lot of time and resources. Using an online system will strive to save both. Some more extensions are Security: Sensitive data is protected from unwanted access by users. Appropriate technology and implementing strict user access-criteria. Provide good performance and ability to scale the server: The web application server should provide good performance and ability to manage performer technique such as, faster and easy access, reliability, etc. Centralized database: CD will enable efficient management of data. Safety and reliability: By incorporating a robust and proven RDBMS (SQL) into the system, reliable, performance and integrity of data is ensured. There must be a power backup for server system. Voting without having to travel: Voters living outside India who have Indian citizenship can also cast their vote.

ONVS

16

Data Flow Diagrams

Flow Chart of Various attributes

DFD

ONVS

17

ER Diagram

ONVS

18

Use Case Diagrams

Voter Registration

Update Voter List

ONVS

19

Log in

Change Password

ONVS

20

Edit Candidate Information

Declare Result

ONVS

21

Cast Votes

ONVS

22

Coding
Creating database using mysql through terminal window:
To open mysql console: surabhi@surabhi-laptop:-~$ mysql u root p (enter) then, we enter mysql password on prompt. To create database: mysql> create database votingsystem; To change database: Use votingsystem; To create table users: CREATE TABLE `users` ( `id` INT NOT NULL auto_increment , `name` VARCHAR( 20 ) NOT NULL , `password` VARCHAR( 20 ) NOT NULL , `email`VARCHAR( 20 ) NOT NULL , adminVARCHAR(20), votedVARCHAR(20), PRIMARY KEY ( `id` ) ); To create table parties: CREATE TABLE parties ( 'name' varchar(20) NOT NULL,

ONVS
'candiname' varchar(20), 'count' int(20), primary key ('name'), );

23

Index.php
<html> <head> <title>login page</title> </head> <body bgcolor="black" style="color:white"> <form action="index.php" method=post> <h1 align="center" style="color:red" >The online voting system</h1> <?php session_start(); if($_SESSION["logged"]) { print_secure_content(); } else { if(!$_SESSION["logging"]) { $_SESSION["logging"]=true; loginform(); }

ONVS
else if($_SESSION["logging"]) { $number_of_rows=checkpass(); if($number_of_rows==1) { $_SESSION[user]=$_POST[userlogin]; $_SESSION[logged]=true; print"<h1>you have loged in successfully</h1>"; print_secure_content(); } else{

24

print "wrong password or username, please try again"; print("<br />"); loginform(); } } } function loginform() { print "please enter your login information to proceed with our site"; print ("<table border='2'><tr><td>username</td><td><input type='text' name='userlogin' size'20'></td></tr><tr><td>password</td><td><input type='password' name='password' size'20'></td></tr></table>"); print "<input type='submit' >";

ONVS
print("<br />"); print "<h3><a href='registerform.php'>register now!</a></h3>"; } function checkpass() { $servername="localhost"; $username="root"; $password="compsubi"; $conn= mysql_connect($servername,$username,$password)or die(mysql_error()); mysql_select_db("votingsystem",$conn); $sql="select * from users where name='$_POST[userlogin]' and password='$_POST[password]'"; $result=mysql_query($sql,$conn) or die(mysql_error()); return mysql_num_rows($result); } function print_secure_content() { print("<b><h1>hi $_SESSION[user]</h1>"); print "<br><h2>Now you can cast your precious vote Online!!"; print "<h3><a href='candi.php'>View Candidate Details</a></h3>"; $servername="localhost"; $username="root"; $password="compsubi"; $conn= mysql_connect($servername,$username,$password)or die(mysql_error());

25

ONVS
mysql_select_db("votingsystem",$conn); $m= mysql_query("SELECT * FROM users Where name='admin'"); $n = mysql_fetch_array($m); $chk2=$n['admin']; $chk1=$n['voted']; if($_SESSION[user]!='admin') { if($chk1=='admin'&&$chk2=='admin') { echo "The Voting has been closed"; print "<h3><a href='result.php'>view Result</a></h3>"; } else if($chk2=='admin'&&$chk1!='admin') { echo "Elections are open now!!"; print "<h3><a href='vote.php'>Cast your Vote here</a></h3>"; } else if($chk1!='admin'&&$chk2!='admin') { echo "elections are not open yet"; } } if($_SESSION[user]=='admin') {

26

ONVS
print "<h3><a href='admin.php'>admin page</a></h3>"; if($chk1=='admin'&&$chk2=='admin') { echo "The Voting has been closed"; print "<h3><a href='result.php'>view Result</a></h3>"; } } print "<h3><a href='logout.php'>logout</a></h3>"; } ?>

27

registerform.php
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>register</title> </head> <body bgcolor="black" style="color:white;"> <FORM ACTION="register.php" METHOD=post> <h1>welcome to the registration page</h1> please input the registration details to create an account here<br> <table border="2"> <tr> <td>User Name :</td><td><input name="regname" type="text" size"20"></input></td> </tr>

ONVS
<tr> <td>email :</td><td><input name="regemail" type="text" size"20"></input></td> </tr> <tr> <td>password :</td><td><input name="regpass1" type="password" size"20"></input></td> </tr> <tr> <td>retype password :</td><td><input name="regpass2" type="password" size"20"></input></td> </tr> </table> <input type="submit" value="register me!"></input> </FORM> </body> </html>

28

Register.php
h<?php if($_POST["regname"] && $_POST["regemail"] && $_POST["regpass1"] && $_POST["regpass2"] ) { if($_POST["regpass1"]==$_POST["regpass2"]) { $servername="localhost"; $username="root";

ONVS
$password="compsubi"; $conn= mysql_connect($servername,$username,$password)or die(mysql_error()); mysql_select_db("votingsystem",$conn); $k==0; $m= mysql_query("SELECT name FROM users"); while($n=mysql_fetch_array($m)) { if($_POST["regname"]==$n[name]) { $k++; } } if($k==0) {

29

$sql="insert into users (name,email,password)values('$_POST[regname]','$_POST[regemail]','$_POST[regpass1]')"; $result=mysql_query($sql,$conn) or die(mysql_error()); print "<h1>you have registered sucessfully</h1>"; } else { print "username already taken"; } print "<a href='index.php'>go to login page</a>";

ONVS
} else print "passwords doesnt match"; } else print"invaild data"; ?>

30

Candi.php
<html> <head> <title>Candidate Info</title> </head> <body bgcolor="black" style="color:gray"> <h1 align="center" style="color:white" >Welcome to the Candidate Info page</h1> <h1 align="left" style="color:red" >1. Ramdas</h1> <p>Party: Lok shakti</p> <P>Election symbol:</P> <img src="bird.png" width="104" height="142" /> <h1 align="left" style="color:red" >2. Thakur Shanti Prasad</h1> <p>Party: Jan Jagruk</p> <P>Election symbol:</P> <img src="kite.jpg" width="104" height="142" /> <h1 align="left" style="color:red" >3. Lakshmi Devi</h1> <p>Party: Lok Seva</p> <P>Election symbol:</P> <img src="car.gif" width="104" height="142" />

ONVS
<h1 align="left" style="color:red" >4. Bheem Singh</h1> <p>Party: Jaago</p> <P>Election symbol:</P> <img src="tiger.gif" width="104" height="142" /> <h1 align="left" style="color:red" >5. Kamala Ben</h1> <p>Party: jan samvedna</p> <P>Election symbol:</P> <img src="cycle.gif" width="104" height="142" /> <a href="index.php">go back to home page</a> </html>

31

Admin.php
<html> <head> <title>Admin Page</title> </head> <body bgcolor="black" style="color:gray"> <h1 align="center" style="color:white" >Welcome Admin</h1> <?php session_start(); if($_SESSION[user]=='admin') { print "<h3><a href='open.php'>Open Elections</a></h3>"; print "<h3><a href='resdec.php'>declare Result</a></h3>"; }

ONVS
print "<h3><a href='index.php'>back to main page</a></h3>"; ?>

32

open.php
<?php session_start(); $servername="localhost"; $username="root"; $password="compsubi"; $conn= mysql_connect($servername,$username,$password)or die(mysql_error()); mysql_select_db("votingsystem",$conn); if($_SESSION[user]=='admin') { mysql_query("UPDATE users SET admin='$_SESSION[user]' WHERE name='$_SESSION[user]'"); } mysql_close($conn); echo "The elections are open now"; print "<h3><a href='index.php'>back to main page</a></h3>"; ?>

Resdec.php
<?php session_start(); $servername="localhost"; $username="root";

ONVS
$password="compsubi"; $conn= mysql_connect($servername,$username,$password)or die(mysql_error()); mysql_select_db("votingsystem",$conn); if($_SESSION[user]=='admin') { mysql_query("UPDATE users SET voted='$_SESSION[user]' WHERE name='$_SESSION[user]'"); } mysql_close($conn); echo "The result has been declared on the results page"; print "<h3><a href='result.php'>proceed to results page</a></h3>"; print "<h3><a href='index.php'>back to main page</a></h3>"; ?>

33

Vote.php
<html> <body> <form name="input" action="count.php" method="post"> <form> <body bgcolor="black" style="color:gray"> <h1 align="center" style="color:white" >For whom do you want to vote?</h1> <input type="radio" name="candi" value="Ramdas" /> Ramdas <br /> <input type="radio" name="candi" value="Thakur Shanti Prasad" /> Thakur Shanti Prasad <br />

ONVS
<input type="radio" name="candi" value="Lakshmi Devi" /> Lakshmi Devi <br /> <input type="radio" name="candi" value="Bheem Singh" /> Bheem Singh <br /> <input type="radio" name="candi" value="Kamla Ben" /> Kamala Ben <br /> <input type="submit" value="Submit" /> </form> <p> </p> </body> </html>

34

Count.php
<?php session_start(); $servername="localhost"; $username="root"; $password="compsubi"; $conn= mysql_connect($servername,$username,$password)or die(mysql_error()); mysql_select_db("votingsystem",$conn); $m= mysql_query("SELECT * FROM users Where name='$_SESSION[user]'"); $n = mysql_fetch_array($m); $chk1=$n['voted']; $chk2=$_SESSION[user];

ONVS
if($chk1!=$chk2) { $a="Ramdas"; $b="Thakur Shanti Prasad"; $c="Lakshmi Devi"; $d="Bheem Singh"; $e="Kamala Ben"; echo "you voted for ".$_POST["candi"]; if($_POST["candi"]==$a) { $result = mysql_query("SELECT * FROM parties Where candiname='Ramdas'"); $row = mysql_fetch_array($result); $x=$row['count']; $x++; mysql_query("UPDATE parties SET count='$x' WHERE candiname='Ramdas'"); mysql_query("UPDATE users SET voted='$_SESSION[user]' WHERE name='$_SESSION[user]'"); mysql_close($conn); } else if($_POST["candi"]==$b) {

35

$result = mysql_query("SELECT * FROM parties Where candiname='Thakur Shanti Prasad'"); $row = mysql_fetch_array($result); $x=$row['count'];

ONVS
$x++;

36

mysql_query("UPDATE parties SET count='$x' WHERE candiname='Thakur Shanti Prasad'"); mysql_query("UPDATE users SET voted='$_SESSION[user]' WHERE name='$_SESSION[user]'"); mysql_close($conn); } else if($_POST["candi"]==$c) { $result = mysql_query("SELECT * FROM parties Where candiname='Lakshmi Devi'"); $row = mysql_fetch_array($result); $x=$row['count']; $x++; mysql_query("UPDATE parties SET count='$x' WHERE candiname='Lakshmi Devi'"); mysql_query("UPDATE users SET voted='$_SESSION[user]' WHERE name='$_SESSION[user]'"); mysql_close($conn); } else if($_POST["candi"]==$d) { $result = mysql_query("SELECT * FROM parties Where candiname='Bheem Singh'"); $row = mysql_fetch_array($result); $x=$row['count']; $x++; mysql_query("UPDATE parties SET count='$x' WHERE candiname='Bheem Singh'");

ONVS
mysql_query("UPDATE users SET voted='$_SESSION[user]' WHERE name='$_SESSION[user]'"); mysql_close($conn); } else if($_POST["candi"]==$e) { $result = mysql_query("SELECT * FROM parties Where candiname='Kamala Ben'"); $row = mysql_fetch_array($result); $x=$row['count']; $x++; mysql_query("UPDATE parties SET count='$x' WHERE candiname='Kamala Ben'"); mysql_query("UPDATE users SET voted='$_SESSION[user]' WHERE name='$_SESSION[user]'"); mysql_close($conn); } } else{ echo "You have already voted"; } print "<h3><a href='index.php'>back to main page</a></h3>"; ?>

37

Result.php
<html> <head> <title>Results</title>

ONVS
</head> <body bgcolor="black" style="color:red"> <h3 align="center" style="color:aqua" >RESULTS</h3> <br /> <?php $servername="localhost"; $username="root"; $password="compsubi"; $conn= mysql_connect($servername,$username,$password)or die(mysql_error()); mysql_select_db("votingsystem",$conn); $m= mysql_query("SELECT * FROM users Where name='admin'"); $n = mysql_fetch_array($m); $chk1=$n['voted']; if($chk1=='admin') { $result=mysql_query("SELECT MAX(Count) AS winner FROM parties"); $row = mysql_fetch_array($result); $x=$row['winner']; $z= mysql_query("SELECT * FROM parties Where count='$x'"); $y=$row = mysql_fetch_array($z); $y['candiname']; echo "The winner in this province is ".$y['candiname']." from ".$y['name']." party with ".$y['count']." votes."; print"<br />";

38

ONVS
echo "Congratulations to the Winners."; } else { echo "The Result has not been declared yet."; } print "<h3><a href='index.php'>back to main page</a></h3>"; ?>

39

Logout.php
<html> <head> <title>logout</title> </head> <body bgcolor="black" style="color:yelllow"> <form action="index.php" method=get> <h1 align="center" style="color:white" >You have logged out successfully</h1> <img src="nam.png" width="110" height="200" /> <?php session_start(); if(session_destroy()) { print "<h3><a href='index.php'>back to main page</a></h3>"; } ?>

ONVS

40

Screenshots

ONVS

41

ONVS

42

ONVS

43

ONVS

44

Anda mungkin juga menyukai