Sei sulla pagina 1di 131

AN ENHANCED WEB-BASED ELECTRONIC VOTING SYSTEM

NGIGE, OGOCHUKWU CONSTANCE


PG/14/0212
BSC(IMSU), PGD(UNILAG)

BEING A DISSERTATION SUBMITTED TO THE DEPARTMENT OF


COMPUTER SCIENCE SCHOOL OF COMPUTING
AND ENGINEERING SCIENCES IN PARTIAL
FUFILMENT OF THE REQUIREMENTS
FOR THE AWARD OF THE DEGREE
OF MASTER OF SCIENCE
BABCOCK UNIVERSITY
ILISHAN- REMO
OGUN STATE
NIGERIA

2017

i
CERTIFICATION

This dissertation titled, AN ENHANCED WEB-BASED ELECTRONIC VOTING


SYSTEM, prepared and submitted by NGIGE, OGOCHUKWU CONSTANCE in
partial fulfillment of the requirements for the degree of MASTER OF SCIENCE
(Management Information System), is hereby accepted.

_______________________
Professor Adekunle, Y.A.
Supervisor

Accepted as partial fulfillment of the requirements for the degree of MASTER OF


SCIENCE (Management Information Systems)

___________________________
Provost, College of Postgraduate Studies
Professor Yacob Haliso

ii
DEDICATION
This dissertation is dedicated to Almighty God

iii
ACKNOWLEDGEMENTS

I wish to thank the Almighty God for making it possible for me to successfully come to the end of
this programme. I lift up his name for the journey mercies and academic excellence which he
alone made possible all through the duration of this programme. My sincere thanks and
appreciation go to my dear husband, Mr. Emeka Ngige SAN for his encouragement, loving and
financial support. All these enabled me to be in the right frame of mind, and thus the successful
completion of the programme. I also appreciate my kids: Chioma, Uso, Donald and Chinua, that
had to endure periods of my absence at home during the course of my study. May God bless them
for me.

I appreciate my supervisor, prof. Adekunle for all his advice, suggestion as well as constructive
criticism of this research work. May God reward him eternally. I will also love to appreciate all
the lecturers in the Department of Computer Science who all helped to sharpen my knowledge all
through the duration of the programme. May the blessings of God be their lot, Amen. May God
bless Mr.Seun Ebiesewa, I am very grateful for his assistance. I treasure the compassionate
gentlemen and ladies that were my course mates during this programme. I cherish the wonderful
relationship we all had, and I will continue to thank God for making our paths cross. May God
bless and reward them.

iv
ABSTRACT

In recent years, information technology has greatly affected all aspects of our national life, and to
a large extent, this includes politics. One basic feature of democracy that cuts across all divides of
people is the act of election. Traditional manual methods of conducting elections are no longer
preferred because of the long period of preparation, violence, rigging, dis-enfranchization of
eligible voters, over-voting, mistakes made in counting the votes, long period of counting and high
cost of voting process etc. The most recent method being advocated for is electronic voting (e-
voting). E-voting is an election system that allows a voter to record his or her secure and secret
ballot electronically.
This work showed how e-voting through the use of mobile devices like tablets, Ipads and PCs
would totally eradicate all these problems as people would no longer go to election venues to cast
their votes, rather they would be at the comfort of their homes and offices to exercise their franchise
using any of these electronic devices effortlessly.
The application was achieved via means of object oriented software development with the .NET
framework. The core web services were implemented with the C# programming language. The
design structure was modularized and the design utilized the use of voter identification number
and password for voter authentication, as well as token generation for security.
In conclusion, the problems of trust and confidence in the electoral process in Nigeria can be solved
if the electoral body embarks on a web-based process. It is recommended that E-voting systems
should be certified by an independent agency and audits should be conducted throughout the
process to allow independent confirmation of the results produced.
Keywords: Electronic Voting, Permanent Voters Card, Voter Identification Number(VIN),
Election, Voter Validation
Word Count: 276

v
TABLE OF CONTENTS

Content Page
Title page i
Certification ii
Dedication iii
Acknowledgments iv
Abstract v
Table of Contents vi
List of Figures
List of Codes

CHAPTER ONE: INTRODUCTION

1.1 Background to the Study 1


1.1.1 Elections in Nigeria 2
1.1.2 The 2011 General Election 3
1.1.3 The 2015 General Election in Nigeria 3
1.1.4 Smart Card Readers 4
1.1.5 Electronic Voting 5
1.1.6 The Nigerian Electoral Process 6
1.2 Statement of the Problem 7
1.3 Objective of the Study 7
1.4 Methodology 7
1.5 Significance of the Study 8
1.6 Scope of the Study 9

vi
Content Page

CHAPTER TWO: REVIEW OF LITERATURE

2.0 Introduction 10
2.1 Types of E-Voting Systems 10
2.1.1 Forms of E-Voting 11
2.1.2 Properties of Electronic Voting Systems 12
2.2 Related Works 13

CHAPTER THREE: METHODOLOGY


3.0 Introduction 28
3.1.1 Ease of Use and Simplicity 30
3.1.2 Efficiency 30
3.1.3 Security 30
3.1.4 User Experience (UX) 31
3.1.5 Scalability 32
3.1.5.1 Programming Platform 33
3.1.5.2 Caching Mechanisms 33
3.1.5.3 Simplicity 33
3.1.5.4 Data Flow 33
3.1.5.5 Hardware Resources 33
3.1.6 Applied Methodology 34
3.2 Research Method 34
3.3 Research Tools 34
3.4 The Software Development 38
3.4.1 Planning Phase 38
3.4.2 Design 39
3.5 Hardware/Software Requirements 39
3.6 Ethical Consideration (Post- Research Benefits) 39

vii
Content Page
CHAPTER FOUR: DATA ANALYSIS, RESULTS AND
DISCUSSION OF FINDINGS
4.0 Introduction 40
4.1 Voter Validation 40
4.1.1 Voter Information 40
4.1.2 Token Generation 43
4.1.3 Voting 45
4.1.4 Result Display 47
4.1.5 Settings 48
4.1.6 Elections Controller 50
4.2 Discussion 56
4.2.1 Atribute of the Designed System 56
4.2.2 The Layout 57
4.2.3 The Web Services 58
4.2.4 User Experience and Simplicity 59
4.2.5 Application Security 61
4.2.6 Database Consideration 62
4.3: System Requirement 62
4.3.1: Software Requirements 62
4.3.2: Hardware Requirement 63

CHAPTER FIVE: SUMMARY, CONCLUSION AND


RECOMMENDATIONS
5.0 Introduction 64
5.1 Summary 64
5.2. Conclusion 64
5.3. Recommendations 65

References 66

Appendix 69

viii
LIST OF FIGURES

Figure Page
1.0: INEC Card Reader 4
2.0: Voting System Flow Chart 14
2.1: Flowchart for the Design of the Voting System 16
2.2: Template of a unified e-ID card 17
2.3: The Process flow Chart for the Biometric Authentication Process 18
2.4: The System Architecture of an E-Voting System 19
2.5: Modified System Architecture for an E-voting Platform 20
2.6: E-voting Architecture Based on EC-ELGAMAL 23
2.7: Secured E-Voting Platform 24
2.8: A REVS Protocol 26
3.0: A Permanent Voters Card Sample Showing the VIN Number 28
3.1: Process Flowchart for the Proposed System 29
3.2: The Electronic Voting System Architecture 35
3.3: The Entity-Relationship Diagram of the Proposed System 37
3.4: The Visual Concept 38
4.0: Landing Page 40
4.1: Voting Statistics and Avalaible Elections Page 41
4.2: Voter Activity Page 41
4.3: Voter Information page 42
4.4: The Start Page After Successful Log in 43
4.5: Toke Generation Page 43
4.6: Final Countdown Page 44
4.7: Token Generation and SMS Transfer Page 44
4.8: Token Verification Page 45
4.9: Token Validation Page 46
4.10: Candidates and their Party Page 46
4.11: Next Election Loading page 47
4.12: URL Showing the Completion of Voting 47

ix
Figure Page
4.13: Page showing Election Results for Candidates 48
4.14: User Settings Page 49
4.15: New Voter Creation Page 49
4.16: Election Controller Page 50
4.17: New Candidate Addition Page 50
4.18:Page for Adding a party for Election 51
4.19: Creating New Election Page 51
4.20 : Page Showing Date and Time of Election 52
4.21: Wards Controller Page 52
4.22:Local Government Areas Controller Page. 53
4.23: Controller Page for the State Constituencies 53
4.24: Controller Page for Federal Constituencies 54
4.25: Controlller for Senatorial Districts 54
4.26: States Controller Page 55
4.27: Token Audit Page 55
4.28: Non-refreshing Page 60
4.29: Simple Looking Design 60

x
LIST OF CODES
Code Page
4.0:The Layout 57
4.1: Web Client Service 58
4.2: Web Service Sending JSON 59
4.3: Voter Status 61
4.4:Password Encryption 61
4.5:Database String Connection 52

xi
CHAPTER ONE

INTRODUCTION

1.1 Background to the Study


Conducting a credible election in Nigeria is increasingly becoming a very difficult task, and this
has adversely affected the socio-political and economic well-being of the nation and its
citizenry. Encyclopedia Britannica defined an election as a formal decision-making process by
which a population chooses an individual to hold public office. Elections have been the usual
mechanism by which modern representative democracy has operated since the 17th
century. Elections may fill offices in the legislature, sometimes in the executive and judiciary, and
for regional and local government. This process is also used in many other private
and business organizations, from clubs to voluntary associations and corporations.
According to Ginsberg (2007), Election is the procedure that allows members of an organization
or community to choose representatives who will hold positions of authority within it. The most
important elections select the leaders of local, state, and national governments. The chance to
decide who will govern at these levels, serves as an opportunity for the public to make choices
about the policies, programs, and future directions of government action. Election is a critical
component of any democratic society. As such, Nigeria returned to democratic rule and
engagement with the democratic process led to the conduct of its general elections in 1999, 2003,
2007, 2011 and 2015. General elections are elections conducted in the federation at large for
federal and state elective positions.
Election is said to be credible when the outcome of such election is acceptable to generality of the
people especially if the loser demonstrates the spirit of sportsmanship occasioned by the electoral
process transparency. Free, fair and credible elections are central to electoral democracy and
provide vital means of empowering citizens to hold their leaders accountable. In a multi-party
democracy, it behoves both the elected and appointed government officials at all levels of the
political system to render periodic account of their stewardship to the populace. However,
accountability of public officials in Nigeria has been undermined by the fact that elections in the
country are perennially fraught with irregularities. The democratization of politics has been
unsuccessful in arresting electoral frauds perpetrated by different political parties and

xii
megalomaniac politicians. According to Nnoli (2003), “elections are so clearly tied to the growth
and development of representative democratic government that they are now generally held to be
the single most important indicator of the presence or absence of such government”. They are
meaningfully democratic if they are free, fair, participatory, credible, competitive and legitimate.

1.1.1 Elections in Nigeria: 1999-2007

The history of democratic elections in Nigeria especially ones that would be adjudged and accepted
by the electorates as free and fair had always been a problem in the country. The 1999, 2003 and
2007 general elections, three elections conducted during this period of ten years of Nigeria’s
democracy have been lampooned by many critics as far from free and fair (Ahmed 2015). At
inception of the Fourth Republic, the 1999 elections were conducted under military rule. There
were fundamental flaws in the elections, but Nigerians wanted to get rid of military rule and have
power transferred to civilians. They tolerated and accommodated the outcome, and hoped for
future improvements. The 2003 elections, unfortunately, did not represent a substantive
improvement over the 1999 elections, in terms of transparency and credibility. Rather, the
elections at best represented “business as usual”, in terms of inflation of votes, fraudulent
declaration of results, use of armed thugs to scare away or assault voters and cart away election
materials and many other irregularities and illegalities, which were committed with impunity (Jega
2015) . The election of April 2007, conducted by the existing electoral body, Independent National
Electoral Commission (INEC) under the leadership of Maurice Iwu has been described as the worst
election ever held in this country as a result of indescribable irregularities which marred the
elections (Ahmed 2015)

The election itself was characterized by all manner of malpractices many of which reflected both
the inefficiency and fraudulent complicity of INEC. A few examples shall suffice, late display of
electoral register in violation of the Electoral Act, Omission of names of registered voters from the
list, Muddling up of names of registered voters as voter’s names appeared in the wards other than
the one they were expected to vote, Lack of transparency in the choice of returning officers
(allegedly chosen by the ruling PDP) None or late supply of election materials, Announcement of
results figures in contradiction to the number of registered voters or the number that actually voted.
Many of the results were in favour of the ruling Party PDP. Refusal to furnish opposition parties
or candidates result sheets and other documents that will enable them challenge their defeat in at

xiii
the electoral tribunal. These malpractices were repeated with extra expertise and boldness in 2007.
Partisanship and fraud became an official policy of INEC. INEC officials acted with impunity thus
robbing it on the face of the helpless voters that they can do nothing. Results were announced even
where no voting took place at all, in many pooling boots result sheets were deliberately not
supplied. Hotels and private houses were used for thumb printing to the glare knowledge of
security operatives who even aided many of the frauds Obianyo and Emesibe (2015). All the
previous elections from 1999 till 2011 were all manually done but that of 2015 embraced some
elements of ICT in action

1.1.2 The 2011 General Election

The process started with the re –registration of voters exercise, and the introduction of the direct
data capture (DDC) machine for capturing finger prints of would be voters, among other measures
put together by INEC. In all, INEC’s conduct of the 2011 April election by far surpassed their
previous efforts as also confirmed by the various election observers that monitored the elections.

Challenges/Limitations

The 2011 general elections in Nigeria despite being applauded had some shortcomings observed
before, during and after the conduct of the election. There were still cases of ballot box snatching
in spite of the open/secret system of voting. There were also rampant cases of underage registration
and voting. The Adhoc INEC officials who resisted the pressure to register minors and allow them
vote were threatened and harassed into submission. It is amazing to have heard cases of multiple
thumb-printing despite the availability of Direct Data capture machines that were used to register
prospective voters electronically. Another sympathetic and traumatic aspect of the elections is the
post- election violence experienced in some Northern States. According to Nigerian’s Civil Right
Congress, more than five hundred were killed in the post- election violence. The most painful part
of the scenario was the attack and killing of youth corps members as a result of post electoral
violence.

1.1.3 The 2015 General Election in Nigeria


The 2015 general election in Nigeria saw the introduction of the permanent voter’s card (PVC) as
well as the smart card reader to authenticate the number of accredited voters during the election.
The introduction of technological driven voter authentication shaped the elections and gave it

xiv
public acceptance. INEC's greatest achievement was the production and distribution of high tech
permanent voters card (PVC) with biometric data capable of serving the system for a long time
and thus puts to rest the onerous task of always embarking on new registration exercise during
tenure of a new INEC chief executive. This achievement does not in any way preclude the usual
exercise of updating the register. Apart from saving the nation the high cost of constantly
embarking on new registration exercise, the PVC and associated Card Reader(CR) infused a lot of
credibility to the voting process given the malfeasance associated with the voting process in
previous elections especially that of 2003 and 2007.

