[go: up one dir, main page]

0% found this document useful (0 votes)
2K views44 pages

1.1. Online Voting System

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 44

INTRODUCTION

In this chapter, the basic introduction of Online Voting is described and also the basic
information about windows operating system & PHP is described.

India is a constitutional democracy with a parliamentary system of government, and at


the heart of the system is a commitment to hold regular, free and fair elections. These
elections determine the composition of the government, the membership of the two
houses of parliament, the state and union territory legislative assemblies, and the
Presidency and vice-presidency. Elections are conducted according to the
constitutional provisions, supplemented by laws made by Parliament.
1.1. Online Voting System
The aim of the project is to create and manage polling and election details. This is a
system which enables all citizens to cast their vote online. Increasing the voting
percentage across the country is the major goal of this project. People have to visit the
booth to cast their vote in the present system across the country. This system is online
and hence even people who live out of their home town can also vote. Database of all
the eligible citizens and candidates are maintained by the system .
By using the Online Voting system people who have citizenship of INDIA and whose
age is above 18 years of any [censored] can give his\her vote online without going to
any polling booth. 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.
The most crucial factor for a system like e-VOTE to be successful is to exhibit a
Voting Protocol that can prevent opportunities for fraud or for sacrificing the voter's
privacy.
The Voting Protocol that will be designed and implemented for the e-VOTE system
will combine the advantages of existing protocols and techniques, while at the same

1
time it will aim at eliminating most of the identified deficiencies and problems. The
related attributes that the e-VOTE system will fully support, and against which it will
be extensively tested and validated, are listed below. These attributes can be also
considered, according to the literature, as a set of criteria for a "good" electronic
voting system that can easily enjoy the trust and confidence of the voters and process
organizers.
Any voter may change his place of residence between two elections and regarding this
case if the authority is not informed they are not considered as the voter of that area
though he is a voter as per the constitution. Therefore he misses the opportunity to
confer his opinion. Even if he is registered voter of his new locality it is often seen
that he is still existing voter of his old area. Thereby he can vote twice which is
illegal.
1.1.1. Modules

1. Admin:

In this administrator module the election commissioner or admin having the


authorization to access this one. Admin is the super user of the system. In this module
admin or election officer will get the requests from the General users and Nomination
candidates.

In this module admin will receive the all registration request from users. By checking
verification details, the admin will take decision like accept. Admin should give the
acceptance to the candidates those who have send for party candidates register.

2. Candidate:

In this Module the Admin will manage the profile of candidate. Firstly the admin will
collect the details of candidate then the admin will register the candidate by filling up
the details and party details of candidate. This details will displayed at the user site for
knowing the details and voting the candidate.

3. User (Voter):

As a general user he can visit the site. If the user wants to vote registration then he
enters to registration interface from this can make a request to the system or admin

2
providing all information about including his photo, address details. Anyone can
register for online that either the user having new or existing. The request will be goes
to Admin. The User has to wait up to verification. After Verification has done
successfully then that can have rights to access or enter into his home page. By user
interface he can make vote for required candidate on particular election Date.

4. Registration:

This is a module through this general user can registered himself as Voter. The user
should provide the Entire information about him regarding address, contact No, E-
Mail Id etc. User should Upload the his image at the time of registration and also the
address proof such as electricity bill.

5. Login:

In this Module the general user that is voter can login into their account by username
and password, after login the voter can give vote to candidate if there is election
scheduled on that date.

6. Results:

This module is comes under admin module as sub module. By the admin can know
entire details about voter Registration and different party candidate details. By this
admin can know the Candidates count by Area wise. The candidate having highest
count will be winner of election.

1.1.2 Advantages
 Cost effectiveness:
Online voting reduces election budgets by limiting production costs. Paper,
printing, and postage costs are all significantly lower for online elections than
for traditional voting methods. In addition, staff will save time because online
elections eliminate the need to assemble ballot packages and manually tabulate
votes.
 Security and confidentiality:
A properly designed, secure online voting system has safeguards in place to
protect voting information and voter identities. A voting website hosted on a

3
secure server will only be accessible to authorized members through unique
voter logins.
 Eco-friendly:
Web-based balloting conserves resources by reducing the amount of paper
associated with an election. Paper ballots, envelopes, flyers, and other paper
collateral are either moved to electronic format or eliminated. This is
particularly important if your association members are sensitive to the use of
natural resources.
 Fast, accurate results:
With online voting there are no rejected, mismarked or invalid ballots. Results
are automatically calculated, eliminating the need for manual tabulation and
dreaded recounts. Computerized tabulation allows election managers to
quickly announce decisions and results.
 Empowerment:
Voting is the most powerful way for members to have a voice in the leadership
and direction of their association. When allowed to vote in fair and open
elections, members feel a greater sense of value, ownership, and
responsibility. Online elections help empower members of associations,
societies, and other democratic organizations by making voting easy and
convenient.
 Accessibility:
