100% found this document useful (4 votes)
10K views59 pages

Online Voting System

mini project online voting system technology used here are php in frontend as well as backend for database mysql is used.

Uploaded by

Zendax
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
10K views59 pages

Online Voting System

mini project online voting system technology used here are php in frontend as well as backend for database mysql is used.

Uploaded by

Zendax
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

PROJECT ON:

’’ONLINE VOTING SYSTEM”


Academic Year 2021-2022

Submitted by:
SACHIN KUMAR -R1917663

Under The Guidance of:


MR. LAKSHMIPATHI V
DEPARTMENT OF COMPUTER SCIENCE
RCASC
BANGALORE-560054
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

DEPARTMENT OF COMPUTER SCIENCE

CERTIFICATE

This is to certify that SACHIN KUMAR (R1917663), have successfully


completed the project entitled “ONLINE VOTING SYSTEM” for 5th
Semester as a partial fulfilment of the requirements for the award of
Degree in Bachelor of Computer Applications, rewarded by the
Bengaluru City University of Academic Year 2021-2022.

______________________ ________________________

LAKSHMIPATHI V DR. PRATHIBHA V KALBURGI

Assistant Professor Dept of Computer Science

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

It’s quite difficult for an individual to make things possible without


the cooperation of others.It’s our privilege to thank all those who
have been with us from start to end.We wish to express our sincere
gratitude to our principal for her constant support and
cooperation.We express our sincere thanks to H.O.D of BCA
Department DR.PRATHIBHA V KALBURGI and to our project
guide,MR. LAKSHMIPATHI.V for their consecutive information and
useful suggestion which help us to complete our project successfully
on time.We wish to thank the member of teaching and non-teaching
staff of our department for their help during our project. Lastly, we
thank our PARENTS who supported me to complete my project on
time.
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.

DECLARATION

The project titled “ONLINE VOTING SYSTEM” is developed by me in the partial


fulfilment of Bengaluru City University. It is a systematic work carried by me under
the guidance of Mr. Lakshmipathi .V , Asst Professor in Computer Science
department, M S RAMAIAH COLLEGE OF ARTS SCIENCE AND COMMERCE,
Bengaluru-54.

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

An online voting system for Indian election is proposed


for the first time in this paper. The proposed model has
a greater security in the sense that voter high security
password is confirmed before the vote is accepted in
the main database of Election Commission of India. The
additional feature of the model is that the voter can
confirm if his/her vote has gone to correct
candidate/party. In this model a person can also vote
from outside of his/her allotted constituency or from
his/her preferred location. In the proposed system the
tallying of the votes will be done automatically, thus
saving a huge time and enabling Election Commissioner
of India to announce the result within a very short
period.
CONTENT
Chapter 1: Introduction
1.1 Objective
1.2 Scope
1.3 Existing System
1.4 Proposed System
1.5 Module Forms

Chapter 2: System Requirements


Chapter 3: System analysis
3.1 Feasibility Study

3.2 Database Design

3.5 Dataflow Diagram & ER Diagram

Chapter 4: Implementation
4.1 Source Code

Chapter-5: Snap Shots


Chapter-6: Testing
Chapter 7: Conclusion
Chapter 8: Bibliography
Chapter 9: Future Enhancement
1. INTRODUCTION

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.

1.3 EXISTING SYSTEM:


The Existing System of Election is running manually. The Voter has
to Visit to Booths to Vote a Candidate so there is wastage of Time.
The Voter has to manually register into the Voter List. Also Vote
counting has to be done manually. All the Information of the Voter
or Candidate is to be filling in manually. Voter must be present in
his/her Constituency to give his/her Vote. There are Electronic
Voting Machines used which Takes More Cost. The voting system
previously being used by the Government is a paper based system,
in which the voter simply picks up ballots sheets from electoral
officials, tick off who they would like to vote for, and then cast their
votes by merely handing over the ballot sheet back to electoral
official. Some of the existing systems are:

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:

• Voting time is very less.


• Less number of peoples required.
• Candidate details will be available on online•
• Admin can see the Result and Feedbacks easily.
• Accuracy of data is achieved.

1.5 MODULE FORM:


Voter Module

• 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

• Code editor - Notepad / VS Code / Sublime Text


• Browser - Chrome / Fire Fox
• XAMPP / WAMP / MAMP / LAMP
3. SYSTEM ANALYSIS

WHY IS SYSTEM ANALYSIS NECESSARY?

During system analysis some activities are carried out, such as


problem definition, design, implementation. Before designing
the actual system/project, you should know

• What is the problem?


• How to solve it?
• What are the technical factors required?
• What are its features and limitations?

If a system is designed without considering above activities


then the system will not work properly to the satisfaction of
user requirement. So system analysis is necessary to design
perfect and accurate system, which satisfies the user
requirement.

PURPOSE OF THE SYSTEM:

Complete citizen details where entered in master database with