1.1.4 Smart Card Readers

The smart card reader is a technological device setup to authenticate and verify on election day a
Permanent Voter Card (PVC) issued by INEC. The device uses a cryptographic technology that
has ultra-low power consumption, with a single core frequency of 1.2GHz and an Android 4.2.2.
Operating System (IDEA, 2011). . The INEC card reader is a portable electronic voter
authentication device, configured to only read the Permanent Voter Cards issued by INEC. The
card reader was designed specifically for the accreditation process, authentication of eligible voters
before voting. The machine was configured to only read the PVCs of a particular polling unit and
can only work on election day. The card reader uses a highly secure and cryptographic technology
that is used commonly in devices that need to perform secure transactions, such as paying
terminals. The device is positioned by its operator (usually a trained INEC official) to read the
embedded chip on the PVC, this procedure display the information of the voter, followed by
fingerprinting. It usually takes about 10 to 20 seconds to validate a voter. The card reader has the
ability to perform the above described functions as well as keeping a tally of the total numbers of
voters accredited at the polling unit and forwarding the information to a central database server
over a Global System for Mobile (GSM) network (Engineering Network Team, 2015).

xv
Figure 1.0: INEC Card Reader (Source: Blank News Online, 2015)

Concerned about the massive electoral fraud witnessed in the past general elections in Nigeria,
INEC deployment of the card reader in 2015 general elections was to ensure a credible, transparent,
free and fair election in order to deepen Nigeria's electoral democracy. However, the use of this
electronic device in the 2015 general elections generated debate among stakeholders before, during
and after the elections .Okonji, (2015) writes that despite the confidence of INEC in the use of card
reader in the 2015 general elections, the machines came with some challenges, even though the
elections have been widely adjudged as being successful. For instance, during the March 28
Presidential and National Assembly elections across the country, the card readers malfunctioned
in several polling units, a situation that polling units.

The challenges ranged from rejection of permanent voter's card (PVC) by the card readers,
inability to capture the biometrics from finger tips, to irregular capturing and fast battery drainage.
INEC officials have to abandon their polling units and took the card readers back to their office
for proper configuration. In order to salvage the situation, which was almost becoming frustrating,
INEC ordered the use of manual process for accreditation, But before the order could go round the
states and local government areas, it was already late to conduct accreditation and actual voting in
some areas, a situation that forced INEC to extend the exercise to the next day in all affected areas.
Adegoke, (2015) on his own opined that the use of card reading machine in Nigerian electoral
process has become a highly-contentious issue, especially amongst the political class, such that
Nigerians are asking if the card reading machine is a failure or success. In essence, there is a sharp
divide amongst the exponents and the antagonists of this innovation. While the promoters strongly
feel that card reader is the best thing for the country—as such will, to an extent, minimize electoral
malpractices, boost the image of the country amongst the comity of nations and give Nigeria a
credible election. The antagonists, however, feel, amongst other things, that Nigeria has not yet
mature for such innovation. On its own, the ruling People’s Democratic Party (PDP) argued that
in as much as they are not afraid of its usage, INEC must ensure that no Nigerian voter was
disenfranchised by the machine

xvi
1.1.5 Electronic Voting: Electronic voting (also known as e-voting)
is voting using electronic means to record or count votes. . With the rapid expansion of the
Internet, electronic voting appears to be a less expensive alternative to the conventional paper
voting. Electronic voting overcomes the problem of geographic distribution of the voters as well
as vote administrators. It also reduces the chances of errors in the voting process. Electronic voting
technology can speed the counting of ballots, reduce the cost of paying staff to count votes
manually and can provide improved accessibility for disabled voters. This system ensures that
people can get official election results within hours, instead of days or even weeks. Forward-
thinking countries and election commissions are keen to explore how it can help them improve
their elections. For some nations, automated elections mean that people can trust the results
because it allows for a process that is so auditable, transparent and secure. Of course, electronic
voting also helps reduce human error. For other countries, particularly large ones like Brazil, India,
Nigeria and the Philippines, electronic voting and electronic counting means that people can get
official election results within hours, instead of weeks. Again, this builds trust of the electorates in
the electoral process. In an election, it is vitally important that everyone who is eligible to
participate in elections can do so, meaning that it’s easier for even disable people to vote
independently. Given the high penetration of mobile devices in the world today, one potential way
to address the challenges of electoral malpractices is to connect government electoral resources
with mobile devices to enable a wider participation of citizens in the electoral process (Alabi 2011).

Mobile devices have now become so embedded in human life that people are utilising them to
transact all kinds of business activities. Citizens of many countries of the world are beginning to
believe that one way to enforce openness, transparency, and accountability in their government’s
electoral processes is to draw on the power of technology to conduct voting anywhere, anytime
(Alvarez and Hall 2010). Voting using mobile devices, with the associated benefits of providing
mobile convenience and fostering mass participation in the electoral process, is increasingly being
demanded by citizens (McGrane 2013). Electronic voting (e-Voting) is one of such areas where
the impact of ICT is sought globally, particularly in the developing nations of the world, to help
ameliorate some of the problems plaguing the electoral processes. Traditional voting systems were
developed to ensure strict compliance with the principles of democratic elections and referendums.

1.1.6 The Nigerian Electoral Process

xvii
The electoral process includes the selection of candidates, the registration of voters and the voting
procedures. A secure electoral process is important in the context of good government, human
rights and poverty elimination. The need for a secure electoral process cannot be over-emphasized
as the absence of this will not only bring about the possibility of abuse, but the process and the
result may be open to legal challenge. This could undermine the stability and authority of a newly
elected body or office.

1.2 Statement of the Problem

Elections the world over are usually plagued with a myriad of challenges that do not make the
elections turn out hitch-free. Specifically in the last general elections in Nigeria, some challenges
were experienced with the introduction of a semi-automated electoral system via the use of smart
card readers in the electoral process. The use of the card reader was associated with several
downsides which include breakdown, malfunction, issues with PVC authentication and biometric
data verification of the voters, inability of the card readers to identify some finger/thumbprints.

This study therefore aims at designing a web-based electoral system, with an online voting solution
that would by-pass the use of smart card readers in the electoral process.

1.3 Objective of the Study


The main objective of this study is to design a web-based electoral system with an online
voting solution. The specific objectives are to:
1. by-pass the use of smart card readers with its attendant issues in Nigeria’s general
elections;
2. eliminate electoral violence and other challenges associated with manual voting
methods and
3. evaluate the performance of the designed system.

1.4 Methodology
1. The literature review would include the following:
Search of related literature on the electioneering process from several journals found on
Google scholar, IEEE and ACM digital libraries
Classification of the literature into categories based on the problems discussed.

xviii
Choice of the category with the problem of interest
Identification of the gap the study intends to fill
2. The web-based electoral system would be built to consist of a user interface that will used to
put in user information into the system; a database that would store for all the information
gathered from voters and a counter that will run on Java.
The web-based electoral system would have its interface designed using the following tools:
Microsoft Visual Studio 2013 Ultimate with inbuilt C#, IIS, MsSQL, web Service, scripting
and Styling support.
C# Programming Language
Microsoft SQL (MsSQL)
HTML
Client Scripting (jQuery/Angular)
Bootstrap CSS framework
Internet Information Systems (IIS) Server

The system will utilize a web service or rather a RESTful (Representational State Transfer)
where C# will be used to code back end and the web service whereas html, css, client-side
scripting files will be used at the front end. The Secure Hash Algorithm (SHA1) will be used to
encrypt the passwords that will enable voters exhibit their franchise.
1.5 Significance of the Study
An electronic voting is an electronic system that would allow voters to transmit their secure and
secret voted ballot to election officials over the internet. The proposed system is convenient
because with the well-designed software and system, the voters can simply use their own
equipment with minimal time and skill to complete the voting process. E-voting has been
recognized as a tool for advancing democracy, building trust in electoral management, adding
credibility to election results, and increasing the overall efficiency of the electoral process. The
proposed system has the potential to eliminate most common flaws of traditional card reader
system, eliminates election fraud, speed up vote counting and election result processing, make
voting more convenient for citizens. Voters use mobile devices to vote anytime and anywhere
using mobiles smart device such as phones, ipad , tablets, etc. Using electronic voting saves money
from reducing the personnel expense for example, expense for location management

xix
and administration fee. The whole electoral process and result declaration is faster than the
traditional card reader system. By clicking just a small button, one can summit your voting to the
system, it is much faster than the traditional ballot counting method currently in operation in
Nigeria.

1.6 Scope of the Study

The study examined the electioneering process in Nigeria and bring to light the perennial problems
that have hitherto prevented the process from being free, fair and credible. The research would use
Nigeria’s 2015 general elections as a case study to investigate the real election situation and see
how best this proposed system can be used to nip the challenges facing the electioneering process
in Nigeria in the bud.

xx
CHAPTER TWO

REVIEW OF LITERATURE

2.0 Introduction

Elections allow the populace to choose their representatives and express the preferences for how
they will be governed .Naturally, the integrity of the election process is fundamental to the integrity
of democracy itself. The election system must be sufficiently robust to withstand a variety of
fraudulent behaviours and must be sufficiently transparent and comprehensible that voters and
candidate can accept the results of an election. The plethora of petitions emanating from the 2015
Elections demands for total electronic voting system as the only panacea for credible, free and fair
election in Nigeria. The Semi electronic voting system deployed in the 2015 election had brought
to the fore the need for total Electronic system. The introduction of the card reader could not
prevent controversy not with the mess from operating the equipment properly and result resolution.
Electronic voting will to a certain level limit the involvement of persons from accreditation of
voters to release of results. The electronic system we require would be self-activated and operated
via an INEC server based database, whereby both registration and any other process involved in
the electoral process does not require a second person to deploy; depending on the ability or
knowledge of the electorate. A number of electronic voting protocols have been proposed over the
last few years. This section reviews some of the previous attempts made in using electronic voting
systems as a way of achieving credible elections. Some of these protocols are reviewed in this
section

2.1. Types of E-voting Systems

All typologies have various strengths and weaknesses, both when compared with each other and
when compared to traditional paper-based voting. There is no such thing as a perfect electronic
voting system and available systems continue to evolve with on-going technological advances
(IDEA 2011). It is therefore important to choose the right system for the right context by carefully
weighing the advantages and disadvantages of all options.

Technically, most e-voting systems fall into one of the following four types :( IDEA 2011)

xxi
Direct recording electronic (DRE) voting machines. DREs can come with or without a paper
trail (VVPAT, or voter verified paper audit trail). VVPATs are intended to provide physical
evidence of the votes cast.

OMR systems which are based on scanners that can recognize the voters’ choice on special
machine-readable ballot papers. OMR systems can be either central count systems (where
ballot papers are scanned and counted in special counting centers) or precinct count optical
scanning (PCOS) systems where scanning and counting happens in the polling stations,
directly as voters feed their ballot paper into the voting machine.

Electronic ballot printers (EBPs), devices similar to DRE machine that produce a machine –
readable paper or electronic token containing the voters ‘choice. This token is fed into a
separate ballot scanner which does the automatic vote count.

Internet voting systems where votes are transferred via the internet to a central counting server.
Votes can be cast either from public computers or from voting kiosks in polling stations or
more commonly from any internet-connected computer accessible to a voter.

2.1.1 Forms of E-voting

There are basically, two main form of E-voting:-

a. E-voting which is physically supervised by representatives of governmental or independent


electoral authorities (e.g. electronic voting machines located at polling stations).

b. Remote e-voting where voting is performed within the voters’ sole influence, and is not
physically supervised by representatives of governmental authorities (e.g. voting from ones’
personal computer, mobile phone, television via the Internet) (Pran and Merloe 2007). This
work will be focused on item (b) above

xxii
2.1.2 Properties of Electronic Voting System

Different researchers in the electronic voting field have proposed that any electronic voting
system should have four core properties that include accuracy, democracy, privacy and
verifiability (Cranor and Cytron 2000).

Accuracy: A system is accurate if:

a) It is not possible for a vote to be altered

b) It is not possible for a validated vote to be eliminated from the final tally

c) It is not possible for an invalid vote to be counted in the final tally

Democracy: An electronic voting system is democratic if:

(1) It permits only eligible voters to vote

(2) It ensures that eligible voters vote only once.

Privacy: An electronic voting system is private if:

(1) Neither authorities nor anyone else can link any ballot to the voter who cast it

(2) No voter can prove that he voted in a particular way.

Verifiability: anyone can independently verify that all votes have been counted correctly. The
most verifiable systems allow all voters to verify their votes and correct any mistakes they
might find without sacrificing privacy. Less verifiable systems might allow mistakes to be
pointed out, but not corrected or might allow verification of the process by party representatives
but not by individual voters.

In addition to the above properties, Cranor and Cytron (2000) developed three extra properties
that an electronic polling system should possess. Two of these properties are important for
ensuring a high voter turnout, something which is often desired but not always achieved. These
are:

Convenience: A system is convenient if it allows voters to cast their votes quickly, in one
session, and with minimal equipment or special skills.

xxiii
Flexibility: A system is flexible if it allows a variety of ballot question formats including open
ended questions (this is important for write-in candidates and some survey questions).

Mobility: A system is mobile if there are no restrictions (other than logistical ones) on the
location from which a voter can cast a vote.

2.2 Related Works

For the purpose of this research work, the reviewed literature will be categorized into three distinct
headings based on the problems the researchers set out to address. These are: Validity, security
and problems of the Internet.

1. Validation
Malkawi et al (2009) presented a simulation model for a multifaceted online e-Voting system. The
model is capable of handling electronic ballots with multiple scopes at the same time, e.g.,
presidential, municipal, and parliamentary, amongst others. The model caters for integrity of an
election process in terms of the functional and non-functional requirements. The functional
requirements embedded in the design of the proposed system warrant well-secured identification
and authentication processes for the voter through the use of combined simple biometrics. The
client side represents a voting station, where voters cast their votes. Note that the hardware on the
client side includes IO devices for verification and authentication (e.g., image scanners, ID card
readers, finger print readers, etc.). The server side hosts the central database for the voting as well
as the candidate population. The identification of a voter is done via a card reader which reads off
his/her official ID card and retrieves the voter record from the local DB (on the client side) or loads
the record from the central DB if it is not already in the local one. The voter will be rejected if
his/her fingerprints do not match the stored record. In order to reduce false rejections, we store for
each voter several copies of his/her fingerprints taken at different time periods. The voting process
flowchart is as shown in the Figure 2.

xxiv
Figure 2.0: Voting System Flow Chart (Source: Malkawi et al, 2009)