Online voting allows association members to access their ballots from
anywhere at any time, provided they have an Internet connection. This makes
casting a vote convenient and fast. Members can cast their votes from home,
from work or “on the go” via their mobile devices.
1.1.3 Disadvantages
 May be harmful and very vulnerable
 Can be corrupted internally and externally
 May have software issues
 Harder to learn for the non-techy individual
 Requires Internet Connection For Voting.
 It requires large database.

4
1.2 Windows Operating System
Windows OS, computer operating system (OS) developed by Microsoft
Corporation to run personal computers (PCs). The first version of Windows, released
in 1985, was simply a GUI offered as an extension of Microsoft’s existing disk
operating system, or MS-DOS.
Subsequent versions introduced greater functionality, including native Windows File
Manager, Program Manager, and Print Manager programs, and a
more dynamic interface. The 1995 consumer release Windows 95
fully integrated Windows and DOS and offered built-in Internet support, including
the Web browser Internet Explorer.
With the 2001 release of Windows XP, Microsoft united its various Windows
packages under a single banner, offering multiple editions for consumers, businesses,
multimedia developers, and others.
Windows XP abandoned the long-used Windows 95 kernel (core software code) for a
more powerful code base and offered a more practical interface and improved
application and memory management.
The highly successful XP standard was succeeded in late 2006 by Windows Vista,
which experienced a troubled rollout and met with considerable marketplace
resistance, quickly acquiring a reputation for being a large, slow, and resource-
consuming system. Responding to Vista’s disappointing adoption rate, Microsoft in
2009 released Windows 7, an OS whose interface was similar to that of Vista but was
met with enthusiasm for its noticeable speed improvement and its modest system
requirements.
Windows 8 in 2012 offered a start screen with applications appearing as tiles on a grid
and the ability to synchronize settings so users could log on to another Windows
8 machine and use their preferred settings.
In 2015 Microsoft released Windows 10, which came with Cortana, a digital personal
assistant like Apple’s Siri, and the Web browser Microsoft Edge, which replaced
Internet Explorer. Microsoft also announced that Windows 10 would be the last
version of Windows, meaning that users would receive regular updates to the OS but
that no more large-scale revisions would be done.

5
1.2.1 Advantages & Disadvantages
 Advantages:
1. Ease: Microsoft Windows has made much advancement and changes which
made it easy to use the operating system. Even though it is not the easiest, it is
easier than linux.
2. Software: Since there are more number of Microsoft users there are more
software programs, games and utilities for windows. All most all games are
compatible to windows, some CPU intensive and graphic intensive games are
also supported.
3. Hardware: All hardware manufacturers will support Microsoft windows. Due
to large number of Microsoft users and broader driver, all the hardware
devices are supported.
4. Front Page Extension: When using a popular web design program having
windows hosting makes it lot more easier. You don’t have to worry if it
supported or not.
5. Development: If you plan to develop windows based applications then
windows platform is most suggested as linux does not support windows
applications.
 Disadvantage:
1. Price: Microsoft windows is costly compared to Linux as each license costs
between $50.00-$100.00.
2. Security: When compared to linux it is much more prone to viruses and other
attacks.
3. Reliability: It needs to be rebooted periodically else there is a possibility of
hang up of the system.
4. Software Cost: Even though the windows have softwares,games for free most
of the programs will cost more than $200.
1.3 History of Php

PHP: Hypertext Preprocessor (or simply PHP) is a server-side scripting language


designed for web development but also used as a general-purpose programming
language. It was originally created by Rasmus Lerdorf in 1994, the PHP reference
implementation is now produced by The PHP Group. PHP originally stood

6
for Personal Home Page, but it now stands for the recursive acronym PHP: Hypertext
Pre-processor.

PHP code may be embedded into HTML code, or it can be used in combination with
various web template systems, web content management systems, and web
frameworks. PHP code is usually processed by a PHP interpreter implemented as
a module in the web server or as a Common Gateway Interface (CGI) executable. The
web server combines the results of the interpreted and executed PHP code, which may
be any type of data, including images, with the generated web page. PHP code may
also be executed with a command-line interface (CLI) and can be used to
implement standalone graphical applications.

The standard PHP interpreter, powered by the Zend Engine, is free software released
under the PHP License. PHP has been widely ported and can be deployed on most
web servers on almost every operating system and platform, free of charge.

The PHP language evolved without a written formal specification or standard until
2014, leaving the canonical PHP interpreter as a de facto standard. Since 2014 work
has gone on to create a formal PHP specification.

7
Chapter 2

PROGRAMMING CONCEPT

In this chapter we are going to discuss the list of different programming languages
and programming language which is used in our project i.e. php language. The
database connectivity using mysql in android is also described.

2.1 Different Programming Languages

Fig2.1: Programming Languages.

2.2 HTML