verification citizens can login into polling and can enter votes.
Results will updates for every seconds of polling and updated in
database. Online Voting System helps to minimize the election duty
and counting polls and announcing results. In the modern world,
where maintain citizen details and verifying voters to enter their
votes. This system proves to be useful in reducing wastage of
unnecessary workload, time and maintenance free. This Online
Voting system helps citizens to enter their votes very easily and
effectively without any errors. An application helps to check all
nominee details form different constituency. Nominee details are
available to all public in this application with their photo and
personal

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:

ENTITY: A source of data or a destination for data.

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

4.1 SOURCE CODE


REGISTER PAGE:
<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 Registration </h1>
<div class="news"><marquee behavior="alternate">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"><?php require('connection.php');

23
//Process
if (isset($_POST['submit']))
{
$myFirstName = addslashes( $_POST['firstname'] ); //prevents
types of SQL injection

$myLastName = addslashes( $_POST['lastname'] ); //prevents types


of SQL injection

$myEmail = $_POST['email'];

$myPassword = $_POST['password'];

$newpass = md5($myPassword); //This will make your password


encrypted into md5, a high security hash

$sql = mysqli_query($con, "INSERT INTO tbMembers(first_name,


last_name, email,password)

VALUES

('$myFirstName','$myLastName', '$myEmail', '$newpass') ");

die( "You have registered for an account.<br><br>Go to <a


href=\"index.php\">Login</a>" );

echo "<center><h3>Register an account by filling in the needed


information below:</h3></center><br><br>";

echo '<form action="registeracc.php" method="post"


onsubmit="return registerValidate(this)">';

echo '<table align="center"><tr><td>';

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>Last Name:</td><td><input type='text'


style='background-color:#999999; font-weight:bold;'
name='lastname' maxlength='15' value=''></td></tr>";

echo "<tr><td>Email Address:</td><td><input type='email'


style='background-color:#999999; font-weight:bold;' name='email'
maxlength='100' id='email'value=''></td><td><span id='result'
style='color:red;'></span></td></tr>";

echo "<tr><td>Password:</td><td><input type='password'


style='background-color:#999999; font-weight:bold;'
name='password' maxlength='15' value=''></td></tr>";

echo "<tr><td>Confirm Password:</td><td><input type='password'


style='background-color:#999999; font-weight:bold;'
name='ConfirmPassword' maxlength='15' value=''></td></tr>";

echo "<tr><td>&nbsp;</td><td><input type='submit'


name='submit' value='Register Account'/></td></tr>";

echo "<tr><td colspan = '2'><p>Already have an account? <a


href='index.php'><b>Login Here</b></a></td></tr>";

echo "</tr></td></table>";

echo "</form>";

?>

</div>

<div id="footer">

25
<div class="bottom_addr">&copy; 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>

<form name="form1" method="post" action="checklogin.php"


onsubmit="return loginValidate(this)">

<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1"
bgcolor="tan">

<tr>

<td width="78">Username/Email</td>

<td width="6">:</td>

<td width="294"><input name="myusername" type="text"


id="myusername"></td>

</tr>

<tr>

<td>Password</td>

<td>:</td>

<td><input name="mypassword" type="password"


id="mypassword"></td>

</tr>

<tr>
<td>&nbsp;</td>
<td>&nbsp;</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>

<!-- <br>Return to <a href="http://www.anu.ac.ke"><b>ANU Home


Page</b></a> -->

</center>

</div>

<div id="footer">

<div class="bottom_addr">&copy; 2022 Simple PHP Polling System.


All Rights Reserved</div>

</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>

<link href="css/admin_styles.css" rel="stylesheet" type="text/css"


/>

</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>ADMINISTRATION CONTROL PANEL </h1>

<a href="admin.php">Home</a> | <a


href="positions.php">Manage Positions</a> | <a
href="candidates.php">Manage Candidates</a> | <a
href="refresh.php">Poll Results</a> | <a href="manage-
30
admins.php">Manage Account</a> | <a href="change-
pass.php">Change Password</a> | <a
href="logout.php">Logout</a>

</div>

<p align="center">&nbsp;</p>

<div id="container">

<p>Click a link above to perform an administrative operation.</p>

</div>

<div id="footer">

<div class="bottom_addr">&copy; 2022 Simple PHP Polling System.


All Rights Reserved</div>

</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>

<td><input type="hidden" id="str" value="<?php echo


$_REQUEST['position']; ?>" /></td>

<td><input type="submit" name="Submit" value="See


Candidates" /></td>

</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</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 "<td><input type='radio' name='vote'


value='$row[candidate_name]' onclick='getVote(this.value)'
/></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>&nbsp;</td>
</tr>

39
</form>
</table>
<center><span id="error"></span></center>
</div>
<div id="footer">
<div class="bottom_addr">&copy; 2022 Simple PHP Polling System.
All Rights Reserved</div>

</div>
</div>
</body>
</html>

VOTE RESULT:
<?php

require('../connection.php');

// retrieving candidate(s) results based on position

if (isset($_POST['Submit'])){

/*

$resulta = mysqli_query($con, "SELECT * FROM tbCandidates


where candidate_name='Luis Nani'");

while($row1 = mysqli_fetch_array($resulta))

40
$candidate_1=$row1['candidate_cvotes'];

*/

$position = addslashes( $_POST['position'] );

$results = mysqli_query($con, "SELECT * FROM tbCandidates


where candidate_position='$position'");

$row1 = mysqli_fetch_array($results); // for the first candidate

$row2 = mysqli_fetch_array($results); // for the second candidate

if ($row1){

$candidate_name_1=$row1['candidate_name']; // first
candidate name

$candidate_1=$row1['candidate_cvotes']; // first candidate


votes

if ($row2){

$candidate_name_2=$row2['candidate_name']; // second
candidate name

$candidate_2=$row2['candidate_cvotes']; // second candidate


votes

else

41
// do nothing

?>

<?php

// retrieving positions sql query

$positions=mysqli_query($con, "SELECT * FROM tbPositions");

?>

<?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>

<link href="css/admin_styles.css" rel="stylesheet" type="text/css"


/>

42
<script language="JavaScript" src="js/admin.js">

</script>

</head><body bgcolor="tan">

<center><b><font color = "white" size="6">Online voting Poll


System</font></b></center><br><br>

<div id="page">

<div id="header">

<h1>POLL RESULTS </h1>

<a href="admin.php">Home</a> | <a


href="positions.php">Manage Positions</a> | <a
href="candidates.php">Manage Candidates</a> | <a
href="refresh.php">Poll Results</a> | <a href="manage-
admins.php">Manage Account</a> | <a href="change-
pass.php">Change Password</a> | <a
href="logout.php">Logout</a>

</div>

<div id="container">

<table width="420" align="center">

<form name="fmNames" id="fmNames" method="post"


action="refresh.php" onSubmit="return positionValidate(this)">

<tr>

<td>Choose Position</td>

<td><SELECT NAME="position" id="position">

43
<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);

?>

</SELECT></td>

<td><input type="submit" name="Submit" value="See Results"


/></td>

</tr>

<tr>

<td>&nbsp;</td>

<td>&nbsp;</td>

</tr>

</form>

</table>

<?php if(isset($_POST['Submit'])){echo $candidate_name_1;}


?>:<br>

44
<img src="images/candidate-1.gif"

width='<?php if(isset($_POST['Submit'])){ if ($candidate_2 ||


$candidate_1 !=
0){echo(100*round($candidate_1/($candidate_2+$candidate_1),2))
;}} ?>'

height='20'>

<?php if(isset($_POST['Submit'])){ if ($candidate_2 || $candidate_1


!=
0){echo(100*round($candidate_1/($candidate_2+$candidate_1),2))
;}} ?>% of <?php if(isset($_POST['Submit'])){echo $totalvotes;} ?>
total votes

<br>votes <?php if(isset($_POST['Submit'])){ echo $candidate_1;}


?>

<br>

<br>

<?php if(isset($_POST['Submit'])){ echo $candidate_name_2;}


?>:<br>

<img src="images/candidate-2.gif"

width='<?php if(isset($_POST['Submit'])){ if ($candidate_2 ||


$candidate_1 !=
0){echo(100*round($candidate_2/($candidate_2+$candidate_1),2))
;}} ?>'