Linu and Anilkumar (2012) proposed an online voting authentication Technique which
provides biometric as well as password security to voter accounts. The researchers
proposed a three-way identification and authentication process for a would-be-voter.
Voters are first identified by their facial image by using principal component analysis
(PCA). Second step is the fingerprint recognition. Third one is steganographic method.
The basic idea of strganographic method is to merge the secret key and pin number with
the cover image which produces a stego image which looks same as the cover image. The
cover image is a biometric measure, such as a fingerprint image. The secret key and pin
number is extracted from the stego image at the server side to perform the voter

xxv
authentication function. The authors believed that the system greatly reduces the risks
as the hackers have to find the secret key, pin number, fingerprint and facial image,
which makes the election procedure to be secure against a variety of fraudulent
behaviours. SHA 256 used for hashing is replaced with MD5 in order to improve the
speed. To cast a vote, a voter logs in to the system by scanning the face and fingerprint.
If authenticated by the face and fingerprint match then the voter is allowed to log in to
the voting system by entering PIN number and secret key. The system will create the
stego image by embedding the secret key and PIN number. Now this stego image will be
sent securely to the server for voter authentication. At the server side, the secret key and
PIN number from database stego image and voter’s stego image is extracted and
compared to perform the voter authentication function. Once authentication is complete,
the voter will be allowed to vote.

Musa, and Aliyu, (2013) developed an online electronic voting system to checkmate the
problems associated with delivering the electoral facilities to the voting stations and securing
such facilities. The researchers developed a system whereby each voter will be screened for
eligibility, thereafter the information will be stored in database so that at any time the voter
can login and cast his/her vote and monitor the result online. Whenever a voter cast a vote the
system will automatically save all his records including the ballot, username, address and
password for future references. An administrator monitors all the voting process and checks
for any illegal actions. The application consists of two parts; the administrator section and the
user section (voter). The functionalities of the administrator includes: registering users,
candidates, and monitoring suspicious activities during the whole exercise. The user end
section provide privilege to voter to either cast his vote , view votes and view the real time
situation of the exercise. Once a user goes to the website as a voter there are two operations
that can be done by the user; Voting or Viewing the voting exercise. Every user (valid or
invalid) voter can view voting process at real-time. Voting on the other hand can only be done
by the registered users, therefore voters have to be authenticated, and then give access to cast
their votes. The designed voting architecture as developed by Musa and Aliyu (2013) is shown
in the figure 3 below.

xxvi
Figure 2.1 : Flowchart for the Design of the Voting System (Source: Musa & Aliyu, 2013)

John et al (2013) also developed a 3-factor authentication system for the voting process based
on PIN, Smart Card, and Biometrics. Also, attempt was made to develop a multipurpose and
multifunctional card for the convenience of all carriers. The MUSES is made up of the citizen
registration module and voting module among others. Citizens register for the voting process
prior to the voting day. They also register their fingerprints for authentication before the
voting process. After registration the citizen can see the summary of their details which
shows they have registered by representing their citizen ID/National ID which they are given
during the registration process. On the Election Day, citizens bring unified e-ID card to
authenticate and vote for their preferred candidate at the polling booth. The MUSES
developed by the authors uses a secured enterprise-wide network for transaction of messages
and storage of data in the database server.

xxvii
Figure 2.2: Template of a Unified e-ID Card. (Source: John et al, 2013)

Nathan et al (2014) dealt with the design and implementation of a software based voting system
using fingerprint authentication in order to provide a high performance with high security to the
voting system. The design incorporates a database which holds the personal data of every
registered voter, the Graphic User Interface (GUI) which provides a user friendly interface. The
proposed EVM also allows the voters to scan their fingerprint for authentication, which is then
matched with an already saved image within a database. The software is implemented completely
as a .NET managed code in C# programming language with database Microsoft SQL Server
support. To vote, the authentication page takes the voters registration number and fingerprint
and compares it to the registered data in the database. This page provides access to the Voting
Page. Upon completion of the voting process, the results from the different polling centre are
uploaded to a central server for verification and onward publishing using a website that is
accessible by all. The central administrator can be a polling unit administrator or a different
administrator, otherwise known as the main or super administrator with a unique login identity.
The super administrator is the only authorized personnel to publish the final election results
for public viewing via the internet. The process flow chart is in the Figure 2.3.

xxviii
Figure 2.3: The Process Flow Chart for the Biometric Authentication Process. (Source:
Nathan et al, 2014)

Emeka (2016) showed how e-voting through the use of mobile phones and PCs would totally
eradicate all the problems associated with semi manual voting such as - wide rigging of elections,
multiple registrations and voting, late arrival of ballot boxes, stealing of ballot boxes, under-aged
voting, illegal voting by non-Nigerian nationals, rioting and fighting at election venues due to
insufficient number of security personnel, disenfranchisement of those in Diaspora as well as the
physically handicapped by virtue of election distances to them, prolonged delay in accreditation
of voters for election, cancellation of votes due to improper voting, prolonged counting of votes
and delay in determining the result of an election, etc as people would no longer go to election
venues to cast their votes, rather they would be at the comfort of their homes and offices to exercise
their franchise using any of these electronic devices effortlessly. The researcher carried out the
study by designing the documents requirement, Object-Oriented design, Database design, User-
interface design, System architecture and Procedural design. The Architectural design adopted by
Emeka (2016) is shown in figure 2.4

xxix
Figure 2.4: The System Architecture of an E-voting System (Source: Emeka, 2016)

The above architecture shows the basic infrastructure required for e-voting as pointed out by
Emeka (2016). These are: The client – that is, laptop, desktop, tablet, smartphone, etc. (b) Internet
service (c) a web server that hosts the web application program for e-voting (d) a database server
that contains the database tables for e-voting. The researcher in order to reduce excessive workload
on the server in processing millions of http requests during elections therefore stressed the need
for separate servers to do separate tasks in order to increase the response time and efficiency of
the system. As the above figure clearly shows, the application server consists of two components:
the web server and Application server; while the database server now consists of six components:
the NE server, the NW server, the NC server, the SE server, the SW server, and the SS server

xxx
Figure 2.5: Modified System Architecture for an E-voting Platform. (Source: Emeka,
2016)
Position
The issue with the approach adopted by Linu and Anilkumar (2012) is that it does not
take care of the physically challenged voters, or even voters that may have been defaced
after the registration of voters had been concluded. Also the secret key that is generated
and to be used by voting can be lost or forgotten by an eligible voter. There may also be
the problem of speed as images will definitely slow down the system, and consequently
slow the entire voting process. Linu and Anilkumar (2012) adoption of a unified e-ID
card in the Nigerian context may be an issue, especially since it will be linked to one’s
personal bank account. Owing to cybercrimes in the country, a very good number of
Nigerian citizens have refused to embrace the smart card technology in the banking
sector. Therefore having a unified e-ID card for everything digital in the country will
result to many people being disenfranchised in the voting process. Musa and Aliyu (2013)
relied on the VID generated at the point of registration for authentication, which may not
be very appropriate for an important process like election.

The use of biometrics based software in the voting process as proposed by Nathan et al
(2013) and Malkawi et al (2009) may also suffer serious challenges. The fingerprint device
used for authentication may fail on the day of voting. This was one of the major challenges
of the 2015 general elections in Nigeria. The model proposed by Malkawi et al (2009) does
not also take care of remote voting. Voting centres are used instead. This may lead to voter
apathy as well as disenfranchisation of voters who may not be available at the time of voting.
Authentication of eligible voters in Emeka (2016) is carried out by the use of Birth certificates

xxxi
generated at the point registration. The drawback of this system is that citizens can forge birth
certificates as is presently the case in Nigeria right now, and so using it can as a means of
authenticating a voter can introduce an element of rigging into the voting process, since it can
be easily forged.

2. Security

Cryptography is naturally used to secure transactions in complex systems where the interests
of the participating entities are in conflict. Not surprisingly, cryptography is one of the most
significant tools for securing online voting protocols. While in traditional elections most ideal
security goals such as democracy, privacy, accuracy, fairness and verifiability, are assured to
a point given physical and administrative premises, this same task is quite difficult in online
elections. For example, receipt-freeness and verifiability seem to be contradictory: when voting
over the Internet, the very means that allow a voter to verify that his/her vote was counted
properly (e.g. receipts, vote encrypting keys, user-selected randomness, etc), may also allow a
dishonest third party to force the voter to reveal his/her vote (Okediran, Omidiora, Olabiyisi
et al 2011). Another controversial pair of security properties are privacy and eligibility: it
seems difficult in online elections to unequivocally identify and check the credentials of a
voter, while at the same time protecting the privacy of his/her vote.

An Anonymous Electronic Voting Protocol for Voting Over the Internet

Ray and Narasimhamurthi (2001) proposed a secure electronic voting protocol that is for large
scale voting over the Internet was developed. The protocol allows a voter to cast his or her
ballot anonymously, by exchanging untraceable yet authentic messages. The protocol ensures
that only eligible voters are able to cast votes, a voter is able to cast only one vote, a voter is
able to verify that his or her vote is counted in the final tally, nobody, other than the voter, is
able to link a cast vote with a voter, and if a voter decides not to cast a vote, nobody is able to
cast a fraudulent vote in place of the voter. The protocol does not require the cooperation of all
registered voters. Neither does it require the use of complex cryptographic techniques like
threshold cryptosystems or anonymous channels for casting votes.

Okediran, Omidiora, Olabiyisi et al (2011) in reviewed four generic cryptographic


models for secure electronic voting and provided a comparison amongst the four models

xxxii
in terms of their core properties of universal verifiability, support for write-in ballot,
efficient voting, efficient tallying and large scale election support. The models compared
included mix nets The Homomorphic Model, the blind signature model and the Verifiable
Secret Sharing Model. Mix networks (mix-nets) usually consist of a set of servers (mixes)
which accept a batch of input messages and output the batch in randomly permuted
(mixed) order so that the input and output messages are unlink able. In the homomorphic
model, each voter signs and publishes an encryption of his/her vote. Encrypted votes are
then “added” into the final tally, to form an encryption of the “sum” of the submitted
votes. Election protocols of the blind signature category enable voters to get their vote
validated from an election authority, while preserving the secrecy of their vote. Blind
signatures are the electronic equivalent of signing carbon-paper-lined envelopes: a user
seals a slip of a paper inside such an envelope, and later gets it signed on the outside.
When the envelope is opened, the slip will bear the carbon image of the signature. The
comparison shows that blind signature model is the most efficient cryptographic model
for secure electronic voting as it supports more core properties desirable for secure e-
voting than any other model.

Sodiya, Onashoga, and Adelani (2011) proposed a secured e-voting architecture. In this work
the researchers proposed a secure e-voting architecture based on Elliptic Curve ElGamal (EC-
ELGAMAL) cryptography. The major concern of the researchers was to design an e-voting
architecture that ensures privacy, non-coercion and receipt-freeness. This can be ensured if the
voter cannot prove to the coercer or for receipt (bribery) the way he/she has voted. In this
research, each voter’s vote is encrypted at the point of voting, sent to the voting authority and
later decrypted in the tallying phase. The architecture is shown in figure 2.6.

xxxiii
Figure 2.6: E-voting Architecture Based on EC-ELGAMAL. (Source: Sodiya, Onashoga,
and Adelani, 2011)

Abdulhamid et al (2013), also developed an electronic voting system, aimed at eliminating rigging
and manipulation of results to its barest minimum, the problem mostly associated with the manual
system of voting. The researchers outlined how implementation of electronic voting system in
Nigeria will boost the integrity of INEC and the result they produce. The authors used PHP,
MySQL, Java Query, CSS and HTML programs in the development of a real time e voting
platform . These packages make the Graphic Interface User friendly enough for even those with
little or no computer knowledge. The authors analyzed, designed and implemented how an
electronic voting system would be of great benefit to Niger state (case study) and Nigeria as a

xxxiv
whole. The main modules in this real-time e-voting system are: Registration process (voters card
and print), Ballot design module, Database Administrator module, Voting module and Real-Time
Live Results module. After a voter has registered, a password is sent to the mail of each registered
voter. During the voting, on the voting interface, voters are required to fill in their username and
password correctly, which automatically takes them to the voting proper. Username and password
are both generated at the point of registration and sent to the voters email address. A registered
voter also gets a Voter identification number (VIN) in case of loss of password.. The flowchart is
as shown in figure 2.7

Figure 2.7: Secured E-voting Platform ( Source: Abdulhamid et al, 2013)

Adebayo, Yusuf, and Adetula (2014) presented a multi-agent e-voting system which
technically overcomes some of the flaws encountered in traditional paper voting by presenting
a most trusted vote management procedure. A multi-functional smart-based ID card was used

xxxv
for the registration process. The smart ID card serves also for F2F authentication (National ID,
Driver’s licence) and other electronic activities such as e-banking and e-medical record at any
terminal. The use of PIN and fingerprint was adopted for electronic authentication on the
machine using smart card reader with fingerprint capability. The system also adopts the use of
a smart card technology as well as seamless secure voting guarded by several complex
cryptographic protocols. The system though web based, has been found to greatly enforce non-
coercibility as well as flexibility of use when analyzed using a real time test election scenario.

Position

The protocol proposed by Ray and Narasimhamurthi (2001) authenticates an eligible voter
with the use of a voters certificate (containing a public key) issued to the voter at the point of
registration. The drawback of this protocol is that the voters certificates can are transferable.
In other words, personification of would-be-voters will be an issue while using this protocol.
Another shortcoming is that it does not address the issue of vote buying. To prevent vote
buying, a voter should not be able to prove after casting a vote that he voted a particular way.
In this protocol however, each published ballot is associated with a voter generated voter mark;
this allows the voter to prove that he voted a particular away. Thus, coercion will be a challenge
with this protocol. Sodiya, Onashoga, and Adelani’s secure e-voting architecture based on
Elliptic Curve ElGamal (EC-ELGAMAL) cryptography may have security challenges, since
username and password authentication is carried out once in the voting process. Any hacker or
enemy that is able to get the user name/password will be able to vote once the validation stage
is passed. Abdulhamid et al’s platform also requires a one -off authentication process, and so
may not be much secured after all. The username and password combo is sent via email to
eligible voters. This may not be adequate for rural dwellers and illiterates that may not be very
e-compliant or internet savvy. The gap in the study proposed by Adebayo, Yusuf, and Adetula
(2014) is that voters still have to go to polling booths or voting kiosks in order to cast their
votes electronically. Face recognition as a means of identification and authentication can also
slow the voting process. Furthermore, just like the work done by John et al (2013) many
people are still averse to linking their bank records to smart cards and other digital media, and
so relying solely on this approach proposed by Adebayo, Yusuf, and Adetula (2014) may lead
to further disenfranchisement of eligible voters

xxxvi
xxxvii
.Problems of the Internet