HTML stands for Hyper Text Markup Language, which is the most widely used
language on Web to develop web pages. HTML was created by Berners-Lee in late
1991 but "HTML 2.0" was the first standard HTML specification which was
published in 1995. HTML 4.01 was a major version of HTML and it was published
in late 1999. Though HTML 4.01 version is widely used but currently we are having
HTML-5 version which is an extension to HTML 4.01, and this version was
published in 2012.

8
HTML stands for Hypertext Markup Language, and it is the most widely used
language to write Web Pages.

 Hypertext refers to the way in which Web pages (HTML documents) are
linked together. Thus, the link available on a webpage is called Hypertext.

 As its name suggests, HTML is a Markup Language which means you use
HTML to simply "mark-up" a text document with tags that tell a Web browser
how to structure it to display.

Originally, HTML was developed with the intent of defining the structure of
documents like headings, paragraphs, lists, and so forth to facilitate the sharing of
scientific information between researchers.

Now, HTML is being widely used to format web pages with the help of different
tags available in HTML language.

2.2.1 Basic HTML Document


In its simplest form, following is an example of an HTML document −

<!DOCTYPE html>

<html> <head>

<title>This is document title</title>

</head>

<body> <h1>This is a heading</h1>

<p>Document content goes here.....</p>

</body>

</html>

2.2.2 Heading Tags


Any document starts with a heading. You can use different sizes for your headings.
HTML also has six levels of headings, which use the elements <h1>, <h2>, <h3>,
<h4>, <h5>, and <h6>. While displaying any heading, browser adds one line before
and one line after that heading.

9
2.2.3 Line Break Tag
Whenever you use the <br /> element, anything following it starts from the next line.
This tag is an example of an empty element, where you do not need opening and
closing tags, as there is nothing to go in between them.

The <br /> tag has a space between the characters br and the forward slash. If you
omit this space, older browsers will have trouble rendering the line break, while if
you miss the forward slash character and just use <br> it is not valid in XHTML.

Table 2.1: Basic Tags in Html

Start Tag Content End tag

<p> This is paragraph content. </p>

<h1> This is heading content. </h1>

<div> This is division content. </div>

2.2.4 Insert Image


You can insert any image in your web page by using <img> tag. Following is the
simple syntax to use this tag.

<img src = "Image URL" ... attributes-list/>

The <img> tag is an empty tag, which means that, it can contain only list of attributes
and it has no closing tag.

2.2.5 Table in html

The HTML tables allow web authors to arrange data like text, images, links, other
tables, etc. into rows and columns of cells.

The HTML tables are created using the <table> tag in which the <tr> tag is used to
create table rows and <td> tag is used to create data cells. The elements under <td>
are regular and left aligned by default

10
2.2.5.1 Table Heading
Table heading can be defined using <th> tag. This tag will be put to replace <td> tag,
which is used to represent actual data cell. Headings, which are defined in <th> tag
are centred and bold by default.
2.2.5.2 Tables Backgrounds
You can set table background using one of the following two ways −

 bgcolor attribute − You can set background color for whole table or just for
one cell.

 background attribute − You can set background image for whole table or just
for one cell.

2.2.6 List in Html

HTML offers web authors three ways for specifying lists of information. All lists
must contain one or more list elements. Lists may contain –

 <ul> − An unordered list. This will list items using plain bullets.

 <ol> − An ordered list. This will use different schemes of numbers to list your
items.

 <dl> − A definition list. This arranges your items in the same way as they are
arranged in a dictionary.

2.3 CSS

Cascading Style Sheets (CSS) is a style sheet language used for describing
the presentation of a document written in a markup language like HTML. CSS is a
cornerstone technology of the World Wide Web, alongside HTML and JavaScript.

CSS is designed to enable the separation of presentation and content,


including layout, colors, and fonts. This separation can improve content accessibility,
provide more flexibility and control in the specification of presentation
characteristics, enable multiple web pages to share formatting by specifying the
relevant CSS in a separate .css file, and reduce complexity and repetition in the
structural content.

11
HTML was originally designed as a simple way of presenting information intended
for sharing scientific documents and research papers online.
Later on, as the Internet expanded from the academic and research world into the
mainstream, and became more media oriented, the presentation of the web pages has
become considerably important for a website's success.
To improve web presentation capabilities CSS was introduced by World Wide Web
consortium's (W3C). It was intended to allow web designers to define the look and
feel of their web pages, and to separate content from document's layout.

For example:

<style>

p{ color: red;

text-align: center; }

</style>

2.3.1 Advantages of Using CSS


The biggest advantage of CSS is that it allows separating content of an html document
from the style and layout of that document. It can thus make documents much easier
to maintain and give much better control over the layout of your web pages, because
content of an entire set of HTML pages can be easily controlled using one or more
style sheets.
Here are some more advantages, why one should opt for designing website using
CSS?
 CSS Save lots of time — CSS gives lots of flexibility to set the properties of
an element. You can write CSS once; and then the same code can be applied to
the groups of HTML elements, and can also be reused in multiple HTML
pages.
 Easy maintenance — CSS provide an easy means to update document
