#######################
#					   	
# How Login.php Works  
#					   
#######################

First of all a check is done to ensure that the voter has enabled Cookies and Javascript on their Internet browser. On a
successful pass of this test the main Login page is displayed in the Web browser. On the login page there are four
textboxes viz. Username, Password, USDID (Optional Token3) and Social Security Number (Optional Token4). 

When the user clicks on the submit button a funtion is called (i.e. validate_user) which returns an error message if the
login has been unsuccessful (e.g. if the user has already logged in before, incorrect username, password etc.) an error
message is echoed back to the user indicating the problem and then redirects him/her to the login page.

Upon successful login the PHP code sets a cookie (called 'authCookie') on the voter's computer and checks their ACL 
(Access Control List. See the note on 'ACL' in Manual.txt). to get the positions for which they are eligible to vote on. After obtaining the 
positions which they can vote for the code finds the number of choices which are allowed for a particular election. If
there is only one choice we call the make_radio() function which prints out a list of radio buttons and the candidates
names beside them. Radio buttons ensures that only one choice can be made from the selection of candidates. On postions
where more than one candidate can be voted for we use Checkboxes and Javascript to check that the number of choices is
maintained.

When the voter has made their selections from the ballot, the 'Submit' button is pressed and redirects our program to 
'Voted.php' which will be described next. Please note at this stage that no effort is made to ensure that a user votes
on every Position canvassed.


#######################
#					  	
# How Voted.php Works #
#					  
#######################
 
This code basically inserts the user's votes into the database for tallying. The structure of the program is as follows:

Get the random number from the database which was assigned to the user upon successful authentication. We then compare the random number stored in the database and compare it to the random number stored in the cookie on the user's hard disk. These two strings should always match up. If they match we proceed and check if the user has voted before. If they have voted before they are automatically redirected to the login screen and not allowed to proceed. Otherwise we insert the user's votes into the VOTES table in our database logging:

a) IP Address of voter
b) Timestamp of when vote was casted
c) Unique ID of votes (in our case 'token3')
d) ID of Candidate and ID of Position viz. CANDIDATEID and POSITIONID respectively.


#######################
#						
# How Admin.php Works 
#					  
#######################

Admin.php is responsible for adding, editing, and deleting Ballots, Positions and Candidates. The program has been
structured in a hierarchial tree-like structure from Ballots down to Candidated for each Position.

By default, Admin.php displays a list of all the Ballots in the eVoter system. There are a number of options after this:

### View Ballots | Positions | Candidates ### 
By selecting a Ballot name you can view all the Positions associated with a particular Ballot and so on to all the
Candidates within that particular Position. 

### Add, Edit, Delete Ballots | Positions | Candidates ### 
For adding, editing and deleting a seperate function is called for each request.


########################
#					   	
# How Config.php Works 
#					   
########################

TThe configuration file is a 'one-stop' information point for the deployment of eVoter. Global variables located here
include: $host (e.g. localhost), $username (username of database being used, MySQL in this case), $password (the 
database password), $token3 (this can be any extra form of security you wish for e.g. we have used the students college 
ID number). $token4 (as for token3, we have opted for SSN). It should be noted here that variables $token3 and $token4 
are optional security measures. If you would only like to authenticate your users by username(eMail handle) and password
(eMail password) then leave token 3 and token4 blank. Example: $token3=""; $token4"";


###########################
#							      	
# How ViewVotes.php Works 
#					      
###########################

Located in the 'admin' directory, viewvotes.php displays the tallies for each election. It selects the active ballot and
gets the positions in this ballot. It then gets the total number of votes for a particualr position and counts the
number of votes for each candidate and prints out the total number of votes, the number of votes for each individual
candidate, and the percentage of votes for each.