height='20'>

<?php if(isset($_POST['Submit'])){ if ($candidate_2 || $candidate_1


!=

45
0){echo(100*round($candidate_2/($candidate_2+$candidate_1),2))
;}} ?>% of <?php if(isset($_POST['Submit'])){echo $totalvotes;} ?>
total votes

<br>votes <?php if(isset($_POST['Submit'])){ echo $candidate_2;}


?>

</div>

<div id="footer">

<div class=”bottom_addr”>&copy; 2022 Simple PHP Polling System.


All Rights Reserved</div>

</div>

</div>

</body></html>

46
5. SNAPSHOTS
REGISTER PAGE

REGISTRATION SUCCESSFUL

47
STUDENT LOGIN

CANDIDATE SELECTION

48
VOTING SUCCESSFUL

LOGOUT AFTER VOTING

49
DEFAULT

ADMIN LOGIN

50
ADMINISTRATION CONTROL PANEL

POLL RESULTS

51
ADMIN LOGOUT

52
6. TESTING

Testing is the most important phases in the software


development activity

The main aim of the testing process in the quality, the


developed software is tested against attaining the
required functionality and performance.

During the testing process the software is worked with some


particular test case and the output of the test cases are
analysed whether the software is working according to the
expectations or not.
The success of the testing process in determining the error is
mostly depending upon the test case criteria, for testing any
software we need to have a description of the expected
behaviour of the system and method of determining whether
the observed behaviour confirmed to the expected behaviour.

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

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. It
provides the tools for maintaining voter’s vote to every party
and it count total number of votes of every party. There is a
DATABASE which is maintained by the electoral commission in
which all the names of voter with complete information is
stored.

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

You might also like