formatting and maintain consistency across multiple documents. By making
one change to the website's CSS, elements in all the web pages will be updated
automatically.
 Pages load faster — CSS enable multiple pages to share formatting, and
reduce complexity and repetition in the structural content. It significantly
reduces the file transfer size, which results in a faster page loading.
12
 Superior styles to HTML — CSS has much wider presentation capabilities
than HTML, so you can give far better look to your HTML pages in
comparison to the HTML presentational elements and attributes.
 Multiple Device Compatibility — CSS can also allow the HTML document
to be optimized for more than one type of device or media.
Using CSS the same HTML document can be presented in different viewing
styles for different rendering devices such as computer screen, cell phones,
printer, etc.

2.3.2 CSS Selectors


Table2.2: CSS selectors

Selector Example Example description

.class .intro Selects all elements with class="intro"

#id #firstname Selects the element with


id="firstname"

* * Selects all elements

2.4 PHP

The PHP Hypertext Preprocessor (PHP) is a programming language that allows web
developers to create dynamic content that interacts with databases. PHP is basically
used for developing web based software applications.

To get a feel for PHP, first start with simple PHP scripts. Since "Hello, World!" is an
essential example, first we will create a friendly little "Hello, World!" script.

PHP is embedded in HTML. That means that in amongst your normal HTML (or
XHTML if you're cutting-edge) you'll have PHP statements like this-

Ex:

<?php echo "<h1>Hello, PHP!</h1>"; ?>

13
PHP is a server side scripting language that is embedded in HTML. It is used to
manage dynamic content, databases, session tracking, even build entire e-commerce
sites. It is integrated with a number of popular databases, including MySQL,
PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.

PHP is pleasingly zippy in its execution, especially when compiled as an Apache


module on the Unix side. The MySQL server, once started, executes even very
complex queries with huge result sets in record-setting time.

PHP supports a large number of major protocols such as POP3, IMAP, and LDAP.
PHP4 added support for Java and distributed object architectures (COM and
CORBA), making n-tier development a possibility for the first time.

In order to develop and run PHP Web pages three vital components need to be
installed on your computer system.

 Web Server − PHP will work with virtually all Web Server software,
including Microsoft's Internet Information Server (IIS) but then most often
used is freely available Apache Server. Download Apache for free here-
https://httpd.apache.org/download.cgi.

 Database − PHP will work with virtually all database software, including
Oracle and Sybase but most commonly used is freely available MySQL
database. Download MySQL for free here-
https://www.mysql.com/downloads/

 PHP Parser − In order to process PHP script instructions a parser must be


installed to generate HTML output that can be sent to the Web Browser. This
tutorial will guide you how to install PHP parser on your computer.

2.4.1 Common uses of PHP


 PHP performs system functions, i.e. from files on a system it can create, open,
read, write, and close them.
 PHP can handle forms, i.e. gather data from files, save data to a file, through
email you can send data, return data to the user.
 You add, delete, modify elements within your database through PHP.
 Access cookies variables and set cookies.

14
 Using PHP, you can restrict users to access some pages of your website.
 It can encrypt data.

2.4.2 Characteristics of PHP


Five important characteristics make PHP's practical nature possible −

 Simplicity
 Efficiency
 Security
 Flexibility
 Familiarity

2.4.3 Php session


An alternative way to make data accessible across the various pages of an entire
website is to use a PHP Session.

A session creates a file in a temporary directory on the server where registered


session variables and their values are stored. This data will be available to all pages
on the site during that visit.

The location of the temporary file is determined by a setting in the php.ini file
called session.save_path. Before using any session variable make sure you have setup
this path.

When a session is started following things happen −

 PHP first creates a unique identifier for that particular session which is a
random string of 32 hexadecimal numbers such as
3c7foj34c3jj973hjkop2fc937e3443.

 A cookie called PHPSESSID is automatically sent to the user's computer to


store unique session identification string.

2.4.3.1 Starting a PHP Session


A PHP session is easily started by making a call to the session_start()function.This
function first checks if a session is already started and if none is started then it starts
one. It is recommended to put the call to session_start() at the beginning of the page.

15
Session variables are stored in associative array called $_SESSION[]. These variables
can be accessed during lifetime of a session.

2.4.3.2 Destroying a PHP Session

A PHP session can be destroyed by session_destroy() function. This function does


not need any argument and a single call can destroy all the session variables. If you
want to destroy a single session variable then you can use unset() function to unset a
session variable.

2.4.4 File Uploading


A PHP script can be used with a HTML form to allow users to upload files to the
server. Initially files are uploaded into a temporary directory and then relocated to a
target destination by a PHP script.

Information in the phpinfo.php page describes the temporary directory that is used for
file uploads as upload_tmp_dir and the maximum permitted size of files that can be
uploaded is stated as upload_max_filesize. These parameters are set into PHP
configuration file php.ini. The process of uploading a file follows these steps

 The user opens the page containing a HTML form featuring a text files, a
browse button and a submit button.

 The user clicks the browse button and selects a file to upload from the local
PC.

 The full path to the selected file appears in the text filed then the user clicks
the submit button.

 The selected file is sent to the temporary directory on the server.

 The PHP script that was specified as the form handler in the form's action
attribute checks that the file has arrived and then copies the file into an
intended directory.

 The PHP script confirms the success to the user.

2.4.4.1 Creating an upload script


There is one global PHP variable called $_FILES. This variable is an associate
double dimension array and keeps all the information related to uploaded file. So if

16
the value assigned to the input's name attribute in uploading form was file, then PHP
would create following five variables

 $_FILES['file']['tmp_name'] − the uploaded file in the temporary directory


on the web server.

 $_FILES['file']['name'] − the actual name of the uploaded file.

 $_FILES['file']['size'] − the size in bytes of the uploaded file.

 $_FILES['file']['type'] − the MIME type of the uploaded file.

 $_FILES['file']['error'] − the error code associated with this file upload.

2.4.5 Sending Email using PHP


PHP must be configured correctly in the php.ini file with the details of how your
system sends email. Open php.ini file available in /etc/ directory and find the section
headed [mail function].

Windows users should ensure that two directives are supplied. The first is called
SMTP that defines your email server address. The second is called sendmail_from
which defines your own email address.

 The configuration for Windows should look something like this


[mail function]
; For Win32 only.
SMTP = smtp.secureserver.net
; For win32 only
sendmail_from = webmaster@tutorialspoint.com
Linux users simply need to let PHP know the location of their sendmail application.
The path and any desired switches should be specified to the sendmail_path directive.

 The configuration for Linux should look something like this

[mail function]
; For Win32 only.
SMTP =
; For win32 only
sendmail_from =
17
; For Unix only
sendmail_path = /usr/sbin/sendmail -t –i
2.4.5.1 Sending plain text email

PHP makes use of mail() function to send an email. This function requires three
mandatory arguments that specify the recipient's email address, the subject of the the
message and the actual message additionally there are other two optional parameters.

mail( to, subject, message, headers, parameters );

Table 2.3: Parameters in mail function

Sr.No Parameter & Description

1 To
Required. Specifies the receiver / receivers of the email
2 subject
Required. Specifies the subject of the email. This parameter cannot
contain any newline characters
3 message
Required. Defines the message to be sent. Each line should be
separated with a LF (\n). Lines should not exceed 70 characters
4 headers
Optional. Specifies additional headers, like From, Cc, and Bcc. The
additional headers should be separated with a CRLF (\r\n)
5 parameters
Optional. Specifies an additional parameter to the send mail program

2.5 MySQL
MySQL is the most popular Open Source Relational SQL Database Management
System. MySQL is one of the best RDBMS being used for developing various web-
based software applications. MySQL is developed, marketed and supported by
MySQL AB, which is a Swedish company.

2.5.1 History of Mysql

MySQL was created by a Swedish company, MySQL AB, founded by David


Axmark, Allan Larsson and Michael "Monty" Widenius. Original development of

18
MySQL by Widenius and Axmark began in 1994. The first version of MySQL
appeared on 23 May 1995. It was initially created for personal usage
from mSQL based on the low-level language ISAM, which the creators considered
too slow and inflexible. They created a new SQL interface, while keeping the
same API as mSQL. By keeping the API consistent with the mSQL system, many
developers were able to use MySQL instead of the (proprietarily licensed) mSQL
antecedent.

2.5.2 Connecting to MySQL Database Server

In PHP you can easily do this using the mysqli_connect() function. All
communication between PHP and the MySQL database server takes place through
this connection. Here're the basic syntaxes for connecting to MySQL using MySQLi
and PDO extensions:

 Syntax: MySQLi, Procedural way

$link = mysqli_connect("hostname", "username", "password", "database");

 Syntax: MySQLi, Object Oriented way

$mysqli = new mysqli("hostname", "username", "password", "database");

 Syntax: PHP Data Objects (PDO) way

$pdo = new PDO("mysql:host=hostname;dbname=database", "username",


"password");

The hostname parameter in the above syntax specify the host name (e.g. localhost), or
IP address of the MySQL server, whereas the username and password parameters
specifies the credentials to access MySQL server, and the database parameter, if
provided will specify the default MySQL database to be used when performing
queries.

2.5.3. Create Tables


The table creation command requires −

 Name of the table


 Names of fields

19
 Definitions for each field

Syntax

Here is generic SQL syntax to create a MySQLi table

CREATE TABLE table_name (column_name column_type);

Example:

$sql = "create table tutorials_inf( id INT AUTO_INCREMENT,name


VARCHAR(20) NOT NULL,primary key (id))";

