Online Voting System
Online Voting System
Submitted by:
SACHIN KUMAR -R1917663
CERTIFICATE
______________________ ________________________
External Examiners
1._________________
2. __________________
M.S. Ramaiah College of Arts, Science and
Commerce
Re-accredited ‘A’ by NAAC, Permanently Affiliated to Bengaluru City
University, Approved by Government of Karnataka, Approved by AICTE, New
Delhi, Recognized by UGC under 2F and 12B Of UGC act 1956.
ACKNOWLEDGEMENT
DECLARATION
I, declare that this project has not been submitted to any degree or diploma to
Bengaluru City University or any other university.
Submitted by:
SACHIN KUMAR -R1917663
DATE:
SIGNATURE:
ABSTRACT
Chapter 4: Implementation
4.1 Source Code
1.1 OBJECTIVE:
An online voting system is a software platform that allows groups
to securely conduct votes and elections. High-quality online voting
systems balance ballot, security accessibility and the overall
requirements of an organisations voting event
Online voting system is a web application which is developed to
conduct election process through internet. This application is made
in PHP and MySQL. The main objective of this project is handling
elections very efficiently and fast without any manual work, which
avoids lots of social problems with a responsibility. More than
technology and features this will become a trust worthy application.
1.2 SCOPE:
The scope of the project is that it will use the ID and password
created by user to register him/her in the voting site, through this
all the details of voter are saved in database. The Online Voting
System platform can be made more secure by using the following
methods
• Password Changing
• Fingerprinting
• Cornea Detection
The password used by the user to vote is provided by the
administrator. In the future the user can be given the privilege of
changing the password. So it helps to increase the security of the
system. The other two methods that can be used are cornea
detection and fingerprinting. But here the problem is that it
decreases the scope of the platform because these systems need
some electronic components to implement. So it will avoid the users
privilege to cast the votes at their fingertips. But it can guarantee
that fake voting will be impossible.
i. Paper-based voting
ii. Direct recording electronic voting machine
iii. Punch card
1.4 PROPOSED SYSTEM:
In our proposed system the list of candidates who are nominating
will be available in the online. The voter’s wants to fill a registration
form and the administrator will gives rights for voting process. Once
the permission is granted the user can login using their own
username and password. After enter their username and password
verification code will generate and send to their mail id, users must
enter their verification code to login. Then only users can vote for
favourite candidate. Once the voting process is completed the
report will be generated at the same time. The candidate with the
maximum vote is regarded as a Winner among the user. It saves
time, avoid error in counting and there will be no invalid votes. It
makes the voting process easy and it will be effective manner.
ADVANTAGES:
• Voter Registration
• Voter Login
• Voter Dashboard - Voter can see his profile info, voting status,
and list of groups
• Voting - Voter can choose to vote to anyone group listed in his
dashboard
• Logout
Group Module
• Group Registration
• Group Login
• Dashboard - Group can see its profile info, voting status, and
list of groups
• Voting - Group can choose to vote to anyone group listed in his
dashboard
• Logout
2. SYSTEM REQUIREMENT
SOFTWARE REQUIREMENTS:
There is use of large software in developing this project software is
basically the logical program that handles different components
which cannot be touched or felt and helps to interact with one
another in a Hassle-free manner.
The software used here consist of:
Technologies used
• Front-End - HTML & CSS
• Back-End - PHP
• Database – MySQL
Applications Required
FEASIBILITY STUDY
The feasibility of the project is analysed in this phase and
business proposal is put forth with a very general plan for the
project and some cost estimates. During system analysis the
feasibility study of the proposed system is to be carried out.
This is to ensure that the proposed system is not a burden to
the company. For feasibility analysis, sot) understanding of
the major requirements for the term is essential. That key
considerations involved In the feasibility analysis are
economic , technical , social and operational feasibility.
ECONOMICAL FEASIBILITY
This study is carried out to check the economic impact that the
system will have on the organization. The amount of fund that the
company can pour into the research and development of the
system is limited. The expenditures must be justified. Thus the
developed system as well within the budget and this was achieved
because most of the technologies used are freely available. Only
the customized products had to be purchased.
TECHNICAL FEASIBILITY
This study is carried out to check the technical feasibility, that is, the
technical requirements of the system. Any system developed must
not have a high demand on the available technical resources. This
will lead to high demands on the available technical resources. This
will lead to high demands being placed on the client. The developed
system must have a modest requirement, as only minimal or null
changes are required for implementing this system.
SOCIAL FEASIBILITY
The aspect of study is to check the level of acceptance of the
system by the user. This includes the process of training the user
to use the system efficiently. The user must not feel threatened by
the system, instead must accept it as a necessity. The level of
acceptance by the users solely depends on the methods that are
employed to educate the user about the system and to make him
familiar with it. His level of confidence must be raised so that he is
also able to make some constructive criticism, which is welcomed,
as he is the final user of the system
OPERATIONAL FEASIBILITY
It is a measure of how well a proposed system solves the problems,
and takes advantage of the opportunities identified during scope
definition and how it satisfies the requirements identified in the
requirements analysis phase of system development.
SYSTEM DESIGN
DATA FLOW DIAGRAM:
DFD is a graphics representation of system that shows data flow to,
frame and with in the system, processing functions that change
data in some manner and the storage this data.The project
dictionary contains an entry for each DFD developed during
analysis. Thus there is a context diagram. A top level DFD and
detailed diagrams for all top level functions and their components.
Each DFD has a unique number and can be reference by that
number.DFD are nothing but more than network of a related
system functions (processing of data) that indicate from where
information (data) is received (inputs) and to where it is send
(outputs). It is also called as bubble charges.
DFD SYMBOLS:
In DFD there are four symbols:
PROCESS:
task that is performed by the system.
DATA STORE:
A place where data is held between processes.
DATA FLOW:
DFD- 0 -LEVEL
17
DFD LEVEL 2:
18
E-R DIAGRAM:
19
DATABASE DESIGN
Database Name: OV
OVS ADMIN
ID Number, Primary Key
UNAME Varchar2(50)
PWD Varchar2(50)
OVS CONSTI
CID Number, Primary Key
CNAME Varchar2(50)
SNAME Varchar2(50)
OVS ELECT
EID Number, primary key
ECODE Varchar2(50)
CONSTI Varchar2(50)
EDATE Varchar2(50)
ESTATUS Varchar2(50)
OVS NOMINEE
NID Number, Primary Key
ECODE Varchar2(50)
ECONS Varchar2(50)
NOM NAM Varchar2(50)
NOM GEN Varchar2(10)
NOM ADDR Varchar2(50)
NOM PAR Varchar2(50)
NOM PIC Varchar2(100)
20
NOM SIGN Varchar2(100)
VOTE Number
OVS PARTY
PID Number, Primary Key
PNAME Varchar2(100)
OVS STATE
SID Number, Primary Key
SNAME Varchar2(100)
OVS USER
Number, Primary Key
USID
USNAME Varchar2(50)
GEN Varchar2(50)
DOB Varchar2(200)
ADNO Varchar2(50)
CONSTI Varchar2(50)
PATH Varchar2(200)
STATUS Varchar2(50)
PWD Varchar2(50)
21
OVS VOTE
VID Number, Primary Key
VOTER_ID Varchar2(50)
ELECT_CODE Varchar2(50)
NOM_ID Varchar2(200)
NOM_NAME Varchar2(50)
NOM CONSTI Varchar2(50)
NOM PARTY Varchar2(200)
VOTE Varchar2(50)
22
4. IMPLEMENTATION
</div>
<div id="container"><?php require('connection.php');
23
//Process
if (isset($_POST['submit']))
{
$myFirstName = addslashes( $_POST['firstname'] ); //prevents
types of SQL injection
$myEmail = $_POST['email'];
$myPassword = $_POST['password'];
VALUES
24
echo "<tr><td>First Name:</td><td><input type='text'
style='background-color:#999999; font-weight:bold;'
name='firstname' maxlength='15' value=''></td></tr>";
echo "</tr></td></table>";
echo "</form>";
?>
</div>
<div id="footer">
25
<div class="bottom_addr">© 2022 Simple PHP Polling System.
All Rights Reserved</div>
</div>
</div>
</body>
<script src="js/jquery-1.2.6.min.js"></script>
<script>
$(document).ready(function()
{
$('#email').blur(function(event)
{
event.preventDefault();
var emailId=$('#email').val();
$.ajax({
url:'checkuser.php',
method:'post',
data:{email:emailId},
dataType:'html',
success:function(message)
{
$('#result').html(message);
}
});
26
});
});
</script>
</html>
STUDENT LOGIN:
<html><head>
<link href="css/user_styles.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="js/user.js">
</script>
</head><body bgcolor="tan">
<center><b><font color = "white" size="6">ONLINE VOTING POLL
</font></b></center>
<br><br>
<div id="page">
<div id="header">
<h1>Student Login </h1>
<div class="news"><marquee>New polls are up and running. But
they will not be up forever! Just Login and then go to Current Polls
to vote for your favourate candidates. </marquee></div>
</div>
<div id="container">
27
<table width="300" border="0" align="center" cellpadding="0"
cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1"
bgcolor="tan">
<tr>
<td width="78">Username/Email</td>
<td width="6">:</td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
</tr>
<tr>
<td> </td>
<td> </td>
28
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<center>
<br>Not yet registered? <a href="registeracc.php"><b>Register
Here</b></a>
</center>
</div>
<div id="footer">
</div>
</div>
</body></html>
29
ADMIN LOGIN:
<?php
session_start();
require('../connection.php');
//If your session isn't valid, it returns you to the login screen for
protection
if(empty($_SESSION['admin_id'])){
header("location:access-denied.php");
?>
<html><head>
</head><body bgcolor="tan">
<div id="page">
<div id="header">
</div>
<p align="center"> </p>
<div id="container">
</div>
<div id="footer">
</div>
</div>
</body></html>
31
VOTE PAGE:
<?php
require('connection.php');
session_start();
//If your session isn't valid, it returns you to the login screen for
protection
if(empty($_SESSION['member_id'])){
header("location:access-denied.php");
}
?>
<?php
// retrieving positions sql query
$positions=mysqli_query($con, "SELECT * FROM tbPositions");
?>
<?php
// retrieval sql query
// check if Submit is set in POST
if (isset($_POST['Submit']))
{
// get position value
$position = addslashes( $_POST['position'] ); //prevents types of
SQL injection
32
// retrieve based on position
$result = mysqli_query($con,"SELECT * FROM tbCandidates WHERE
candidate_position='$position'");
// redirect back to vote
//header("Location: vote.php");
}
else
// do something
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Online Voting Poll:Voting Page</title>
<link href="css/user_styles.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="js/user.js">
</script>
<script type="text/javascript">
function getVote(int)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
33
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if(confirm("Your vote is for "+int))
{
var pos=document.getElementById("str").value;
var id=document.getElementById("hidden").value;
xmlhttp.open("GET","save.php?vote="+int+"&user_id="+id+"&posi
tion="+pos,true);
xmlhttp.send();
xmlhttp.onreadystatechange =function()
{
if(xmlhttp.readyState ==4 && xmlhttp.status==200)
{
// alert("dfdfd");
document.getElementById("error").innerHTML=xmlhttp.responseT
ext;
}
}
}
else
{
34
alert("Choose another candidate ");
}
}
function getPosition(String)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","vote.php?position="+String,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
$(document).ready(function(){
var j = jQuery.noConflict();
j(document).ready(function()
{
35
j(".refresh").everyTime(1000,function(i){
j.ajax({
url: "admin/refresh.php",
cache: false,
success: function(html){
j(".refresh").html(html);
}
})
})
});
j('.refresh').css({color:"green"});
});
</script>
</head>
<body bgcolor="tan">
<center>
<b><font color = "white" size="6">Online Voting
Poll</font></b></center><br><br>
<body>
<div id="page">
<div id="header">
<h1>CURRENT POLLS</h1>
36
<a href="student.php">Home</a> | <a href="vote.php">Current
Polls</a> | <a href="manage-profile.php">Manage My Profile</a>
| <a href="changepass.php">Change Password</a>| <a
href="logout.php">Logout</a>
</div>
<div class="refresh">
</div>
<div id="container">
<table width="420" align="center">
<form name="fmNames" id="fmNames" method="post"
action="vote.php" onSubmit="return positionValidate(this)">
<tr>
<td>Choose Position</td>
<td><SELECT NAME="position" id="position"
onclick="getPosition(this.value)">
<OPTION VALUE="select">select
<?php
//loop through all table rows
while ($row=mysqli_fetch_array($positions)){
echo "<OPTION
VALUE=$row[position_name]>$row[position_name]";
//mysql_free_result($positions_retrieved);
//mysql_close($link);
}
37
?>
</SELECT></td>
<td><input type="hidden" id="hidden" value="<?php echo
$_SESSION['member_id']; ?>" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</form>
</table>
<table width="270" align="center">
<form>
<tr>
<th>Candidates:</th>
</tr>
<?php
//loop through all table rows
//if (mysql_num_rows($result)>0){
38
if (isset($_POST['Submit']))
{
while ($row=mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['candidate_name']."</td>";
echo "</tr>";
}
mysqli_free_result($result);
mysqli_close($con);
//}
}
else
// do nothing
?>
<tr>
<h3>NB: Click a circle under a respective candidate to cast your
vote. You can't vote more than once in a respective position. This
process can not be undone so think wisely before casting your
vote.</h3>
<td> </td>
</tr>
39
</form>
</table>
<center><span id="error"></span></center>
</div>
<div id="footer">
<div class="bottom_addr">© 2022 Simple PHP Polling System.
All Rights Reserved</div>
</div>
</div>
</body>
</html>
VOTE RESULT:
<?php
require('../connection.php');
if (isset($_POST['Submit'])){
/*
while($row1 = mysqli_fetch_array($resulta))
40
$candidate_1=$row1['candidate_cvotes'];
*/
if ($row1){
$candidate_name_1=$row1['candidate_name']; // first
candidate name
if ($row2){
$candidate_name_2=$row2['candidate_name']; // second
candidate name
else
41
// do nothing
?>
<?php
?>
<?php
session_start();
//If your session isn't valid, it returns you to the login screen for
protection
if(empty($_SESSION['admin_id'])){
header("location:access-denied.php");
?>
<?php
if(isset($_POST['Submit'])){$totalvotes=$candidate_1+$candidate_
2;} ?>
<html><head>
42
<script language="JavaScript" src="js/admin.js">
</script>
</head><body bgcolor="tan">
<div id="page">
<div id="header">
</div>
<div id="container">
<tr>
<td>Choose Position</td>
43
<OPTION VALUE="select">select
<?php
while ($row=mysqli_fetch_array($positions)){
echo "<OPTION
VALUE=$row[position_name]>$row[position_name]";
//mysql_free_result($positions_retrieved);
//mysql_close($link);
?>
</SELECT></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</form>
</table>
44
<img src="images/candidate-1.gif"
height='20'>
<br>
<br>
<img src="images/candidate-2.gif"
height='20'>
45
0){echo(100*round($candidate_2/($candidate_2+$candidate_1),2))
;}} ?>% of <?php if(isset($_POST['Submit'])){echo $totalvotes;} ?>
total votes
</div>
<div id="footer">
</div>
</div>
</body></html>
46
5. SNAPSHOTS
REGISTER PAGE
REGISTRATION SUCCESSFUL
47
STUDENT LOGIN
CANDIDATE SELECTION
48
VOTING SUCCESSFUL
49
DEFAULT
ADMIN LOGIN
50
ADMINISTRATION CONTROL PANEL
POLL RESULTS
51
ADMIN LOGOUT
52
6. TESTING
53
UNIT TESTING:
A software verification and validation method in which a
programmer tests if individual units/ components of a
software is tested. Unit Testing of software applications is
done during the development (coding) of an application. The
objective of Unit Testing is to isolate a section of code and
verify its correctness.
SYSTEM TESTING:
System Testing is the process of testing an integrated
hardware and software system to verify that the system meets
its specified requirements.
ACCEPTANCE TESTING:
Formal testing conducted to determine whether or not a
system satisfies its acceptance criteria and to enable the
customer to determine whether or not to accept the system.
It is usually performed the customer.
54
7. CONCLUSION
55
8. BIBLIOGRAPHY
YOUTUBE REFERENCE:
https://www.youtube.com/watch?v=p0SudLYnO00
https://www.youtube.com/watch?v=vGkLzMKpKLM&list=PLmxWW4anc_KC
VP7kGzGXYut_xc0_FAYc9
https://www.youtube.com/watch?v=E9bRLp0bgm4
WEBSITE REFERENCE:
https://nevonprojects.com/online-election-system-project-php/
https://www.geeksforgeeks.org/project-idea-online-voting-portal/
https://projectworlds.in/free-projects/php-projects/online-voting-system-
project-in-php-2/
OTHER SITES
https://www.youtube.com/watch?v=83TeR8zOrjY
https://www.phptpoint.com/projects/online-voting-system/
56
9. FUTURE ENHANCEMENT
THE GOAL:
• Making it a large scale idea of casting votes in INDIA through online
polling system.
• To achieve heights of multinational companies and SEBI certification
to change the market of voting in the country.
• Giving this idea the taste of reality in this era of pandemic.
• Formulating the politics of INDIA in terms online approach.
• Creating more job oppurtunities throughout the country.
ADVANTAGES:
• Avoiding on field polling booth conflicts during election.
• Facilitating the old aged , underprivileged ,physically challenged
citizens of INDIA.
• Marginalising fraud voting in the country.
• Introducing ONLINE VOTING SYSTEM in times of pandemic is a
fruitful step , since the world is turning digital every second.
• Terminating the red alert period of elections days , since every voter
will be casting votes at home without undergoing the long hour old
school procedure.
• Yet another sector of DIGITAL INDIA .
57
58
59