Joaquim et al, (2003) presented REVS, a robust electronic voting system designed for
distributed and faulty environments, namely the Internet. The goal of REVS is to be an
electronic voting system that accomplishes the desired characteristics of traditional voting
systems, such as accuracy, democracy, privacy and verifiability. In addition, REVS deals with
failures in real world scenarios, such as machine or communication failures, which can lead to
protocol interruptions. REVS robustness has consequences at three levels: (i) the voting
process can be interrupted and recovered without weakening the voting protocol; (ii) it allows
a certain degree of failures, with server replication; and (iii) none of the servers conducting the
election, by its own or to a certain level of collusion, can corrupt the election outcome. REVS
uses five different type of servers for each of the process involved in electioneering. These are:
commissioner, responsible for preparing the election, generating and keeping secret the
election’s keys, signing the ballot questions and defining the operational configuration for the
election (addresses and public keys of servers, number of required signatures, etc.). There is
also the Ballot Distributor, responsible for the distribution, for the voters, of the data set up by
the Commissioner for the election: ballots and operational configuration, the Administrators
that have the power to decide upon the acceptability of a ballot from a voter, the Anonymizer
server providing anonymity to the voter’s machine, preventing a Counter from associating a
ballot to the machine owner and the Counter is the server who verifies the validity of the
ballots, verifying that all required signatures are on the ballot.

Figure 2.8: A REVS Protocol (Source: Joaquim et al, 2003)


Position
REVS as designed by Joaquim et al, (2003) would be expensive to maintain as it runs on five
different servers working concurrently and performing separate tasks. Also the authentication

xxxviii
of voters is kind of weak because the public key is distributed in the ballot distribution phase,
and the private key is only released, by the Commissioner, after the election voting period ends

xxxix
CHAPTER THREE
METHODOLOGY
3.0 Introduction
The electronic voting system is expected to perform in a straight forward and effortless manner
with minimal user intervention. Votes will be accepted from a variety of devices from any location
during the stipulated date and time of voting. Before voting is commenced a voter will have to log
into the Voters management system with a user name and password which was previously assigned
at the point of registration. The Voter Identification Number (VIN) name as contained on the PVC
(Permanent Voters Card) would serve as the user name, while the a default number serves as
password. The registration process is outside the scope of this proposed system. The PVC will
serve as a direct means of authentication even if a voter wishes to vote at a kiosk rather than voting
online. While voting at a kiosk, a voter will still use a password to gain access into the voting
system, same goes for voting online where you use the PVC as if you were using your
MASTERCARD or VISA credit cards.

Figure 3.0: A Permanent Voters Card Sample Showing the VIN Number

Once a voter has logged into the web-based voting system, the voter can perform a variety of
actions like change password, view your voting history, timelines, etc. But just before voting, a
voter re-enters his/her password again, after which the system generates a token and send it as an
SMS to the voter’s phone number. The phone number is the one you entered at the point of
registration and it cannot be changed. The token comes with a session id and assigned time in
minutes. The session expires once the time elapses, after the successful sending of the SMS, a
voter would be redirected to the secured voting portal where he will be required to enter the token
before he can finally vote for his preferred candidate. Once this is done, the voting environment
loads and you vote your candidates.

xl
A counter of total number of votes cast in the election will be displayed at a location in the page.
Once voting is complete, a voter gets exited from the voting portal and a message of thanks is
displayed. This will go on and on until the voting stops at the stipulated time and the voting portal
gets locked or rather taken down to prevent desperate people from using malicious means to gain
entry. Votes will trickle in from eligible registered voters all across the world, the problem of initial
accreditation will be weeded off by this electronic voting process, no time lags, no bottlenecks,
result get collated immediately after voting ends, and the winner(s) are displayed on the front page
of the Voters Management System with another page meant for analysis. The application will be
designed and developed with the following attributes in mind: ease of use and simplicity,
efficiency, security, user experience, and scalability.

The Process flowchart is as shown in the Figure 3.1.

xli
Figure 3.1: Process Flowchart for the Proposed System

xlii
3.1.1 Ease of Use and Simplicity
The application will be quick and easy to use to enable users quickly perform tasks without much
effort or ambiguity. Emphasis will be on reducing the complexity associated with the electronic
voting process.

The client-side scripting technology will guarantee ease of use in this e-voting system. Buttons
and links will be pushed without the pages refreshing, thereby making the whole process quite
easy. Menu system will be well defined and arranged in such a manner that its navigational
capabilities will be full throttle.

The layout will be clean and without contiguous data on it. Ease of use and simplicity is important
and wouldn’t be compromised.

3.1.2 Efficiency
The application will reflect an acceptable degree or level of efficiency. This is guaranteed by the
quality of the hardware resources where the various domains (data, web service, application host)
will be domiciled and the speed of the program infrastructure which has to do with the
programming language, web servers in use, and choice of DBMS or database provider. The mean
time to request processing and request response will be factored and worked upon to get the best
result. Since requests will be trickling in from various gadgets, devices and locations, a lot has to
be done to guarantee maximum efficiency.

The systems hosting the various domains must have enough processing and memory capability to
fast track request processing. The load has to be distributed across the network of servers,
microprocessors and memory resources. Caching systems will have to be put in place to make sure
new connections are not opened when there exists a previously used one.

3.1.3 Security
A lot of cryptography, security checks and firewalls will be put in place to checkmate some
expected challenges in cases of hackers exploring the technology, trying to cause double inserts,
using malicious wares to try to distort the integrity and consistency of the application
infrastructure.

Passwords will have to be encrypted and salted before recording or matching with the already
existing one. The meaning of the salting here means that for instance if you want to get the SHA1
(Secure Hash Algorithm) value of a password, you encrypt the password with SHA1 and in salting

xliii
it, you jointly encrypt it with the username that accompanies the password and store. Then if
anyone wants to get authenticated, he supplies the username/password combo, then same operation
happens before been compared with the one stored, this means plain text passwords are not stored,
in case someone tries to access the password by getting to the database like in the days of old tricks
like SQL injection. The value of the password he/she will get upon penetrating the database will
never log into the system.

The site will be protected and its data encrypted with a good security certificate from a certified
certification authority. This layer of encryption and security makes sure that the data packets in
transit don’t get captured by programs and malicious activities going on within the internet. When
the data is intercepted by some protocol analyzers, it is seen as gibberish and unimportant.

The voting proper will only take place after a token has been generated just for that voting session,
such a token will expire after some time when the voting has been deemed to have ended. Critical
actions like voting will be conducted with tokens generated for that particular action. This makes
sure someone who stole someone else’s account details doesn’t use them to vote whether as an
insertion into the data backbone or as voting itself within the web application since these tokens
will be sent to phone numbers registered by the voter at the point of voter registration or voter data
regularization.

Passwords will be asked of at critical operations like trying to access the voting facility, this is
before the token gets generated or sent.

Firewalls will only come in at places where there is major traffic like the entrance to the data
backbone. This will further assist in detecting malicious traffic and filter them off.

3.1.4 User Experience (UX)


This tries to guarantee that the user has a wonderful experience generally in using the electronic
voting system. It starts with the look and feel of the application whether it is viewed on desktop or
on mobile device. Mobile users will have a different responsive theme from the theme for desktop
users.

At every instance, the user will be provided with a theme that is screen-size and device friendly.
Viewing or utilizing the application from the desktop perspective for PCs and notebooks won’t

xliv
seem to have much difference from viewing and utilizing the application from an android device,
iPhone, iPad or a BlackBerry device.

Ease of use is still part of this category; the buttons, carousels, tabs, modals, forms, the scrollers,
the text, the navigation, etc. will all have an appealing experience on the sensibilities of the user.

User experience will be further aided by the beauty of the functionality of the system where user
actions will happen seamlessly and effortlessly. This is still dependent on efficiency.

3.1.5 Scalability
For an application accepting requests from millions of different devices and millions of people
within Nigeria and across the world and also knowing fully well that with electronic voting, voter
apathy will be almost a nullity, scalability becomes a problem.

The problem with scaling this application stems firstly from the fact that the population of its user
base is partially incremental. This means that at the launch of this application like many scalable
online applications the users do not grow in a significant incremental manner.

Upon its launch and schedule for voting, everyone will love to use it, in fact people that never
voted before will want to vote since there is nothing like ballot box snatching, gangsterism,
unfettered violence, and intimidation to vote for a particular candidate. This will surely put this
application to the test, and it calls for very radical decisions and actions during implementation
before any type of voting commences.

The population of user base will be incremental but at a slow pace because its expected and
understood that an election is something the entire population ought to participate in, quite a few
number of people will not participate in the first edition of the electronic voting activity. Scaling
here translates to maintained strength and resilience of the application infrastructure in the face of
managing billions of request and traffic from millions of people and devices. Badly designed and
implemented application infrastructure will collapse in the face of overwhelming traffic and this
will prove to be some sort of national embarrassment and it will further deplete the trust and
confidence the electorate has in the system and its facilitators. Factors to be considered while
scaling a web application infrastructure:

Programming platform

xlv
Caching mechanisms

Simplicity

Data flow

Hardware resources

3.1.5.1 Programming Platform


The choice of programming language is of paramount importance amongst the list of items to be
considered while scaling your web application. Without a robust programming language that
guarantees speed and accuracy, the web application will hardly scale. C# and .net would be used
since we are considering an enterprise package that would be generating much traffic.

3.1.5.2 Caching Mechanisms


More often we demand for same data we have demanded before, it is like requesting for a particular
item multiple times like menu system, list of candidates and other related items, without proper
caching mechanisms, we might overburden the data infrastructure with a lot of requests and
creating duplicate connections which will greatly affect the efficiency and scalability of the whole
system.

So caching mechanisms like the Memcache will be put in place in order to keep at bay this bad
omen.

3.1.5.3 Simplicity
If there is no general idea of weightlessness and simplicity, then this will affect scalability. Http
pages, methods and classes will all be written clearly with precision and objectivity with no
ambiguity and unnecessary items included. Every idea will be properly separated to ensure
maximum performance.

3.1.5.4 Data Flow


Data flow is key in considering scalability of a web application of this magnitude. The concept of
web services where html is requested rather than generated on page load by server side is a good
way of coordinating data around the web application. Client side scripting and other html is
resident on the page, and they will load first before external data requests are made, the client side
scripting requests for data from the web service which in turn queries the database for the requested

xlvi
data, and it goes on and on like that. This structure is organized and makes sure the program and
data flow follows a structured pattern.

3.1.5.5 Hardware Resources


Without the availability of required hardware resources, scaling will be difficult. Memory and
processing capabilities must be at an all-time high to make sure there are no bottlenecks and hold
ups while serving requests, pages and other items. The hardware must be of emphasis too if
scalability should be guaranteed. And sometimes aspects like load balancing come into play where
the load or requests are evenly distributed amongst servers in the stack. This will guarantee not
only scalability but greater efficiency and performance.

3.1.6 Applied Methodology


The application will be achieved via means of object oriented programming or object oriented
software development with the .NET framework. The design structure will be modularized. i.e.
the application will come in modules which will be developed one by one but will be merged
together later as one solution. An integrated development environment will be put in place, which
will facilitate testing for the application.

3.2 Research Tools


The web based system will be developed and designed with a combination of tools which includes
the operating system, Windows 7, Microsoft .NET framework which includes Microsoft Visual
Studio 2013, MySQL database, C# programming language, Internet Information Services (IIS)
Server, jQuery Javascript framework, Bootstrap CSS Framework.

xlvii
3.3 Research Methods
Microsoft Visual Studio 2013: This .NET framework integrated development environment will
be used for development of the proposed web based system, the core web services implemented
with the C# programming language, an interface where one can access the MsSQL RDMS and its
server, edit program, html, CSS, client script files.

IIS (Internet Information Services) Server: this is the server that is in charge of serving the web
pages and performing other critical server operations. It comes bundled into standalone client
operating systems and network operating systems. It serves pages or resources requested by user
action from the application layer/interface. It equally tries to manage requests and traffic in order
to optimize general system performance.

Microsoft SQL relational database management system (MsSQL RDBMS) is a database


technology that is versatile, robust and completely wired up. This database technology will be
responsible for the data storage and data services/transactions needed for the web based system..
The conceptualized set up is as shown in figure 3.2

xlviii
Other devices
mobile gadgets

cloud based Username/password


user files LOGIN/AUTH

token
Secure SSL
generated SSL web service
voting SSL
VOTING PROCESS d
portal

End of voting

Database
infrastructure AUTO VOTES COUNTING

RESULT PRESENTATION
Figure 3.2: The Electronic Voting System Architecture

In Figure 3.2, the blue blocks represent the real processes being carried out, while the lemon
coloured blocks represents the physical infrastructure in the system.

Login/auth: This level provides the interface for login after which a web service will take control.
A user will have to first login at the interface hosting the user html, client scripting, styling and
other common user files. Logging in is done with the use of voter identification number and a
password. The cloud based user files infrastructure is the physical.

Voting Process: Before the voting process commences, a redirection will have to be made from
the voting system to the secure voting portal that is the part that has to do with voting. This area is

xlix
guarded with secure security protocols like SSL (Secure Socket Layer). And before voting
commences, a token will be generated for the voter which he applies before being granted access
to vote. The token will be sent via short message service (SMS) to the voter’s phone number. This
will ensure that the voter is not impersonated, and the integrity of the system is not compromised.
This directly connects to the database infrastructure and records the votes with time, the VIN
number of voter and ID of candidate voted for.

Auto Votes Counting: As the voting takes place, a process automatically counts the votes for each
of the candidates, and prepares it for display.

Result Representation: At the end of the voting process by all eligible voters, the result is
presented by the system and made available for viewing.

l
The Entity-relationship Diagram

li
Figure 3.3: The Entity-relationship Diagram of the Proposed System

3.4 The Software Development


The stages that will be observed in the software development cycle are planning, design, testing
and deployment.

3.4.1 Planning Phase


Developing an internet-based infrastructure starts with models development, drafts, the data flow
and the user response.

With regards to a web 2.0 model of design and development, the proposed system will be
designed with this minimal visual concept:

Data Infrastructure

(Cloud/local)

FIREWAL
LL

Web
Service

Desktop Users Mobile Users


Figure 3.4: The Visual Concept

From the preceding Figure, the data flow and model can be envisaged, a data infrastructure hosted
on cloud or local servers which will transact data via a web service with encrypted information.
The desktop/mobile users either query or receive data from the web service which in turn queries
or receives from the data backbone. This happens over encrypted channels with security
certificates from authentic certification authorities.

lii
Before data request gets to the data backbone, a firewall is in place to determine the origin of the
data, filter out malicious requests and endorse authentic requests. This shall be done in way of
analyzing headers accompanying data packets.

For best results, the web service will be sitting somewhere different from the data backbone and
the end user applications. This will isolate technologies and make them faster and more efficient.

3.4.2 Design
The design will be done within the environments of Microsoft .NET framework. Integrated
Development Environments like the Microsoft Visual Studio 2013 professional will be used. This
is a robust development environment with wide range of uses and application. The web server
utilized is Microsoft Internet Information Services (IIS 8.0) and Microsoft SQL Server will be
used for data considerations.

3.5 Hardware and Software Requirement