mysqli_query($conn, $sql);

2.5.4 Drop Tables

It is very easy to drop an existing MySQLi table, but you need to be very careful
while deleting any existing table because data lost will not be recovered after deleting
a table.

Syntax

Here is generic SQL syntax to drop a MySQLi table

DROP TABLE table_name ;

2.5.5 Insert Query

To insert data into MySQLi table, you would need to use SQL INSERT INTO
command. You can insert data into MySQLi table by using mysql> prompt or by
using any script like PHP.

Syntax

Here is generic SQL syntax of INSERT INTO command to insert data into MySQLi
table:

INSERT INTO table_name ( field1, field2,...fieldN ) VALUES ( value1,


value2,...valueN );

20
2.5.6. Select Query
The SQL SELECT command is used to fetch data from MySQLi database. You can
use this command at mysql> prompt as well as in any script like PHP.

Syntax
Here is generic SQL syntax of SELECT command to fetch data from MySQLi table −
SELECT field1, field2,...fieldN table_name1, table_name2...
[WHERE Clause] [OFFSET M ][LIMIT N]

 You can use one or more tables separated by comma to include various
conditions using a WHERE clause, but WHERE clause is an optional part of
SELECT command.
 You can fetch one or more fields in a single SELECT command.
 You can specify star (*) in place of fields. In this case, SELECT will return all
