🌼 Daisy School Election β€” Setup Guide

Use this page to prepare passwords, configure the database, and deploy the system.

πŸ” Password Hash Generator

The system uses PHP's password_hash(). Generate hashes here to paste into your SQL or config files.
Note: This tool runs in your browser β€” passwords never leave your device.

Hash will appear here…
Click hash to copy
PurposeSuggested PasswordWhere Used
Red House vote pageredhouse2081houses table, id=1
Blue House vote pagebluehouse2081houses table, id=2
Green House vote pagegreenhouse2081houses table, id=3
Yellow House vote pageyellowhouse2081houses table, id=4
Results unlock (admin)results2081election_config table

⚠ Change these before going live. Don't use the same password for multiple houses.

πŸ“‹ Deployment Steps

1

Create the database

Run schema.sql in phpMyAdmin or via MySQL CLI:

mysql -u root -p < schema.sql
2

Set real password hashes

Use the generator above. Then update the houses table and election_config:

UPDATE houses SET password='YOUR_HASH' WHERE id=1;  -- Red
UPDATE houses SET password='YOUR_HASH' WHERE id=2;  -- Blue
UPDATE houses SET password='YOUR_HASH' WHERE id=3;  -- Green
UPDATE houses SET password='YOUR_HASH' WHERE id=4;  -- Yellow
UPDATE election_config SET value='YOUR_HASH' WHERE `key`='results_password';
3

Edit config.php

Set your actual database credentials:

define('DB_USER', 'your_cpanel_db_user');
define('DB_PASS', 'your_db_password');
define('DB_NAME', 'daisy_election');
4

Import candidates & students

Edit the INSERT statements in schema.sql with real names, or insert via phpMyAdmin.
Candidates need: name, class, section, house_id, role.
Students need: name, roll_no, class, section, house_id.

5

Upload all files to server

Upload to your public_html or a subfolder. Files needed:

index.html       ← Main dashboard
vote_red.html    ← Red House voting booth
vote_blue.html   ← Blue House voting booth
vote_green.html  ← Green House voting booth
vote_yellow.html ← Yellow House voting booth
api.php          ← Backend (all API calls)
config.php       ← DB credentials (keep private)
6

Test before election day

βœ“ Open each house voting page and verify password works
βœ“ Look up a test student roll number
βœ“ Cast a test vote and check the DB
βœ“ Verify the live count on index.html updates
βœ“ Test results unlock with the admin password
βœ“ Reset test votes: DELETE FROM votes; UPDATE students SET has_voted_house=0, has_voted_head=0, voted_at=NULL;

πŸ“ File Summary

FilePurposeAudience
index.htmlMain dashboard β€” live counts + resultsPublic screen / Admin
vote_red.htmlRed House voting stationRed House students only
vote_blue.htmlBlue House voting stationBlue House students only
vote_green.htmlGreen House voting stationGreen House students only
vote_yellow.htmlYellow House voting stationYellow House students only
api.phpAll backend logic & DB queriesServer-side only
config.phpDB credentialsServer-side only
schema.sqlFull DB schema + sample dataOne-time setup
setup.htmlThis page β€” setup guideAdmin only (delete after setup)

⚠ Warning Delete setup.html from the server after completing setup.