Hardware requirements for the design and development of this system will entail not fewer than
three notebook systems, other mobile devices and gadgets. The software requirements will entail
utilization of IDEs like Microsoft Visual Studio environments and its constituents, other
frameworks and third party tools like the bootstrap framework for wireframing, layouts and
prototyping and applications will be used for skeletal sketches. Internet Information Services (IIS
8.0) will be used for web server services

3.6 Ethical Consideration (Post-Research Benefits)


Web-based electronic voting has the potential to make the voting process easier and more
accessible for voters. This is especially true given that ballots can be cast from any computer or
mobile device with an Internet connection. With regard to special populations of voters, Internet
(especially remote) and telephone voting may be methods of engaging those voters who are
considered the hardest to reach, particularly young people aged 18 to 30. These voters are most
familiar with the technology, are the most frequent reported users and would likely benefit the
most from web-based electronic voting. It could also allow greater secrecy for special populations
of electors with disabilities (including visually or hearing impaired). By voting electronically and
therefore unassisted, these voters are afforded a greater degree of anonymity when casting a ballot.
Enabling secrecy for these groups enhances the equality of the vote. Web-based voting has the
potential to be less expensive to operate and execute than traditional paper ballots which require

liii
setting up and staffing polls. There can be no ballot errors, and, depending on the system, no
spoiled ballots

liv
CHAPTER FOUR

DATA ANALYSIS, RESULTS AND DISCUSSION OF FINDINGS

4.0 Introduction

In this chapter, we present the results of the design of the web-based electronic voting system. The
results obtained in the process of voter validation, voting proper, and vote counting are all detailed
in this chapter. The application structure designed comprises of the layout, the web services with
the server side code, the database, the html files with its client side scripting.

4.1 Voter Validation

A voter on getting to the website gets logged in. Logging in is done using the VIN number and
INEC assigned password. The landing page is simple and light, as shown in the figure below.

Figure 4.0: Landing Page

After a successful logging in, a voter passes through encryption checks,and is met with a
dashboard showing some little statistics of the number of elections conducted within the portal,
the number of voters that have participated, and the next avaliable election to be conducted.

lv
Figure 4.1: Voting Statistics and Avalaible Elections Page

Data is loaded via JavaScript Object Notation (JSON) web services called Simple Object Access
Protocol (SOAP) as initially postulated. Upon clicking on any page on the left hand pane the
subsequest information smoothly fades in. Below is a page showing voter activity or elections a
voter has participated in.

Figure 4.2: Voter Activity Page

lvi
4.1.1 Voter Information

The page below displays voter’s basic information. The information on this page cannot be edited
because it is the information a voter supplied to the electoral officer at INEC (Independent
National Electoral Commission) upon registration as a voter.

Figure4.3: Voter Information Page

The system was designed in such a manner as to reflect the different types of election a registered
voter is qualified to participate in at every point in time. This was done into considering the fact
that different states may be conducting different types of elections at any given time. Therefore a
voter from Niger State, wishing to participate in the state house of assembly’s elections on logging
in, and clicking on “Active elections” link, the active elections will load, showing the elections the
voter is qualified to vote in at that particular election for Niger State.

To get started a voter clicks on a button below labeled “Start”. This button will generate a token,
and send it via SMS to the voter’s phone for the authorization to the voting page.

lvii
Figure 4.4: The Start Page after Successful Log in

4.1.2 Token Generation: Once the button is clicked, a dialog will appear showing the token
generation and sending process. It counts downward, and at the end signals the end of the token
generation.The token value will be sent to the voter’s phone via SMS which will be received
instantly.

Figure 4.5: Toke Generation Page

lviii
The countdown continues, this marks the final countdown.

Figure 4.6: Final Countdown Page

After a successful countdown, the dialog informs the voter that the token has been generated and
sent via SMS to the phone number provided by the voter during voter registration. The voter clicks
on the button “Proceed to Voting Portal” in order to continue with the process

lix
Figure 4.7: Token Generation and SMS Transfer Page

On clicking the button “Proceed to Voting Portal?”, the dialog will change prompting the voter to
enter the token sent to him via SMS for confirmation. As this is being done, the “Verify Token”
button becomes active and on clicking displays a message informing the voter of the status of the
token entered. The status can be one of “valid and verified”, “expired” or “non-existent”. The
token has a 20 minute lifeline. At the end of the 20 minutes. It becomes expired, if its not captured
anywhere within the system, it says its “non-existent.

Figure 4.8: Token Verification Page

4.1.3 Voting: Voting commences after the generation and confirmation of a token. The moment
the token is verified, the message, “TOKEN VALID AND VERIFIED” is displayed. With this,
the voter can freely “Proceed to Voting Portal” by clicking the button which now redirects to the
voting page where elections he is meant to vote in are loaded.

lx
Figure 4.9: Token Validation Page

It is important to note that if the token is expired or the dates or time for the election have passed,
the Start button will be deactivated. The voter therefore cannot generate a token and would not be
able to participate in voting.

The voting page loads with smooth scrolling and fadeIn effect. Checking on any of the radio
buttons by the right of each name indicates that the voter is voting for the candidate and the party.
Upon checking any of the candidates/party, it automatically leads the voter to the next election
billed for the particular voter.

Figure 4.10: Candidates and their Party Page

lxi
The next or second election loads after the previous voting.

Figure 4.11: Next Election Loading Page

Once voting has been carried out, the page redirects to signal the end of voting and formally logs
you out.

The voting system was designed with a friendly URL. A well defined URL structure like the one
below signals the end of voting.

Figure 4.12: URL Showing the Completion of Voting

At the completion of voting, a voter may log in again at any time, to view the state of results of
elections he is eligible to participate in. This aids transparency of the entire process.

4.1.4 Result Display: Clicking on the link “results” will display a grid of radio buttons with regards
to the elections of the day. Clicking on any particular election displays the result obtained for the
particular election so far.

lxii
Clicking on more buttons further displays the result.

Figure 4.13: Candidates Result Page II

4.1.5 Settings: The last link tagged “Settings” can be used to change passwords. The INEC
assigned password can be changed upon logging into the voter’s user area.

lxiii
Figure 4.14: User Settings Page

Creating new voter: The form below allows the creation of new voter information, with a back
button to get back to the Voters manager.

Figure 4.15: New Voter Creation Page

lxiv
4.1.6: Elections Controller: This is used for live editing, viewing of candidates, viewing of
results and creating new election. Two buttons on top “Reset” and “Create New” are used in this
regard. Reset is created intentionally to set the dates for the election to be that present day and
“Create New” is for creating a new election.

Figure 4.16: Election Controller Page

A button by the side of the elections depicting a “User” once clicked displays candidates enlisted
within the election and a means of adding new candidates to it. This is as shown in the Figure 4.17.

lxv
Figure 4.17: New Candidate Addition Page

While Adding you select the party and create:

Figure 4.18:Page for Adding a Party for Election

To create a new election, select the type of election as shown Figire 4.19.

lxvi
Figure 4.19: Creating New Election Page

For any election, the date, and time (starting and finishing) the voting is specified.

Figure 4.20 : Page Showing Date and Time of Election

Once entered, New elections can be added, with the type specified.

The controller shown in Figure 4.21 controls the addition of wards for election. Here, wards can
be created, read, updated, deleted and searched for.

lxvii
Figure 4.21: Wards Controller Page

Figure 4.22 is the controller displaying the over 700 local government areas of Nigeria from the
database is shown below.This controller only does edit the names, and cannot add or remove them.

Figure 4.22:Local Government Areas Controller Page

lxviii
Figure 4.23 shows the controller controlling State constituencies. This can create, read, update,
delete and search information.

Figure 4.23: Controller Page for the State Constituencies

Figure 4.24 is the controller controlling Federal Constituencies, you can create, read, update, delete
and search information.

lxix
Figure 4.24: Controller Page for Federal Constituencies

Figure 4.25 is the controller controlling Senatorial Districts. Here,creation, reading, updating,
deleting and searching for information can be done.

Figure 4.25: Controller Page for Senatorial Districts

Figure 4.26 shows the controller displaying information of the various states in the country.This
controller enables one to only read and edit. New additions or deletion allowed are however not
allowed.

lxx
Figure 4.26: States Controller Page

Vote Tokens can be equally audited by the controller shown in Figure 4.27. Here, the Tokens that
were generated for voting together with all corresponding information and the lifetime are
displayed.

Figure 4.27: Token Audit Page

4.2 Discussion

The section discusses some of the attributes and features of the designed system.

4.2.1 Attributes of the Designed System

a. Security was achieved in a number of ways. Firstly the login passwords were encrypted
with SHA1 (Secure Hash Algorithm), salt was produced and the passwords were encrypted
with the salt. The salt is the username of the user, it was merged with the password before
encryption, and this guarantees the database is not hacked with SQL injection, and that the
raw password will be gotten with the exposure or illegal access of the database. Secondly,
token generation was used and sent as SMS to the phone number of a voter before voting
is commenced. When the token is verified, the voter gets redirected to a voting interface.
SSL (Secure Socket Layer) Security certificates were equally used to secure the system, it

lxxi
makes sure communicated or transmitted data are not captured in transit with protocol
analyzers and decoded.
b. Accuracy: The designed system achieved this attribute by ensuring that a voter can only
be allowed to vote once. This was achieved in two ways: When a voter has voted but goes
back to vote again, the voting button in the page will be disabled, indicating that the voter
has already voted and cannot be allowed to vote twice. The system records all voting
carried out by a particular voter. Pages cannot be refreshed , and the voting page was
designed in a way to throw multiple voters out and redirects them to the login page.
c. Democracy was achieved by making sure that a voter cannot be linked to his vote, voting
logs are populated while voting is taking place but this has nothing to do with any voter.
Voting logs are used to conduct an audit or for settling disputes.
d. Transparency was also measured as voting is taken place, there are visible counters in the
users page which indicates how voting is going on.
e. Convenience was guaranteed as a result of the different provisions made within the system
such as ease of use/user experience (UX) and simplicity. The system was designed to be
weightless and simple, the markup, graphics and other utilities interacting with the user
have been stripped-down, properly arranged in a pleasing way, giving maximum ease of
use and user experience.
f. There are no ambiguities, obtrusiveness or difficulty in the usage of the system. It was
designed simply to be used by the least skilled individual. Simplicity and ease of use was
emphasized in the implementation of a quick and easy navigational system and its attendant
clarity. Quick and handy instructions were neatly placed to guide the user for the voting
process.
g. The designed system is flexible with the way it suits any category of user at anytime,
doesn’t break down its not susceptible to climate change, weather interferences or server
constraints, and adapts to conditions easily with the way it was designed with the concept
of web services which has actions and activities linked but remotely isolated from each
other.
h. Privacy here connotes the fact that the system can be used without the knowledge of
others. The very first aspect of the system is that it guarantees every users’ privacy. A
user can elect to use his mobile gadgets, pc or laptop to vote at his convenience.

lxxii
i. Efficiency/Scalability of the system is one of the very basic and fundamental
considerations and implementations of this system. Scalability refers to the strength of the
system in the face of a great magnitude of stress as a result of usage. The C# binary code
converted code guarantees optimization of the application which in turn aids
scalability.The separation and relocation of functions with web services and other client
resources helps in distributing the work load evenly. And also the light weight of the html
makes the application and its html render with ease.

4.2.2 The Layout: The layout was designed with the Bootstrap CSS framework, this offers layouts
in form of grids of 12 which is arranged in a row, for every row you have a grid of 12, where the
rows and grids can be mapped out in form of a div container:

<div class=”row”>
<div class=”col-md-4”></div>
<div class=”col-md-4”></div>
<div class=”col-md-4”></div>
</div>

OR

<div class=”row”>
<div class=”col-md-3”></div>
<div class=”col-md-3”></div>
<div class=”col-md-3”></div>
<div class=”col-md-3”></div>
</div>

OR

<div class=”row”>
<div class=”col-md-6”></div>
<div class=”col-md-6”></div>

lxxiii
</div>

OR
<div class=”row”>
<div class=”col-md-12”></div>
</div>

Code 4.0:The layout

4.2.3 The Web Services :The web services are located remotely from the html file consuming
them, a web service client is setup in form of client scripting of type jQuery which is a framework
of javascript. This web service client connects to an address and demands for data from the web
service set up in that address. A SOAP (Simple Object Access Protocol) web service connected
with an ASMX(Active Server Method Extended) file. Data of format Java Script Object Notation
(JSON )is been exchanged between the web service and the web service client which is set up at
the user end residing on the html document.

$.post("../LoginService.asmx/dataFeed", {"param":"elections"}, function (response, status) {


for (var i = 0; i < response.length; i++) {
var obc = response[i];
$("#elec_data").append("<tr id='" + obc.id + "'><td>" + obc.id + "</td</tr>");
}
yu
$('#loader').hide();
});

Code 4.1: Web client service

lxxiv
[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public void getUserData()
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
//These headers are handling the "pre-flight" OPTIONS call sent by the browser
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET,
POST, PUT, DELETE");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-
Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}

String resultJSON = "";


JavaScriptSerializer js = new JavaScriptSerializer();

Code 4.2: Web Service Sending JSON

4.2.4 User Experience and Simplicity: The layout was designed to be simple and user friendly
as shown in the screen shots displayed in the figure below. The simplicity aided in making the
html pages render on time and mind-blowing user experience was applied by the non-refreshing
nature of the pages.

lxxv
Figure 4.28: Non-Refreshing Page

All pages get called up from within via jQuery AJAX/JSON. No page refreshes.

Figure 4.29: Simple Looking Design

The simplicity of the design enhances user experience.

4.2.5 Application Security: Security was achieved in a variety of ways: pages cannot be refreshed
at any point while voting.Special client scripting codes stopped pages from refreshing, and in the

lxxvi
case of forced refreshes while voting, the page automatically remembers that the voter has voted,
and subsequently throws him out.

private int check = 1;


protected void Page_Load(object sender, EventArgs e)
{
check++;

if (LoginService.VIN == "" || LoginService.getVIN == "" || check==3)


{
check = 1;
Response.Redirect("/error/1/", true);
}
}

Code 4.3: Voter status