the fields.
 You can specify any condition using WHERE clause.
 You can specify an offset using OFFSET from where SELECT will start
returning records. By default offset is zero.
 You can limit the number of returns using LIMIT attribute.

2.5.7 Where Clause

We can use a conditional clause called WHERE clause to filter out results. Using
WHERE clause, we can specify a selection criteria to select required records from a
table.

Syntax

Here is generic SQL syntax of SELECT command with WHERE clause to fetch data
from MySQLi table

SELECT field1, field2,...fieldN table_name1, table_name2... [WHERE condition1


[AND [OR]] condition2.....

 You can use one or more tables separated by comma to include various
conditions using a WHERE clause, but WHERE clause is an optional part of
SELECT command.
 You can specify any condition using WHERE clause.

21
 You can specify more than one conditions using AND or OR operators.

A WHERE clause can be used along with DELETE or UPDATE SQL command also
to specify a condition. The WHERE clause works like an if condition in any
programming language. This clause is used to compare given value with the field
value available in MySQLi table. If given value from outside is equal to the available
field value in MySQLi table, then it returns that row.

Table 2.3 Operators used in Where Clause

Operator Description Example

= Checks if the values of two operands are equal or not, if (A = B) is


yes then condition becomes true. not true.

!= Checks if the values of two operands are equal or not, if (A != B)


values are not equal then condition becomes true. is true.

> Checks if the value of left operand is greater than the value (A > B) is
of right operand, if yes then condition becomes true. not true.

< Checks if the value of left operand is less than the value of (A < B) is
right operand, if yes then condition becomes true. true.

>= Checks if the value of left operand is greater than or equal (A >= B)
to the value of right operand, if yes then condition becomes is not true.
true.

<= Checks if the value of left operand is less than or equal to (A <= B)
the value of right operand, if yes then condition becomes is true.
true.

2.5.8 Update Query

There may be a requirement where existing data in a MySQLi table needs to be


modified. You can do so by using SQL UPDATE command. This will modify any
field value of any MySQLi table.

22
Syntax

Here is generic SQL syntax of UPDATE command to modify data into MySQLi table

UPDATE table_name SET field1 = new-value1, field2 = new-value2 [WHERE


Clause]

 You can update one or more field altogether.


 You can specify any condition using WHERE clause.
 You can update values in a single table at a time.

2.5.9 Delete Query

If you want to delete a record from any MySQLi table, then you can use SQL
command DELETE FROM. You can use this command at mysql> prompt as well as
in any script like PHP.

Syntax

Here is generic SQL syntax of DELETE command to delete data from a MySQLi
table

DELETE FROM table_name [WHERE Clause]

 If WHERE clause is not specified, then all the records will be deleted from the
given MySQLi table.
 You can specify any condition using WHERE clause.
 You can delete records in a single table at a time.

23
Chapter 3

IMPLEMENTATION

In this chapter we are going to discuss the implementation of our project and data
flow diagrams.

3.1. System Design

Software Design sits at the technical kernel of the Software Engineering Process and
is applied regardless of the development paradigm and area of application. Design is
the first step in the development phase for any engineered product or System.

The importance can be stated with a single word “Quality”. Design is the place where
quality is fostered in software development.

Design is only way that we can accurately translate a customer’s view into a finished
software product or system.

During design, progressive refinement of data structure, program structure, and


procedural details are developed reviewed and documented. System design can be
viewed from either technical or project management perspective.

System design is the process of defining the components, modules, interfaces, and
data for a system to satisfy specified requirements. System development is the process
of creating or altering systems, along with the processes, practices, models, and
methodologies used to develop them.

3.2 Data Flow Diagram


A data flow diagram (DFD) is a graphical representation of the "flow" of data through
an information system, modelling its process aspects. A DFD is often used as a
preliminary step to create an overview of the system without going into great detail.

Following diagram shows the data flow sequence of admin working. As shown in the
fig3.1 admin have to create new election with adding the candidate details and their
party details. Admin have to allocate the area name to voter by verifying the voter
details. If the address proof given by user was not correct then admin will reject

24
his/her form. Also the admin can view the result that is voting count of each
candidate.

Fig3.1: DFD for Admin

Following diagram shows the data flow sequence of user’s (voters) working. As
shown in the fig3.2 voter have to register by filling up the details and submit the form.
For confirmation mail voter have to wait. The confirmation mail will send to voters
registered email account.

If the voter does not fill up the correct details his/her form will be rejected and he/she
has to register again. After successful registration on the date of election voter have to
login to their account by using username and password. After clicking login button
voter have to enter otp(one time password) for verification (the otp will send to
registered email account) and then give vote to the candidate. In this process the otp is
used for two step verification so, only authorized voter can access their account for
voting.

Fig3.2: DFD for Voter(User)

25
3.3 Activity Diagram

Activity diagram is another important diagram in UML to describe the dynamic


aspects of the system. Activity diagram is basically a flowchart to represent the flow
from one activity to another activity. The activity can be described as an operation of
the system. The control flow is drawn from one operation to another.

This flow can be sequential, branched, or concurrent. Activity diagrams deal with all
type of flow control by using different elements such as fork, join, etc. A small filled
circle followed by an arrow represents the initial action state or the start point for any
activity diagram. A fork node is used to split a single incoming flow into multiple
concurrent flows.

Following figure shows the activity diagram of voters working flow. The if the voter
have already registered voter then he/she can directly login and continue for voting
otherwise new user have to register first. In this process the browser and internet
connectivity to system is compulsory otherwise voter cannot go ahead for voting.

Fig3.3: Activity Diagram for Voter(user)

26
3.4 Sequence Diagram

Sequence diagrams describe interactions among classes in terms of an exchange of


messages over time. They're also called event diagrams. A sequence diagram is a
good way to visualize and validate various runtime scenarios. These can help to
predict how a system will behave and to discover responsibilities a class may need to
have in the process of modelling a new system. Activation boxes represent the time an
object needs to complete a task. Messages are arrows that represent communication
between objects.

 Model and document how your system will behave in various scenarios
 Validate the logic of complex operations and functions
Following diagram shows sequence diagram of admin working flow. The browser and
internet connectivity is required. The admin request to server for connectivity and
viewing the Gui. When the admin gets acknowledgement from server he/she can
perfrom further activities i.e creating new election, adding candidate details,
allocating area to voter and viewing the result.

Fig3.4: Sequence Diagram for Admin

Following diagram shows sequence diagram of voters working flow. The browser and
internet connectivity is required. The voter request to server for connectivity and
viewing the Gui. The server will provide the secure internet connectivity. When the

27
voter gets acknowledgement from server he/she can perform further activities i.e
registration, login, giving the vote.

Fig3.5: Sequence Diagram for Voter (user)

3.5 NetBeans

NetBeans is an integrated development environment (IDE) for Java. NetBeans allows


applications to be developed from a set of modular software components called
modules. NetBeans runs on Microsoft Windows, macOS, Linux and Solaris. In
addition to Java development, it has extensions for other languages like PHP, C, C++
and HTML5, Javadoc and Javascript. Applications based on NetBeans, including the
NetBeans IDE, can be extended by third party developers.

The process of installing NetBeans is very easy. Go to the website and just do it. You
need to pick the version of NetBeans you want and the one for PHP development is
listed as HTML5 & PHP. This still includes many features that you might never use
but at 63MBytes it isn't worth worrying too much. You can also install the entire
NetBeans suite and have Java and C++ support as well. It is also possible to add
features that you have left out and optional modules, but for the moment it will be
assumed that you have downloaded and installed the HTML5 & PHP version. You
will need to have Java JDK 7 or later installed to run NetBeans but the installer will
prompt you to do so if it is missing.

3.5.1 Creating the php project

28
The following figure shows creation of new php project in netbeans. The first step is
to create a simple php project using netbeans IDE. Follow the option File -> New ->
Project and select php application, then name the project of click on finish. The new
php project initially consist of index.php file.

Fig3.6: Creating new php project

3.5.2 Package Explorer

Before you run your php files, you should be aware of a few directories and files in
the php project:

Fig3.7: Package Explorer

Table 3.1: Description of Package Explorer


29
S.N Folder, File & Description

1. Election

This is the name of project. It contains subfolders and php files.

2. Css

This folder contains the css(cascading style sheet) files.

3. Img

This folder contains images used in project. The format of images are .jpg
and .png.

4. adminlogin.php

This is php file which contains the php and html code. There are some others
.php files also used in project.

3.6 Wamp Server

A fast way to get Windows, Apache, MySQL, PHP (WAMP) solution stack up and
running on Windows is to install a WAMP bundle. There are quite a few such
bundles, and they contain various extras.

Fig3.8: Wamp on Windows

30
Wamp Server refers to a software stack for the Microsoft Windows operating system,
created by Romain Bourdon and consisting of the Apache web server, OpenSSL for
SSL support, MySQL database and PHP programming language

The acronym WAMP refers to a set of free (open source) applications, combined
with Microsoft Windows, which are commonly used in Web server environments.
The WAMP stack provides developers with the four key elements of a web server:
an operating system, database, web server and web scripting software. The combined
usage of these programs is called a server stack. In this stack, Microsoft Windows is
the operating system (OS), Apache is the Web server, MySQL handles the database
components, while PHP, Python, or PERL represents the dynamic scripting
languages.

3.6.1 Advantages of WAMP :


 It is easy to Use. (Changing Configuration)
 WAMP makes easy to code PHP and Creating Data bases (in MySQL) in
Windows platform.
 WAMP is Available for both 64 bit and 32 bit system.

31
Chapter 4

RESULTS

In the previous chapter we have seen the implementation of application thus, in this
chapter we are going to discuss the snapshots of result of project. The snapshots are
given in three sections such as Admin, User and Database.

4.1 Admin
The following figure shows the home page of project where the user have to select the
appropriate section as admin or voter, where the admin will manage all the activities
such as creating the new election, adding the candidates, allocating the area name to
voters and the voter have account for voting the candidates.

Fig4.1: Home Page

32
Following figure shows the page of admin login from where the admin have to login
to their account with the valid username and password.

Fig4.2: Admin Login

Following figure shows page from where admin can create new election by filling and
submitting the details regarding new election. The admin have to select the type of
election that is election name.

Fig4.3: Creating New Election

33
Following figure shows candidate registration page for nagarsevak elections from
where admin have to add candidates of different areas.

Fig4.4: Nagarsevak Candidate Registration Form

Following figure shows candidate registration page for college elections. Admin have
to add candidates.

Fig4.5: College Candidate Registration Form

34
Following figure shows voter details page in which the list of voter is given admin
have to select the voter whom details admin wants to see.

Fig4.6: List of Voters

Following figure shows page of details of selected voter by admin. The admin have to
allocate the area name to voter when admin clicks on confirm button mail with
allocated area name is sent to voters email id.

Fig4.7: Voter Details

35
When the admin clicks on the id proof image the following page will be displayed.

Fig4.8: Id Proof

When the admin clicks on the address proof image the following page will be
displayed.

Fig4.9: Address Proof

36
Following figure shows the page in which the admin have to select the election name
for viewing the result of election.

Fig4.10: Display Result

Following figure shows the list of dates on which the election is scheduled. The
admin have to select any one date for viewing the result.

Fig4.11: List of Election Dates

37
Following figure shows page of results where the name of candidate, count of votes
and area name is displayed.

Fig4.12: Result

4.2 Voter

Following figure shows the terms. This terms should be agreed by the college voter
for continue to further registration.

Fig4.13: College User Panel

38
Following figure shows registration page of college voter. The new user have to
register first.

Fig4.14: College voter registration from

Following figure shows the terms. This terms should be agreed by the nagarsevak
voter for continue to further registration.

Fig4.15: Nagarsevak User Panel

39
Following figure shows registration page of nagarsevak voter. The new user have to
register first.

Fig4.16: Nagarsevak voter registration from

Following figure shows the login page of voter from where voter can sign in with the
valid username and password.

Fig4.17: Voter Login

40
Following figure shows field where the user have to enter otp(one time password)
which will sent on his/her registered email id. This otp step will used for two step
verification.

Fig4.18: OTP window

When the voter enters otp and login if there is no election on that day then following
window will appears.

Fig4.19: Election is not scheduled.

41
When voter enters otp and login to account and if there is election scheduled at that
day then following window will appears where the list of voter is given as per the
voter’s area.

Fig4.20: Voting Window

4.3 Database

Following figure shows the page of database in that table structure is shown.

Fig4.21: Election Database

42
CONCLUSION

In order to get better results in this study we tried to understand the paper‐based
polling system in India and not the least the drawbacks of the system. We have
studied different voting system with their advantages and disadvantages. The system
proposed in this project will not just convert the current manual system to an Online
voting system. People will be able to cast votes through their home PC with the
internet connectivity. A better database maintenance, automated registration system
and the process of casting vote using finger print will further help us to fulfil our
purpose. This Online Voting System provides the features such as cost effectiveness,
Security and confidentiality and easy accessibility.

43
REFERENCES

[1]. Steven Holzner, “The Complete Reference: PHP”, 1st Edition, ‘Publication: Mc
Graw Hill Education’.
[2]. Thomas Powell, “The Complete Reference: HTML & CSS”, 5th Edition,
‘Publication: Mc Graw Hill Education’.
[3]. https://www.tutorialspoint.com.
[4]. https://www.w3schools.
[5]. https://en.wikipedia.org.

44

You might also like