Voting
Voting
A Thesis
Submitted in partial fulfillment of the requirement
for the award of the Degree of
Submitted by
DRISHTDUMAN PRAJAPATI
(R16CA1CA0025)
Under esteemed supervision of
Date: 04/07/2023
Mr. UDAY RANJAN
Assistant Professor
Dept. of CS & IT
Aisect University, Hazaribagh
DECLARATION CERTIFICATE
Guide:-
Mr. Uday Ranjan
CS & IT Aisect University Hazaribag
I would like to express my online voting system to all those who gave
me the possibility to complete this report. Special thinks is due to my help
to Mr. Shivam Santosh, stimulating suggestions and encouragement helped
me in all time of fabrication process and writing this report.
It is always a great relief when you are done with something you have been
working on for a long time. It is the same when complete your final project.
Unlike other assignments, a project is successfully completed with the
mental and moral guidance of your mentors, principal, family, friends, etc.
While submitting a project, you are supposed to acknowledge all those
who helped you directly or indirectly in the completion of your project.
Learn how to write an acknowledgement for a university project .
Page Index
1. INTRODUCTION…………………………………………………………………….1-3
2. ANALYSIS……………………………………………………………………………..4-5
3. FEASIBILITY STUDY………………………………………………………………...6-9
4. DESIGN……………………………………………………………………………….10-20
CONCLUSION…………………………………………………………………………… 27
Table Index
1. DATABASE TABLE…………………………………………………………………26
1.1 ADMIN TABLE…………………………………………………………………...26
1.2 VOTER INFORMATION DATA TABLE………………………………………26
Figure Index
COMMUNICATION INTERFACE…………………………………………………15
DATA FLOW DIAGRAMS…………………………………………………………..17
DFD: LEVEL 0………………………………………………………………………17
DFD: LEVEL 1……………………………………………………………………….18
DFD: LEVEL 2……………………………………………………………………….19
ER DIAGRAMS
DIAGRAM
INTRODUCTION-:
“ONLINE VOTING SYSTEM” is an online voting technique. It is based on the other online
services like “ONLINE RESERVATION SYSTEM” .In this system people who have
citizenship of INDIA and whose age is above 18 years of any sex can give his\her vote online
without going to any polling booth. There is a DATABASE which is maintained by the
ELECTION COMMISION OF INDIA in which all the names of voter with complete
information is stored.
WORKING-:
In “ONLINE VOTING SYSTEM” a voter can use his\her voting right online without any
difficulty. He\She has to fill a registration form to register himself\herself. All the entries is
checked by the DATABASE which has already all information about the voter. If all the entries
are correct then a USER ID and PASSWORD is given to the voter, by using that ID and
PASSWORD he\she can use his\her vote. If conditions are wrong then that entry will be
discarded.
UNIT-1
INTRODUCTION
1.1 Purpose
In “ONLINE VOTING SYSTEM” a voter can use his\her voting right online without any
difficulty. He\She has to fill a registration form to register himself\herself. All the entries is
checked by the DATABASE which has already all information about the voter. If all the entries
are correct then a USER ID and PASSWORD is given to the voter, by using that ID and
PASSWORD he\she can use his\her vote. If conditions are wrong then that entry will be
discarded.
1.2 Scope
The scope of the project that is hosted on the server. There is a DATABASE which is
maintained by the ELECTION COMMISION OF INDIA in which all the names of voter with
complete information is stored.
1.4 Overview
✓ Project is related to Online Voting System.
✓ The project maintains two levels of users:-
• Administrator Level
• Voter Level
✓ Main facilities available in this project are:-
• Maintaining voter’s Identification.
• Providing online voting management.
• Providing Updation of voter’s information.
• Provide voter information to ELECTION COMMISION OF INDIA.
• ELECTION COMMISION OF INDIA maintains the complete
information of voter.
• Voter can give his\her vote from any part of India.
UNIT-2
OVERALL DESCRIPTION
1. Planned approach towards working: - The working in the organization will be well planned
and organized. The data will be stored properly in data stores, which will help in retrieval of
information as well as its storage.
2. Accuracy: - The level of accuracy in the proposed system will be higher. All operation would
be done correctly and it ensures that whatever information is coming from the center is accurate.
3. Reliability: - The reliability of the proposed system will be high due to the above stated
reasons. The reason for the increased reliability of the system is that now there would be proper
storage of information.
4. No Redundancy: - In the proposed system utmost care would be that no information is
repeated anywhere, in storage or otherwise. This would assure economic use of storage space
and consistency in the data stored.
5. Immediate retrieval of information: - The main objective of proposed system is to provide
for a quick and efficient retrieval of information.
6. Immediate storage of information: - In manual system there are many problems to store the
largest amount of information.
7. Easy to Operate: - The system should be easy to operate and should be such that it can be
developed within a short period of time and fit in the limited budget of the user.
2.2 Background
ONLINE VOTING SYSTEM is a voting system by which any Voter can use his\her voting rights
from any where in India. ONLINE VOTING SYSTEM contains-:
• Voter’s information in database.
• Voter’s Names with ID.
• Voter’s vote in a database.
• Calculation of total number of votes.
Various operational works that are done in the system are:-
• Recording information of the Voter in Voter database.
• Checking of information filled by voter.
• Discard the false information.
• Each information is sent to ELECTION COMMISSION OF INDIA.
2.5 Constraints
✓ GUI is only in English.
✓ Login and password is used for identification of Voter.
Depending on the results of the initial investigation the survey is now expanded to a more detailed
feasibility study. “FEASIBILITY STUDY” is a test of system proposal according to its
workability, impact of the organization, ability to meet needs and effective use of the resources.
It focuses on these major questions:
1. What are the user’s demonstrable needs and how does a candidate system meet them?
2. What resources are available for given candidate system?
3. What are the likely impacts of the candidate system on the organization?
4. Whether it is worth to solve the problem?
During feasibility analysis for this project, following primary areas of interest are to be
considered. Investigation and generating ideas about a new system does this.
Steps in feasibility analysis
Eight steps involved in the feasibility analysis are:
• This is concerned with specifying equipment and software that will successfully satisfy
the user requirement. The technical needs of the system may include:
Front-end selection:
1. It must have a GUI that assists employees that are not from IT background.
2. Scalability and extensibility.
3. Flexibility.
4. Robustness.
5. According to the organization requirement and the culture.
6. Must provide excellent reporting features with good printing support.
7. Platform independent.
8. Easy to debug and maintain.
9. Event driven programming facility.
10. Front end must support some popular back end like Ms Access.
According to the above stated features we selected PHP as the front-end for
developing our project.
Back-end Selection:
1. Multiple user support.
2. Efficient data handling.
3. Provide inherent features for security.
4. Efficient data retrieval and maintenance.
5. Stored procedures.
6. Popularity.
7. Operating System compatible.
8. Easy to install.
Economic justification is generally the “Bottom Line” consideration for most systems. Economic
justification includes a broad range of concerns that includes cost benefit analysis. In this we
weight the cost and the benefits associated with the candidate system and if it suits the basic
purpose of the organization i.e. profit making, the project is making to the analysis and design
phase.
The financial and the economic questions during the preliminary investigation are
verified to estimate the following:
• The cost to conduct a full system investigation.
• The cost of hardware and software for the class of application being considered.
. The benefits in the form of reduced cost.
• The proposed system will give the minute information, as a result the
performance is improved
• This feasibility checks whether the system can be developed with the available funds.
The Online voting system does not require enormous amount of money to be developed.
This can be done economically if planned judicially, so it is economically feasible. The
cost of project depends upon the number of man-hours required.
• What new skills will be required? Do the existing staff members have these
skills? If not, can they be trained in due course of time?
The system is operationally feasible as it very easy for the End users to operate it. It only needs
basic information about Windows platform.
4.1.1 Objective:
4.1.2 Scope:-
2. Internet: It is an online facility and hence very useful for the users.
Voters can vote from any where at any time in India.
3. E-Mails: ELECTION COMMISION OF INDIA can send the error report to a
particular user if he\she entered false information.
4. E-SMS: People they have not internet connection they can not check the emails or
not have email they can be informed by SMS on their mobile. Today many websites
provide free SMS to the mobile. ELECTION COMMISION OF INDIA can use
these to send any information.
4.1.3 Advantages:
• It reduces the paper work and makes the work less tedious for ELESTION
COMMISION.
4.1.5 OVERVIEW:
1. Requirements:
• FUNCTIONAL REQUIREMENTS:
• ELECTION COMMISION OF INDIA can change the information any time if required.
• Registration of the Voter depends upon the information filled by the user.
Voter can give vote after login and entering the ID and PASSWORD.
•
• In the DATABASE information of every voter is stored.
•
• Database shows the information of every user.
• NON-FUNCTIONAL REQUIREMENTS:
1. Secure access of confidential data (user’s details). SSL can be used.
2. 24 X 7 availability.
3. Better component design to get better performance at peak time.
4. Flexible service based architecture will be highly desirable for future extension
2. Project Requirements
3. Software interface:
HTTP/HTT
HTML Client
PS
XAMPP
MYSQL
Server
Client TCP/IP
software
(System
The above diagram shows the connectivity between the client side, application server and
database server. The client or customer can access the HTML server or client software. These
are connected to the Wamp Server (XAMPP) by a TCP/IP which is a communication protocol
used to connect the teachers or parents to the internet. This XAMPP Server now directly
communicates with the database made in MYSQL. All the enquires or data will be retrieved
from the database.
4.1.6 Summary:
“ONLINE VOTING SYSTEM” is an online voting technique. It is based on the other online
services like “ONLINE RESERVATION SYSTEM” .In this system people who have
citizenship of INDIA and whose age is above 18 years of any sex can give his\her vote online
without going to any polling booth. There is a DATABASE which is maintained by the
ELECTION COMMISION OF INDIA in which all the names of voter with complete
information is stored.
DFD: Level 0
User
or
Administrator
System
Output
The above diagram is a 0-level DFD that only shows the flow of data between the various
and the system. In online voting system the Administrator is the controller of the system and
all the decisions are made by him. The Administrator can handle the entire voter and their
details, voting details etc. and view details of them and he can update that detail also.
Login Voter
Process Registration
Process
Voter Voting
information Process Final
checking Report
process
DFD Level 1
The above shown diagram is a 1-level Data Flow Diagram for the Online voting system.
According to this DFD various process are done after login process. The Administrator can
register voter. The ELECTION COMMISION can register the voters and voter can use their
voting rights. The voter can view the final report after giving vote..
. DFD: Level 2
2.1:-
Login
Login Process
ElectionCommission
Admin. Registration
Fail VOTER
id Pas
s
VOTING
Login
Voting Report
Report
View
The entity relationship diagram shows the relationship between the various users and their
attributes. There is a relationship between the election commission and voter.
The VOTER has different attributes to store their data to data base are follows:-
1. Name-Name contain first name, middle name, last name.
2. Age (should be above 18 years)
3. City
4. State
5. Father’s/Husband Name
6. Address
7. Phone number (Permanent)
8. Phone number (Mobile)
9. Email address
CONCLUSION
This Online Voting system will manage the Voter’s information by which voter can login and
use his voting rights. The system will incorporate all features of Voting system. Its provide
the tools for maintaining voter’s vote to every party and it count total no. of votes of every
party. There is a DATABASE which is maintained by the ELECTION COMMISION OF
INDIA in which all the names of voter with complete information is stored.
In this user who is above 18 year’s register his/her information on the database and when
he/she want to vote he/she has to login by his id and password and can vote to any party only
single time. Voting detail store in database and the result is displayed by calculation. By online
voting system percentage of voting is increases. It decreases the cost and time of voting process.
It is very easy to use and It is vary less time consuming. It is very easy to debug.
SOURCE CODE
PHP
Home page:-
<div class="content-wrapper">
<div class="container">
}
if(isset($_SESSION['success'])){
echo "
<div class='alert alert-success alert-
dismissible'>
<button type='button' class='close' data-
dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-check'></i>
Success!</h4>
".$_SESSION['success']."
</div>
";
unset($_SESSION['success']);
}
?>
<?php
$sql = "SELECT * FROM votes WHERE voters_id =
'".$voter['id']."'";
$vquery = $conn->query($sql);
if($vquery->num_rows > 0){
?>
<div class="text-center">
<h3>You have already voted for this
election.</h3>
<a href="#view" data-toggle="modal" class="btn
btn-flat btn-primary btn-lg">View Ballot</a>
</div>
<?php
}
else{
?>
<!-- Voting Ballot -->
<form method="POST" id="ballotForm"
action="submit_ballot.php">
<?php
include 'includes/slugify.php';
$candidate = '';
$sql = "SELECT * FROM positions ORDER BY
priority ASC";
$query = $conn->query($sql);
while($row = $query->fetch_assoc()){
$sql = "SELECT * FROM candidates WHERE
position_id='".$row['id']."'";
$cquery = $conn->query($sql);
while($crow = $cquery->fetch_assoc()){
$slug =
slugify($row['description']);
$checked = '';
if(isset($_SESSION['post'][$slug])
){
$value =
$_SESSION['post'][$slug];
if(is_array($value)){
foreach($value as $val){
if($val ==
$crow['id']){
$checked =
'checked';
}
}
}
else{
if($value == $crow['id']){
$checked = 'checked';
}
}
}
$input = ($row['max_vote'] > 1) ?
'<input type="checkbox" class="flat-red '.$slug.'" name="'.$slug."[]".'"
value="'.$crow['id'].'" '.$checked.'>' : '<input type="radio" class="flat-red
'.$slug.'" name="'.slugify($row['description']).'" value="'.$crow['id'].'"
'.$checked.'>';
$image = (!empty($crow['photo']))
? 'images/'.$crow['photo'] : 'images/profile.jpg';
$candidate .= '
<li>
'.$input.'<button
type="button" class="btn btn-primary btn-sm btn-flat clist platform" data-
platform="'.$crow['platform'].'" data-fullname="'.$crow['firstname'].'
'.$crow['lastname'].'"><i class="fa fa-search"></i> Platform</button><img
src="'.$image.'" height="100px" width="100px" class="clist"><span class="cname
clist">'.$crow['firstname'].' '.$crow['lastname'].'</span>
</li>
';
}
echo '
<div class="row">
<div class="col-xs-12">
<div class="box box-solid"
id="'.$row['id'].'">
<div class="box-header
with-border">
<h3 class="box-
title"><b>'.$row['description'].'</b></h3>
</div>
<div class="box-body">
<p>'.$instruct.'
<span
class="pull-right">
<button
type="button" class="btn btn-success btn-sm btn-flat reset" data-
desc="'.slugify($row['description']).'"><i class="fa fa-refresh"></i>
Reset</button>
</span>
</p>
<div
id="candidate_list">
<ul>
'.$candida
te.'
</ul>
</div>
</div>
</div>
</div>
</div>
';
$candidate = '';
}
?>
<div class="text-center">
<button type="button" class="btn btn-
success btn-flat" id="preview"><i class="fa fa-file-text"></i>
Preview</button>
<button type="submit" class="btn btn-
primary btn-flat" name="vote"><i class="fa fa-check-square-o"></i>
Submit</button>
</div>
</form>
<!-- End Voting Ballot -->
<?php
}
?>
</div>
</div>
</section>
</div>
</div>
$('#preview').click(function(e){
e.preventDefault();
var form = $('#ballotForm').serialize();
if(form == ''){
$('.message').html('You must vote atleast one candidate');
$('#alert').show();
}
else{
$.ajax({
type: 'POST',
url: 'preview.php',
data: form,
dataType: 'json',
success: function(response){
if(response.error){
var errmsg = '';
var messages = response.message;
for (i in messages) {
errmsg += messages[i];
}
$('.message').html(errmsg);
$('#alert').show();
}
else{
$('#preview_modal').modal('show');
$('#preview_body').html(response.list);
}
}
});
}
});
});
</script>
</body>
</html>
Index Page :-
<?php
session_start();
if(isset($_SESSION['admin'])){
header('location: admin/home.php');
}
if(isset($_SESSION['voter'])){
header('location: home.php');
}
?>
<?php include 'includes/header.php'; ?>
<body class="hold-transition login-page">
<div class="login-box">
<div class="login-logo">
<b> Online Voting System</b>
</div>
<div class="login-box-body">
<p class="login-box-msg"> Voters Sign In Session</p>
Login Page :
<?php
session_start();
include 'includes/conn.php';
if(isset($_POST['login'])){
$voter = $_POST['voter'];
$password = $_POST['password'];
}
else{
$_SESSION['error'] = 'Input voter credentials first';
}
header('location: index.php');
?>
Logout :-
<?php
session_start();
session_destroy();
header('location: index.php');
?>
Submit Page:
<?php
include 'includes/session.php';
include 'includes/slugify.php';
if(isset($_POST['vote'])){
if(count($_POST) == 1){
$_SESSION['error'][] = 'Please vote atleast one candidate';
}
else{
$_SESSION['post'] = $_POST;
$sql = "SELECT * FROM positions";
$query = $conn->query($sql);
$error = false;
$sql_array = array();
while($row = $query->fetch_assoc()){
$position = slugify($row['description']);
$pos_id = $row['id'];
if(isset($_POST[$position])){
if($row['max_vote'] > 1){
if(count($_POST[$position]) > $row['max_vote']){
$error = true;
$_SESSION['error'][] = 'You can only choose
'.$row['max_vote'].' candidates for '.$row['description'];
}
else{
foreach($_POST[$position] as $key => $values){
$sql_array[] = "INSERT INTO votes (voters_id,
candidate_id, position_id) VALUES ('".$voter['id']."', '$values', '$pos_id')";
}
}
else{
$candidate = $_POST[$position];
$sql_array[] = "INSERT INTO votes (voters_id,
candidate_id, position_id) VALUES ('".$voter['id']."', '$candidate',
'$pos_id')";
}
if(!$error){
foreach($sql_array as $sql_row){
$conn->query($sql_row);
}
unset($_SESSION['post']);
$_SESSION['success'] = 'Ballot Submitted';
}
else{
$_SESSION['error'][] = 'Select candidates to vote first';
}
header('location: home.php');
?>