byte[] bval = VoterData.GenerateSaltedHash(Encoding.UTF8.GetBytes(passcode),


Encoding.UTF8.GetBytes(VIN));
vin_no.Value = Convert.ToBase64String(bval);
while (reader.Read())
{
byte[] saltp = VoterData.GenerateSaltedHash(Encoding.UTF8.GetBytes(password),
Encoding.UTF8.GetBytes(vin));
bool rest = VoterData.CompareByteArrays(saltp,
Convert.FromBase64String(reader["passcode"].ToString()));

Code 4.4:Password Encryption

While logging in, the password is encrypted with the username as salt, which basically translates
to the fact that the salted and encrypted value is stored in the database as password while the
username is equally stored too. When a voter logs in, the username will fetch the encrpyted value
and while it encrypt the username and password supplied, it compares it with

lxxvii
the one it fetched from the database. If it is the same, it redirects to the voters user page, otherwise,
it bounces off.

4.2.6 Database Considerations: The database logically resides in a remote location and gets
connected to via a connection string stored in the configuration file web.config.

<connectionStrings>
<add name="conn" connectionString="Data
Source=MACHINE_NAME\SQLEXPRESS;Initial Catalog=e_voting_system; Integrated
Security=SSPI;User ID=root;Password=" />
</connectionStrings>

Code 4.5:Database String Connection

The database was well wired with foreign keys to restrain any accidental data deletion, optimizaton
of the server and its resources its on.

4.3 System Requirement for the Developed System

4.3.1 Software Requirements

Operating System (Window 7 Professional or higher version)

Relational Database Management System(RDBMS) Microsoft (MsSQL 2012 or


higher)

Programming Language C#.NET

Integrated Development Environment (IDE) Visual Studio 2013

Others include .NET FRAMEWORK 4.5,Web hosting from Somee.com, SMS gateway API from
clicktell.com.

lxxviii
Browser: Any web browser can be used by the user to run this application. Such browsers
include but are not limited to Mozilla Firefox, Safari, Google Chrome, Opera Mini, Internet
Explorer etc

4.3.2 Hardware Requirement


Memory (1GB upward)

Hard Drive (10GB upward)

Processing Speed: 2.4GHz Minimum

Word length: 32 or 64 bit

lxxix
CHAPTER FIVE

SUMMARY, CONCLUSION AND RECOMMENDATIONS

5.0 Introduction

This chapter concludes the design, development and implementation of a web-based electronic
voting system by presenting a summary, conclusion and future recommendation. The chapter is
divided into different sections. Section 5.1 gives a brief summary of findings from chapter 1-4,
and Section 5.2 presents some contributions to the body of knowledge, while Section 5.3 offers
some recommendations and suggestions for further studies.

5.1 Summary

Electronic voting has received significant recent media coverage, and, with the Internet becoming
more pervasive in our everyday life, the topic will continue to receive much attention. The study
focused on the design and implementation of a web-based electronic voting system .At the
conclusion of the study, the aim of designing, developing and deploying a secured electronic
voting system was achieved. This electronic voting system if applied on the country’s electoral
system will go a long way in tackling headlong all the challenges the nation has been facing in her
electoral system in the time past. Voter apathy in Nigeria is largely as a result of electoral violence
and vote manipulation which had caused a serious lack of trust among a large section of the
population. The web-based electronic voting system will greatly assist the nation in reducing the
high cost of elections, printing of materials, transportation and other logistics that consume huge
amount of funds while making easy the process of vote collation and result declaration.

5.2 Conclusion

The designed system met all the set objectives of the study, both in the design and correctional
with regards to the present electoral system in Nigeria. The study if considered and projected it
will go a long way to solving problems currently facing the electoral institution like voter apathy
and violence and disenfranchisement of eligible voters.

Electronic voting offers convenience to the voter and considerable ease to election administrators
as they can get election results out more quickly than conventional methods of manual voting.

lxxx
5.3 Recommendations

Electronic voting is often seen as a tool for making the electoral process more efficient and for
increasing trust in its management. Properly implemented, e-voting solutions can increase the
security of the ballot, speed up the processing of results and make voting easier. However, the
challenges are considerable. If not carefully planned and designed, e-voting can undermine the
confidence in the whole electoral process. Trust and confidence in any electoral system is an
important factor both to the electorates and the candidates vying for posts. Therefore it is
recommended that E-voting systems should be certified by an independent agency and audits
should be conducted throughout the process to allow independent confirmation of the results
produced. Trust can take years to build but can be lost in one day, therefore While it can take a
long time for an e-voting system to be socially accepted, but loss of trust can happen fast if there
are serious technical problems or political disagreements. A badly implemented or failed e-voting
solution can halt further development of this technology for years.

lxxxi
REFERENCES

Abldulhamid, S.M; Ugiomoh, D.O; Abdulmalik, M.D. (2013). Development of Real time E-voting
System in Nigeria with Emphasis on Security and Real Veracity. International Journal of
Computer Network and Information Security, 9-18.
Adebayo, K.J; Yusuf, S.E & Adetula E.O. (2014). Secure E-vote: A Model for Multi Agent
Electronic Voting System. African Journal of Computing and ICT, 55-54.
Ahmed, A. (2015). History of Elections In Nigeria from Independence. Peoples Daily, 31.

Alabi, A. (2011). Independent National Electoral Commission (INEC) and the Conduct of 2011
Election in Nigeria: A paradigm. International Journal of Politics and G, 4(4.1), 90-101.
Alvarez, R. (2010). Electronic Elections: The Perils and Promises of Digital democracy.
Maryland: COEN.

Blank News Online (2015) found at https://blanknewsonline.wordpress.com/2017/04/28/curbing-


institutional-corruption-in-nigeria-by-johnson-ebigide/ Accessed 16th April 2016
Conrad, F.G; Lewis, B; Peytcheva, E; Traugott, M; Hanmer, M.T & Hermson, P.S. (2006). The
Usability of Electronic Voting Systems: Rules from a laboratory Study. Midwest Political
Science Association. Chicago: COEN.
Cranor, L.F; Cytron, R.K. (2000). Design and Implementation of a Practical Security Conscious
Electronic Polling System. Washington University , Department of Computer Science.
Washington: WUCS.
Emeka, G. A. (2016). E-Voting and Credible Elections in Nigeria. International Journal of
Engineering Science Invention, 23-30.
Encyclopoedia. (2001). Election (Political Science). EB.

Engineering Network Team (2015) Gains of the INEC Card Reader in the 2015 Elections.
Avaliable at Go.engineer-ng.net/m/blogpost?id=6404812%3ABlogPost%3A103341.
Accessed 12, April 2016
Everett, S. (2007). The Usability of Electronic Voting Machine, and How Votes can be Changed
Without Detection. Houston TX: Rice University.
Everett, S.P; Byrne, M.D & Greene, K.K. (2006). Measuring the Usability of Paper Ballots:
Efficiency, effectiveness and satisfaction. Human Factor and Ergonomic society . santa
Monica , CA.
Fujioka, A, et Voting Scheme for Large Scale Eelections. (2001). A Practical Secret V. Advances
in Cryptography-AUSCRYPT 92 (pp. 244-251). Queensland Australia: LNCS.
Ginsberg, B. (2007). Election . Redmond: WA: Microsoft Corporation.

lxxxii
Greene, K.K; Byrne, M.D; & Everett, S.P. (2006). A Comparison os Usability Between Voting
Methods. The USENIX/ACCURATE Electronic Voting Methods Workshop (. 112-132).
Vancouver: BC.
Halim, I. (2015). Was The Introduction of PVCs and Card Readers Necessary? Retrieved January
31, 2016, from Connect Nigeria: of PVCs and Card Readers Necessary? In Connect
Nigeria. Found online at http://connectnigeria.com/articles/2015/04/02/was-the-
introduction-of-pvcs-and-card-readers-necessary/
Halim, I. (2015, 04 02). Was the Introduction of PVCS and Card Readers Necessary? Connect
Nigeria.
IDEA. (2011). Introducing Electronic Voting: Essential COnsiderations. Sweden: Bulls Graphics.
Iyayi, F. (2016). The Conduct of Elections and Electoral Practices in Nigeria. Retrieved January
23, 2016, from Dawwodu: http://www.dawodu.com/iyayi1.htm
Jega, A. (2015, October Electoral Reforms in Nigeria, Challenges and Prospects). Retrieved
January 16, 2016, from University of Abuja:
ttps://www.uniabuja.edu.ng/pdf/ElectoralReformsbyProfJega.pd
jega, A. (2015). Electoral reforms in Nigeria: Challenges and prospects.

Jegede, A.J; Aimufua, G.I.O& Akosu, N.I. (2009). Electronic Voting: A Panacea for Electoral
Irregularities in Developing Countries. Journal of Mobile Communications, 22-33.
Joachim, R et al . (2003). REVS-A Robust Electronic Voting System. IADIS International
Conference e-Society (pp. 95-103). Lisbon, Portugal: IADIS.
John, N.S; Ayo, C.K; Ndujuiba, C & Okereke, C.E. (2013). Designs and Implementation of a
Unified e-ID Card for Secure Electronic Voting System. International Journal of
Computer and Information Technology(IJCIT), 1131-1135.
Linu, P., & Anikumar, M. (2012). Authentication for Online Voting Using Steganography and
Biometrics. International Journal of Advanced Research in Computer Engineering and
Technology (IJARCET), 104-123.
Malkawi, M; Khasawneh, M; Al-Jarrah, O. (2009). Modeling and Simulation of a Robust E-Voting
System. Communications of IBIMA, 1943-7765.
McGrane, K. (2013). The Rise of the Mobile-only-user. Retrieved December 26, 2015, from
https://hbr.org/2013/05/the-rise-of-the-mobile-only-us
Miller, J. (2000). The Impact of Candidate Name Order on Election Outcomes. Illinois: KOEN.
Musa, M.A; Aliyu, F.M. (2013). Design of Electronic Voting System for Reducing Election
Process. International Journal of Recent Technology and Engineering, 67-78.
Nathan David et al, Sch. J. Eng Tech, (2014); 2 (6B) 874-881.

lxxxiii
Nnoli, O. (2003). Intoduction to Politics (2nd Ed.). Enugu: PACREP.

Obianyo, N.E; Emesibe, V. (2015). Independent National Electoral Commission (INEC) and the
Administration of 2015 Elections in Nigeria: The Strengths, the Weaknesses and the
Challenges. Abuja: INEC Nigeria.
Ohkubo, M et al. (2002). An Improvement of a Practical Secret Voting Scheme. International
Workshop on Information Security (pp. 1314-1444). Chicago: LNCS Springer-Verlag.

Okamoto, T. (1999). Receipt-Free Electronic Voting Schemes for Large Scale Elections.
Workshop on Security Protocols (pp. 25-35). 7, Paris, France: LNCS 1316.
Okediran, O; Omidiora, S.O; Olabiyisi, S.O & Ganiyu, R.A. (2011). A Compararative Study of
Generic Cryptographic Models for Secure Electronic Voting. British Journal of Sciences,
67-89.
Okonji, E. (2015, April 28). Recounting the Card Reader Experience. Thisday Live, 34.

Omolaye, P; Daniel, P & Orifa, A.O. (2015). Systemic Evaluation of Semi-Electronic Voting
System Adopted in Nigeria 2015 General Election. American Journal of Information
Systems, 228-341.
Pran, V & Merloe, P. (2007). NDI Handbook: Monitoring Electronic Technologies in Electoral
Processes . Houston: KOEN.
Ray, I & Narasimhamurthi, N. (2001). An Anonymous Electronic Voting Protocol for Voting Over
the Internet. Workshop Advanced Issues of E-Commerce and Web-Based Information
Systems, (188-190).
Roth, S. (2001). Disenfrancjised by Design: Voting System and the Election Process. Information
Design Journal, 1-8.
Sodiya, A.S; Onashoga, S.A & Adelani, D. (2011). A Secure E-Voting Architecture. Eighteenth
International Conference of Information Technology: New Generations (ITNG). IEEE.
Team, E. N. (n.d.). Gains of INEC Card Reader in the 2015 Elections. Retrieved December 10,
2015, from Go Engineers: Go.engineer-
ng.net/m/blogpost?id=6404812%3ABlogPost%3A103341
Ubachukwu, N.D; Ijomanta, H; Ozoudeh, C.G. (2014). A Biometric based Software Solution for
E-Voting Using Networking. Scholars Journal of Engineering and Technology, 874-881.

lxxxiv
APPENDIX

Code powering the very first page at the root, the login page for voters Default.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Odbc;
using System.Data;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Configuration;
using System.Text;

public partial class _Default : System.Web.UI.Page


{
private static String conn =
ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
SqlConnection con = new SqlConnection(conn);
SqlCommand cmd;
SqlDataReader reader;

protected void Page_Load(object sender, EventArgs e)


{
LoginService.VIN = null;
LoginService.getVIN = null;
VoterData.eids.Clear();
VoterData.qlength = 0;

lxxxv
VoterData.currentElection = 0;
//byte[] bval = VoterData.GenerateSaltedHash(Encoding.UTF8.GetBytes("bop1.tp#"),
Encoding.UTF8.GetBytes("ENG0502206"));
//vin_no.Value = Convert.ToBase64String(bval);
}

public void conChecker()


{
if (con != null && con.State == ConnectionState.Closed)
{
con.Open();
}

}
protected void btnLogin_Click(object sender, EventArgs e)
{
String vin = vin_no.Value;
String password = pword.Value;

conChecker();
String mainstr = "SELECT * FROM voters WHERE vin='" + vin + "' AND passcode='" +
password + "'";
cmd = new SqlCommand(mainstr, con);
reader = cmd.ExecuteReader();

while (reader.Read())
{
//byte[] saltp = VoterData.GenerateSaltedHash(Encoding.UTF8.GetBytes(password),
Encoding.UTF8.GetBytes(vin));
//bool rest = VoterData.CompareByteArrays(saltp,
Convert.FromBase64String(reader["passcode"].ToString()));

lxxxvi
if (vin != reader["VIN"].ToString() && password != reader["passcode"].ToString())
{
Response.Redirect("Default.aspx?loginError=1");
LoginService.errorMsg = "Error: Refine Your Inputs";
}

else
{
LoginService.VIN = vin;
LoginService.getVIN = vin;
LoginService.getPNumber = reader["phone_number"].ToString();
Response.Redirect("user/", true);
//
}
}

}
}

CodeFile.aspx.cs supplying data to a lot of pages via ajax means

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;

lxxxvii
using System.Collections;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.Odbc;
using System.Data;
using System.Configuration;
using System.Web.Script.Serialization;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Text;
using System.Text.RegularExpressions;
using System.Net;
using System.IO;

public partial class codeFile : System.Web.UI.Page


