View on GitHub

VoteCDJ

Electronic voting for the student government

Download this project as a .zip file Download this project as a tar.gz file

Preface

For a non-technical explanation in French, please refer to the user’s manual.


Introduction

This project is meant to enable the students of the Cité des Jeunes to quick and easy voting for the student government. In this document, there will be a full technical documentation of the inner workings of the system. Included in this document are: explanations, code samples and diagrams to explain key concepts of the system. Expect this text to be fairly technical and the reader should be proficient in C#, PHP, HTML and SQL databases before making changes to the system. For security, passwords have been withheld from this page and are present in the physical copy of the documentation.


Design (Server)

Users

To set up the MySQL users that the systems require you need to enable remote access on port 3306. Then edit the my.cnf or my.ini file and comment out:
bind-address = 127.0.0.1
Once you did that you can now create two users to be controlled by the system called sec_user and sec_remote.
CREATE USER 'sec_remote'@'%' IDENTIFIED BY '**password**';
CREATE USER 'sec_user'@'%' IDENTIFIED BY '**password**';
Then give the users permissions using these queries:
GRANT SELECT, INSERT, UPDATE, DELETE ON 'Vote'.* TO 'sec_remote'@'%';
GRANT SELECT, INSERT, UPDATE ON 'Vote'.* TO 'sec_user'@'localhost';
Then add the test user into the database using:
INSERT INTO 'Vote'.'members' VALUES(1, 'test_user','**longhash**','**longhash**',0,9);
And now you're set up all ready to go

MySQL Database Layout

In the case of a file system corruption or accidental deletion of important tables, this section aims to help the user understand the layout of the database itself. Below is the hierarchy of the database and the type of columns.

Vote: database name
1-candidates: table name
|-id: INT NOT NULL AUTO_INCREMENT PRIMARY KEY
|-postID: INT NOT NULL
|-name: CHAR(128) NOT NULL
|-grade: INT NOT NULL
|
2-login_attempts: table name
|-user_id: INT(11) NOT NULL
|-time: VARCHAR(30) NOT NULL
|
3-members: table name
|-id: INT NOT NULL AUTO_INCREMENT PRIMARY KEY
|-username: VARCHAR(30) NOT NULL
|-password: CHAR(128) NOT NULL
|-salt: CHAR(128) NOT NULL
|-hasvoted: INT NOT NULL <-- Boolean int (1 or 0)
|-grade: INT NOT NULL
|
4-post: table name
|-id: INT NOT NULL AUTO_INCREMENT PRIMARY KEY
|-name: CHAR(128) NOT NULL
|-grade: INT NOT NULL
|
5-vars: table name
|-voteStarted: INT NOT NULL <-- Boolean int (1 or 0)
|
6-voteHistory: table name
|-id: INT NOT NULL AUTO_INCREMENT PRIMARY KEY
|-voteTime: DATETIME NOT NULL
|-candidateID: INT NOT NULL
|-postID: INT NOT NULL

Web server

The web server used is Apache v2.2.22 and PHP v5.4.41. Whether it’s Linux or Windows it doesn’t matter. The setup was built on a Raspberry Pi B+ but it was designed for multiple operating systems. To install the system, copy the files of the www folder (https://github.com/AideTechBot/VoteCDJ/tree/master/www) to the web server’s index. You can test if the server is working by logging in using this test user:

USERNAME: foo
PASSWORD: bar


Authors and Contributors


Support or Contact

Having trouble with VoteCDJ? Contact me at ***REMOVED***.