{
private static String conn =
ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
SqlConnection con = new SqlConnection(conn);
List<string> eids = new List<string>();
StringBuilder buil = new StringBuilder();
protected void Page_Load(object sender, EventArgs e)
{
}

[WebMethod]
[ScriptMethod]
public static string GetNewToken(string parameter)
{
String reply = "";

lxxxviii
if (string.IsNullOrEmpty(parameter))
{
SqlConnection con = new SqlConnection(conn);

if (con != null && con.State == ConnectionState.Closed)


{
con.Open();
}

//String nToken = Convert.ToBase64String(Guid.NewGuid().ToByteArray());


String nToken = RandomIdGenerator.GetBase36(8);

HttpWebRequest request =
WebRequest.Create("http://api.clickatell.com/http/sendmsg?user=Emekamicrosoft&password=H
bFSJRNdfXOfIZ&api_id=3600438&to="+LoginService.getPNumber+"&text="+nToken) as
HttpWebRequest;
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
Stream stream = response.GetResponseStream();

SqlDataReader maindr;
String mainstr = "SELECT * FROM voting_token WHERE dateIssued ='" +
DateTime.Today + "' AND VIN_id = '" + LoginService.getVIN + "'";
SqlCommand maincmd = new SqlCommand(mainstr, con);
maindr = maincmd.ExecuteReader();

if (maindr.HasRows)
{
VoterData vdt = new VoterData();

lxxxix
vdt.execQuery("UPDATE voting_token SET value='" + nToken + "', time_issued =
'"+DateTime.Now+"' WHERE dateIssued ='" + DateTime.Today + "' AND VIN_id = '" +
LoginService.getVIN + "'");
reply = nToken;
LoginService.vToken = nToken;
}

else
{

VoterData vdt = new VoterData();


vdt.execQuery("INSERT INTO voting_token (VIN_id, time_issued, value, dateIssued,
lifetime_mins) VALUES ('" + LoginService.getVIN + "', '" + DateTime.Now + "', '" + nToken +
"','"+DateTime.Today+"', '20')");
reply = nToken;
LoginService.vToken = nToken;
}

else
{
SqlConnection con = new SqlConnection(conn);

if (con != null && con.State == ConnectionState.Closed)


{
con.Open();
}

SqlDataReader maindr;

xc
String mainstr = "SELECT * FROM voting_token WHERE dateIssued ='" +
DateTime.Today + "' AND value ='" + parameter + "' AND VIN_id = '" + LoginService.getVIN
+ "'";
SqlCommand maincmd = new SqlCommand(mainstr, con);
maindr = maincmd.ExecuteReader();

if (maindr.HasRows)
{
while (maindr.Read())
{
DateTime time_issued = Convert.ToDateTime(maindr["time_issued"]);
time_issued = time_issued.AddMinutes((int)maindr["lifetime_mins"]);

if (time_issued > DateTime.Now)


{
reply = "<p class='text-success text-center'><b>TOKEN VALID AND
VERIFIED<b><p>";
LoginService.votingRights = false;
}

else
{
reply = "<p class='text-warning text-center'><b>TOKEN
INVALID/EXPIRED<b><p>";
}

}
}

else
{

xci
reply = "<p class='text-danger text-center'><b>TOKEN NONEXISTENT<b><p>";
}
}
return reply;
}

[WebMethod]
[ScriptMethod]
public static string cPassword(String param, String param2)
{
String pcode = "";

SqlConnection con = new SqlConnection(conn);

if (con != null && con.State == ConnectionState.Closed)


{
con.Open();
}

SqlDataReader maindr;
String mainstr = "SELECT passcode FROM voters WHERE VIN =
'"+LoginService.getVIN+"'";
SqlCommand maincmd = new SqlCommand(mainstr, con);
maindr = maincmd.ExecuteReader();
while (maindr.Read())
{
pcode = maindr["passcode"].ToString();
}

if (param2 == pcode)
{

xcii
VoterData vdt = new VoterData();
vdt.execQuery("UPDATE voters SET passcode='"+param+"' WHERE VIN =
'"+LoginService.getVIN+"'");
return "true";
}

else { return param2; }


}

[WebMethod]
[ScriptMethod]
public static void UpdateTable(String columnName, String dvalue, Int16 rowID, String
tableName)
{
VoterData vdt = new VoterData();
if (columnName == "timeFinish" || columnName == "timeStart" || columnName ==
"date_of_election")
{
DateTime dat = Convert.ToDateTime(dvalue);
vdt.execQuery("UPDATE " + tableName + " SET " + columnName + "='" + dat + "'
WHERE id ='" + rowID + "'");
}

else
{
vdt.execQuery("UPDATE " + tableName + " SET " + columnName + "='" + dvalue + "'
WHERE id ='" + rowID + "'");
}
}

[WebMethod]

xciii
[ScriptMethod]
public static void tInsert(String param1, String param2, String param3, String param4)
{
VoterData vdt = new VoterData();
if (param3 == "wards")
{
vdt.execQuery("INSERT INTO wards(name, lga_id, state_id) VALUES('" + param1 +
"','" + param2 + "',(SELECT state_id FROM lga WHERE name ='" + param2 + "'))");
}

else if (param3 == "state_house_const")


{
vdt.execQuery("INSERT INTO state_house_const(name, state_id, coverage_area)
VALUES('" + param1 + "','" + param2 + "','" + param4 + "')");
}

else if (param3 == "fed_house_const")


{
vdt.execQuery("INSERT INTO fed_house_const(name, state_id, coverage_area)
VALUES('" + param1 + "','" + param2 + "','" + param4 + "')");
}

else if (param3 == "senDistrict")


{
vdt.execQuery("INSERT INTO senatorial_districts(name, state_id, coverage_area)
VALUES('" + param1 + "','" + param2 + "','" + param4 + "')");
}
}

[WebMethod]
[ScriptMethod]

xciv
public static void newElec(String typeID, String timeStart, String timeFinish, String
date_of_election, String coverage_area)
{
VoterData vdt = new VoterData();
vdt.execQuery("INSERT INTO elections(type_id, timeStart, timeFinish, total_votes_cast,
date_of_election,coverage_area) VALUES('" + typeID + "','" + timeStart + "','" + timeFinish +
"',0,'" + date_of_election + "','" + coverage_area + "')");
}

[WebMethod]
[ScriptMethod]
public static void newCandidate(String firstName, String lastName, String party_id, String
election_id)
{
VoterData vdt = new VoterData();
vdt.execQuery("INSERT INTO candidates(firstName, lastName, party_id, election_id,
score) VALUES('" + firstName + "','" + lastName + "','" + party_id + "','" + election_id + "',0)");
}

[WebMethod]
[ScriptMethod]
public static void newAction(String action)
{
VoterData vdt = new VoterData();
if (action == "reset_elections")
{
vdt.execQuery("UPDATE elections SET date_of_election =
STUFF(CONVERT(VARCHAR(50),date_of_election,126) ,1, 10, (SELECT
CAST(GETDATE() AS DATE))), timeStart =
STUFF(CONVERT(VARCHAR(50),timeStart,126) ,1, 10, (SELECT CAST(GETDATE() AS

xcv
DATE))), timeFinish = STUFF(CONVERT(VARCHAR(50),timeFinish,126) ,1, 10, (SELECT
CAST(GETDATE() AS DATE)))");
}
}

[WebMethod]
[ScriptMethod]
public static string deleteItems(string ids)
{
String a = ids;
a= a.Replace("\"", "");
Regex.Replace(a, @"[\[\]']+", "");
for (var i = 0; i < a.Length; i++)
{
VoterData vdt = new VoterData();
vdt.execQuery("DELETE FROM votes WHERE id='"+(int)a[i]+"'");
}

return "done";
}

[WebMethod]
[ScriptMethod]
public static void deleteItem(string param1, String param2)
{
VoterData vdt = new VoterData();
vdt.execQuery("DELETE FROM "+param1+" WHERE id='" + param2 + "';");
}

public void conChecker()

xcvi
{
if (con != null && con.State == ConnectionState.Closed)
{
con.Open();
}

public void execQuery(String query)


{
conChecker();
SqlCommand command1 = new SqlCommand();
command1 = con.CreateCommand();
command1.CommandText = query;
command1.ExecuteNonQuery();
con.Close();
}
}

Web Service Class, LoginService.cs supplying web service JSON SOAP data to a lot of
pages

using System;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

xcvii
using System.Data.Odbc;
using System.Data;
using System.Configuration;
using System.Web.Script.Serialization;
using System.Web.Script.Services;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Collections.Generic;

//Created a class

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class LoginService : System.Web.Services.WebService
{
private static String conn =
ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
SqlConnection con = new SqlConnection(conn);
DataTable dt;
SqlCommand cmd;
SqlDataReader reader;
public static String getVIN, getPNumber, saltp, errorMsg, vToken;
public static bool votingRights = true;
public int currentElection = 1;
public List<string> eids = new List<string>(); int qlength = 0;
VoterData vtdt = new VoterData();
public LoginService()
{

xcviii
}

public static string VIN


{
get
{
object value = HttpContext.Current.Session["VIN"];
return value == null ? "" : (string)value;
}
set
{
HttpContext.Current.Session["VIN"] = value;
}
}

[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public void getUserData()
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
//These headers are handling the "pre-flight" OPTIONS call sent by the browser
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET,
POST, PUT, DELETE");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-
Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}

xcix
String resultJSON = "";
JavaScriptSerializer js = new JavaScriptSerializer();

try
{

Context.Response.Clear();
Context.Response.ContentType = "application/json";
con.Open();
cmd = new SqlCommand("SELECT * FROM voters WHERE VIN = '" +getVIN+ "'",
con);
reader = cmd.ExecuteReader();
dt = new DataTable();
dt.Load(reader);
con.Close();
JavaScriptSerializer serializer = new JavaScriptSerializer();
List<Dictionary<String, Object>> tableRows = new List<Dictionary<string, object>>();
Dictionary<String, Object> row;
foreach (DataRow dr in dt.Rows)
{
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col].ToString());
}
tableRows.Add(row);
}
resultJSON = serializer.Serialize(tableRows).ToString();
}
catch (Exception ex)
{

c
resultJSON = ex.Message.ToString();
}

reader.Close();
con.Close();

Context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Context.Response.Cache.SetNoStore();
Context.Response.Write(resultJSON);
// return resultJSON;
}

[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public void getNewElections(String param1, String param2)
{

if (!string.IsNullOrEmpty(param1) && !string.IsNullOrEmpty(param2))


{
VoterData vdt = new VoterData();
vdt.execQuery("INSERT INTO votes(VIN_id,token,candidate_id,timeSent,election_id)
VALUES('"+getVIN+"','"+vToken+"','"+param2+"','"+DateTime.Now+"','"+param1+"')");
vdt.execQuery("UPDATE voters SET last_voted = '" + DateTime.Today + "'");
vdt.execQuery("UPDATE candidates SET score = (score + 1) WHERE id = '" + param2
+ "'");
vdt.execQuery("UPDATE elections SET total_votes_cast = (total_votes_cast + 1)
WHERE id = '" + param1 + "'");
}

int valv = vtdt.getElections();

ci
if (valv > 0)
{
String cl = VoterData.eids[valv - 1];

HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
//These headers are handling the "pre-flight" OPTIONS call sent by the browser
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET,
POST, PUT, DELETE");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers",
"Content-Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}

String resultJSON = "";


JavaScriptSerializer js = new JavaScriptSerializer();

try
{

Context.Response.Clear();
Context.Response.ContentType = "application/json";
con.Open();
cmd = new SqlCommand("SELECT candidates.id AS cid,candidates.firstName,
candidates.lastName,candidates.party_id, candidates.election_id, elections.type_id,
elections.timeFinish, elections.coverage_area FROM candidates, elections WHERE
candidates.election_id = elections.id AND candidates.election_id = '" + cl + "' ", con);
reader = cmd.ExecuteReader();

cii
dt = new DataTable();
dt.Load(reader);
JavaScriptSerializer serializer = new JavaScriptSerializer();
con.Close();
List<Dictionary<String, Object>> tableRows = new List<Dictionary<string,
object>>();
Dictionary<String, Object> row;
foreach (DataRow dr in dt.Rows)
{
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col].ToString());
}
tableRows.Add(row);
}
resultJSON = serializer.Serialize(tableRows).ToString();
}
catch (Exception ex)
{
resultJSON = ex.Message.ToString();
}

reader.Close();
con.Close();

Context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Context.Response.Cache.SetNoStore();
Context.Response.Write(resultJSON);
// return resultJSON;
}

ciii
else
{
List<Dictionary<string, string>> MyList = new List<Dictionary<string, string>>();

MyList.Add(new Dictionary<string, string>());


//MyList.Add(new Dictionary<string, int>());
MyList[0].Add("Terminate", "true");
// MyList[0].Add("Dictionary 2", 2);
// MyList[0].Add("Dictionary 3", 3);
// MyList[0].Add("Dictionary 4", 4);

String resultJSON = "";


JavaScriptSerializer serializer = new JavaScriptSerializer();
resultJSON = serializer.Serialize(MyList).ToString();

/* foreach (var dictionary in MyList)


foreach (var keyValue in dictionary)
Console.WriteLine(string.Format("{0} {1}", keyValue.Key, keyValue.Value));
} */

Context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Context.Response.Cache.SetNoStore();
Context.Response.Write(resultJSON);

}
}

civ
[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public void electionFeed()
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
//These headers are handling the "pre-flight" OPTIONS call sent by the browser
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET,
POST, PUT, DELETE");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-
Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}

String resultJSON = "";


JavaScriptSerializer js = new JavaScriptSerializer();

try
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
List<Dictionary<String, Object>> tableRows = new List<Dictionary<string, object>>();
Dictionary<String, Object> row;

Context.Response.Clear();
Context.Response.ContentType = "application/json";
con.Open();
cmd = new SqlCommand("SELECT elections.* FROM elections WHERE
(elections.coverage_area = (SELECT rWard FROM voters WHERE VIN = '" + getVIN + "') OR
elections.coverage_area = (SELECT rLga FROM voters WHERE VIN = '" + getVIN + "') OR

cv
elections.coverage_area = (SELECT rState_Const FROM voters WHERE VIN = '" + getVIN +
"') OR elections.coverage_area = (SELECT rFed_Const FROM voters WHERE VIN = '" +
getVIN + "') OR elections.coverage_area = (SELECT rSen_District FROM voters WHERE VIN
= '" + getVIN + "') OR elections.coverage_area = (SELECT rState FROM voters WHERE VIN =
'" + getVIN + "') OR elections.coverage_area = 'Nigeria') AND elections.date_of_election =
'"+DateTime.Today+"'", con);
reader = cmd.ExecuteReader();

if (reader.HasRows)
{
dt = new DataTable();
dt.Load(reader);

foreach (DataRow dr in dt.Rows)


{
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col].ToString());
}
tableRows.Add(row);
}
resultJSON = serializer.Serialize(tableRows).ToString();
}

else
{
resultJSON = "No data!";
}

cvi
con.Close();
}
catch (Exception ex)
{
resultJSON = ex.Message.ToString();
}

reader.Close();
con.Close();

Context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Context.Response.Cache.SetNoStore();
Context.Response.Write(resultJSON);
// return resultJSON;

}
[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public void searchParam(String param1, String param2, String param3)
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
//These headers are handling the "pre-flight" OPTIONS call sent by the browser
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET,
POST, PUT, DELETE");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-
Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}

cvii
String resultJSON = "", sQuery = "SELECT * FROM "+param1+" WHERE
"+param3+"='"+param2+"'";
JavaScriptSerializer js = new JavaScriptSerializer();

try
{

Context.Response.Clear();
Context.Response.ContentType = "application/json";
con.Open();
cmd = new SqlCommand(sQuery, con);
reader = cmd.ExecuteReader();
dt = new DataTable();
dt.Load(reader);
reader.Close();
con.Close();
JavaScriptSerializer serializer = new JavaScriptSerializer();
List<Dictionary<String, Object>> tableRows = new List<Dictionary<string, object>>();
Dictionary<String, Object> row;
foreach (DataRow dr in dt.Rows)
{
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col].ToString());
}
tableRows.Add(row);
}
resultJSON = serializer.Serialize(tableRows).ToString();
}

cviii
catch (Exception ex)
{
resultJSON = ex.Message.ToString();
}

Context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Context.Response.Cache.SetNoStore();
Context.Response.Write(resultJSON);
// return resultJSON;

[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public void dataFeed(String param)
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
//These headers are handling the "pre-flight" OPTIONS call sent by the browser
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET,
POST, PUT, DELETE");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-
Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}

cix
String resultJSON = "", sQuery = "";
JavaScriptSerializer js = new JavaScriptSerializer();

if (param == "voters") { sQuery = "SELECT * FROM voters;"; }


else if (param == "votes") { sQuery = "SELECT * FROM votes;"; }
else if (param == "candidates") { sQuery = "SELECT candidates.*,
elections.date_of_election, elections.type_id, elections.coverage_area FROM candidates INNER
JOIN elections ON candidates.election_id = elections.id;"; }
else if (param == "elections") { sQuery = "SELECT elections.* FROM elections;"; }
else if (param == "voting_token") { sQuery = "SELECT * FROM voting_token;"; }
else if (param == "getLGAs") { sQuery = "SELECT * FROM lga;"; }
else if (param == "getLGAsdt") { sQuery = "SELECT name FROM lga;"; }
else if (param == "getWards") { sQuery = "SELECT * FROM wards;"; }
else if (param == "getStateConst") { sQuery = "SELECT * FROM state_house_const;"; }
else if (param == "getFederalConst") { sQuery = "SELECT * FROM fed_house_const;"; }
else if (param == "getSenDistrict") { sQuery = "SELECT * FROM senatorial_districts;"; }
else if (param == "getStates") { sQuery = "SELECT * FROM states;"; }
try
{

Context.Response.Clear();
Context.Response.ContentType = "application/json";
con.Open();
cmd = new SqlCommand(sQuery, con);
reader = cmd.ExecuteReader();
dt = new DataTable();
dt.Load(reader);
reader.Close();
con.Close();
JavaScriptSerializer serializer = new JavaScriptSerializer();
List<Dictionary<String, Object>> tableRows = new List<Dictionary<string, object>>();

cx
Dictionary<String, Object> row;
foreach (DataRow dr in dt.Rows)
{
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col].ToString());
}
tableRows.Add(row);
}
resultJSON = serializer.Serialize(tableRows).ToString();
}
catch (Exception ex)
{
resultJSON = ex.Message.ToString();
}

Context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Context.Response.Cache.SetNoStore();
Context.Response.Write(resultJSON);
// return resultJSON;

[WebMethod]
[ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json)]
public void eResults(String param)
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")

cxi
{
//These headers are handling the "pre-flight" OPTIONS call sent by the browser
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET,
POST, PUT, DELETE");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-
Type, Accept");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}

String resultJSON = "";


JavaScriptSerializer js = new JavaScriptSerializer();

try
{

Context.Response.Clear();
Context.Response.ContentType = "application/json";
con.Open();
cmd = new SqlCommand("SELECT candidates.*, elections.total_votes_cast FROM
candidates INNER JOIN elections ON candidates.election_id = elections.id WHERE election_id
= '" + param + "'", con);
reader = cmd.ExecuteReader();
dt = new DataTable();
dt.Load(reader);
con.Close();
JavaScriptSerializer serializer = new JavaScriptSerializer();
List<Dictionary<String, Object>> tableRows = new List<Dictionary<string, object>>();
Dictionary<String, Object> row;
foreach (DataRow dr in dt.Rows)
{

cxii
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col].ToString());
}
tableRows.Add(row);
}
resultJSON = serializer.Serialize(tableRows).ToString();
}
catch (Exception ex)
{
resultJSON = ex.Message.ToString();
}

reader.Close();
con.Close();

Context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Context.Response.Cache.SetNoStore();
Context.Response.Write(resultJSON);
// return resultJSON;
}

public int getElections()


{
if (currentElection == 1)
{

conChecker();
SqlDataReader maindr;

cxiii
String mainstr = "SELECT elections.id FROM elections WHERE
elections.coverage_area = (SELECT rWard FROM voters WHERE VIN = '" + getVIN + "') OR
elections.coverage_area = (SELECT rLga FROM voters WHERE VIN = '" + getVIN + "') OR
elections.coverage_area = (SELECT rState_Const FROM voters WHERE VIN = '" + getVIN +
"') OR elections.coverage_area = (SELECT rFed_Const FROM voters WHERE VIN = '" +
getVIN + "') OR elections.coverage_area = (SELECT rSen_District FROM voters WHERE VIN
= '" + getVIN + "') OR elections.coverage_area = (SELECT rState FROM voters WHERE VIN =
'" + getVIN + "') OR elections.coverage_area = 'Nigeria' AND elections.date_of_election='" +
DateTime.Today + "'";
SqlCommand maincmd = new SqlCommand(mainstr, con);
maindr = maincmd.ExecuteReader();

while (maindr.Read())
{
eids.Add(maindr["id"].ToString());
}

qlength = eids.Count;

maindr.Close();
con.Close();
}

else
{
if (currentElection < qlength)
{
currentElection++;
}

else

cxiv
{
currentElection = 0;
}
}
return currentElection;
}
public void conChecker()
{
if (con != null && con.State == ConnectionState.Closed)
{
con.Open();
}

jQuery code in user/new_elections.html pulling web service data from sources

<script type="text/javascript">
$(document).ready(function () {
var tp = false;
$('#errorMsg').hide();
$('.vToken').hide();
$('#pvportal').attr('disabled', 'disabled');
$('#pvtoken').attr('disabled', 'disabled');

$('#loader').show();

$('#pvportal').click(function () {
if (tp == true)

cxv
{
window.location.replace("../election/");
}
else
{
$('.vToken').show();
$(this).attr('disabled', 'disabled');
}

});

$('#pvtoken').click(function () {
$.ajax({
type: "POST",
url: "../codeFile.aspx/GetNewToken",
data: "{'parameter':'" + tokenValue.value + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {

if (data.d == "<p class='text-success text-center'><b>TOKEN VALID AND


VERIFIED<b><p>") { tp = true;}
$(".vToken").empty().fadeIn('slow').html(data.d);
$('#pvportal').removeAttr('disabled');
},

error: function (xhr, status, error) {


alert(xhr.responseText + " " + status + " " + error);
}
});

cxvi
});

$('#tokenValue').keypress(function () {
$('#pvtoken').removeAttr('disabled');
});

$.post("../LoginService.asmx/electionFeed", {}, function (response, status) {


for (var i = 0; i < response.length; i++) {

var obc = response[i];


$("#elec_data").append("<tr><th scope='row'>" + obc.id + "</th><td>" + obc.type_id +
"</td><td>" + obc.coverage_area + "</td><td>" + obc.date_of_election + "</td><td>" +
obc.total_votes_cast + "</td><td>" + obc.timeStart + " - " + obc.timeFinish + "</td></tr>");

if (obc.last_voted == obc.date_of_election) {
$("#startVote #startVoting").attr('disabled', 'disabled');
$("#startVote #extraInfo").append("You have voted in today's election(s)! ");
}

$('#loader').hide();
})
.fail(function (response) {
$('#errorMsg').fadeIn('slow').show();
$('#loader').hide();
});

cxvii
$("#startVote #startVoting").click(function () {
var counter = 5;
var interval = setInterval(function () {
counter--;
$("#timerd").html(counter);
if (counter == 0) {

$.ajax({
type: "POST",
url: "../codeFile.aspx/GetNewToken",
data: "{'parameter':''}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
$("#pbar").html("Token SMS sent to your phone number.");
$('#pvportal').removeAttr('disabled');
},

error: function (xhr, status, error) {


alert(xhr.responseText+" "+status+" "+error);
}
});

clearInterval(interval);
$("#timerd").html('');
}
}, 1000);
});

});
</script>

cxviii
jQuery code in Admin/sendistrict.html pulling data from web service sources, similar with
that of stateconst.html, states.html, lga.html, fedconst.html, Elections.html

<script>
$(function () {

var counter = 0;
pullData();

$(document).on('click', 'table tr td a', function () {

if (confirm("Do you want to do this?"))


{
$("#elec_data1").empty(); $("#elec_data2").empty();

var param1 = $(this).attr('id');


var param2 = $(this).parent().parent().attr('id');

$.ajax({
type: "POST",
url: "../codeFile.aspx/deleteItem",
data: "{'param1':'" + param1 + "', 'param2':'" + param2 + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) { pullData();},

error: function (xhr, status, error) {


alert(xhr.responseText + " " + status + " " + error);
}

cxix
});
}

});

$("#addConst").click(function (e) {
counter = 0;
$("#elec_data1").empty(); $("#elec_data2").empty();
$.ajax({
type: "POST",
url: "../codeFile.aspx/tInsert",
data: "{'param1':'" + $("#senDistrict").val() + "','param2':'" + $("#state_name").val()
+ "','param3':'senDistrict', 'param4':'" + $("#coverage_area").val() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) { pullData(); $('#sHouse')[0].reset(); },

error: function (xhr, status, error) {


alert(xhr.responseText + " " + status + " " + error);
}
});
return false;
});

function pullData() {
counter = 0;
$("#elec_data1").hide();
$("#elec_data2").hide();

$.post("../LoginService.asmx/dataFeed", { "param": "getSenDistrict" }, function


(response, status) {

cxx
for (var i = 0; i < response.length; i++) {
var obc = response[i];
counter++;

if (counter <= 8) {
$("#elec_data1").append("<tr id='" + obc.id + "'><td>" + counter + "</td><td
id='name' contenteditable='true'>" + obc.name + "</td><td id='state_id' contenteditable='true'>"
+ obc.state_id + "</td><td id='coverage_area' contenteditable='true'>" + obc.coverage_area +
"</td><td><a href='#' id='senatorial_districts'><img width='18' height='18' src='del.png'
/></a></td>");
}

else if (counter > 8) {


$("#elec_data2").append("<tr id='" + obc.id + "'><td>" + counter + "</td><td
id='name' contenteditable='true'>" + obc.name + "</td><td id='state_id' contenteditable='true'>"
+ obc.state_id + "</td><td id='state_id' contenteditable='true'>" + obc.coverage_area +
"</td><td><a href='#' id='senatorial_districts'><img width='18' height='18' src='del.png'
/></a></td>");
}

}
$("#elec_data1").fadeIn().show();
$("#elec_data2").fadeIn().show();

$('#loader').hide();
});
}
$("#resetElections").click(function(e) {
e.defaultPrevented;

$.ajax({

cxxi
type: "POST",
url: "../codeFile.aspx/newAction",
data: "{'action':'reset_elections'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) { },

error: function (xhr, status, error) {


alert(xhr.responseText + " " + status + " " + error);
}
});

});

$('body').on('focus', '[contenteditable]', function () {


var $this = $(this);
$this.data('before', $this.html());
return $this;
}).on('blur keyup paste input', '[contenteditable]', function () {
var $this = $(this);
if ($this.data('before') !== $this.html()) {
$this.data('before', $this.html());
$this.trigger('change');

$.ajax({
type: "POST",
url: "../codeFile.aspx/UpdateTable",
data: "{'columnName':'" + $this.attr('id') + "','dvalue':'" + $this.html() +
"','rowID':'" + $this.parent().attr('id') + "','tableName':'senatorial_districts'}",
contentType: "application/json; charset=utf-8",

cxxii
dataType: "json",
success: function (data) {},

error: function (xhr, status, error) {


alert(xhr.responseText + " " + status + " " + error);
}
});
}
return $this;
});
});
</script>

jQuery code in Admin/vToken.html pulling data from web service sources

<script>
$(function () {
$("#inf").hide();

var selected = "";

$(document).on('change', 'input:checkbox', function () {


if (this.checked) {
$('#deleteVotes').removeAttr('disabled');
}
else { $('#deleteVotes').attr('disabled', 'disabled'); }
});

cxxiii
$('#deleteVotes').click(function (e) {
e.defaultPrevented;
var selected = [];

$('#elec_data input:checked').each(function () {
selected.push($(this).val());
});

var theIds = JSON.stringify(selected);

$.ajax({
type: "POST",
url: "../codeFile.aspx/deleteItems",
data: "{'ids':'" + theIds + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
$("#inf").empty().fadeIn('slow').show().append("<div class='alert alert-success
alert-dismissible fade in' role='alert'> <button type='button' class='close' data-dismiss='alert' aria-
label='Close'><span aria-hidden='true'>×</span></button> <strong>Success!</strong>
Successfully deleted item(s). </div>");
},

error: function (xhr, status, error) {


alert(xhr.responseText + " " + status + " " + error);
}
});
selected = [];
});

$('#select_all').click(function (e) {

cxxiv
var table = $(e.target).closest('table');
$('td input:checkbox', table).prop('checked', this.checked);
});

$.post("../LoginService.asmx/dataFeed", { "param": "voting_token" }, function


(response, status) {
for (var i = 0; i < response.length; i++) {
var obc = response[i];
$("#elec_data").append("<tr id='" + obc.id + "'><td><input type='checkbox'
value='" + obc.id + "' id='selectcb' class='form-control' /></td><td>" + obc.id + "</td><td
id='Vin_id'>" + obc.VIN_id + "</td><td id='time_issued' contenteditable='true'>" +
obc.time_issued + "</td><td id='value' contenteditable='true'>" + obc.value + "</td><td
id='lifetime_mins' contenteditable='true'>" + obc.lifetime_mins + "</td></tr>");
}
$('#loader').hide();
})
.fail(function (response) {
alert('Error: ' + response.responseText + ' you seem not to have active elections.');
});

$('body').on('focus', '[contenteditable]', function () {


var $this = $(this);
$this.data('before', $this.html());
return $this;
}).on('blur keyup paste input', '[contenteditable]', function () {
var $this = $(this);
if ($this.data('before') !== $this.html()) {
$this.data('before', $this.html());
$this.trigger('change');

$.ajax({

cxxv
type: "POST",
url: "../codeFile.aspx/UpdateTable",
data: "{'columnName':'" + $this.attr('id') + "','dvalue':'" + $this.html() +
"','rowID':'" + $this.parent().attr('id') + "','tableName':'voting_token'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) { },

error: function (xhr, status, error) {


alert(xhr.responseText + " " + status + " " + error);
}
});
}
return $this;
});
});
</script>

C# code used in managing the Default.aspx page used in Election/Default.aspx and similar
in user/Default.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Election_Default : System.Web.UI.Page


{
private int check = 1;

cxxvi
protected void Page_Load(object sender, EventArgs e)
{
check++;

if (LoginService.VIN == "" || LoginService.getVIN == "" || check==3)


{
check = 1;
Response.Redirect("/error/1/", true);
}
}
}

cxxvii
cxxviii
cxxix
cxxx
cxxxi

Potrebbero piacerti anche