Skip to content

Full-stack Electronic Voting System with PHP & MySQL. Features secure admin panel, real-time results, separate candidate/party management, voter authentication & responsive design. Database Systems course project - evolved from C++ version. Contributions welcome! πŸ—³οΈ

Notifications You must be signed in to change notification settings

FayazNoor/Voting-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—³οΈ Electronic Voting System

A comprehensive web-based electronic voting platform built with PHP, MySQL, HTML, CSS, and JavaScript. This system enables secure and transparent democratic elections with separate interfaces for administrators and voters.

PHP MySQL HTML5 CSS3 JavaScript

🌟 Features

πŸ‘¨β€πŸ’Ό Administrator Module

  • User Management: Complete admin authentication and registration system
  • Party Management: Register and manage political parties with unique signs/symbols
  • Candidate Management: Register candidates and assign them to parties and constituencies
  • Election Management: Create, schedule, and monitor elections with real-time controls
  • Seat Management: Manage National Assembly (NA) and Provincial Assembly (PA) seats
  • Results Dashboard: Real-time election results with party-wise and candidate-wise analytics
  • Voter Oversight: Monitor voter registration and voting patterns

πŸ—³οΈ Voter Module

  • Secure Authentication: Email-based login with encrypted passwords
  • Constituency Assignment: Automatic assignment to NA and PA seats based on location
  • Interactive Voting Interface: User-friendly ballot with candidate photos and party symbols
  • Vote Verification: Prevents duplicate voting and ensures vote integrity
  • Results Access: View election results after voting completion

πŸ”’ Security Features

  • Password Encryption: Bcrypt hashing for all user passwords
  • Session Management: Secure PHP session handling
  • SQL Injection Prevention: Prepared statements for all database queries
  • Access Control: Role-based access control for admin and voter interfaces
  • Vote Privacy: Anonymous voting with audit trails

πŸ“ Project Structure

Website/
β”œβ”€β”€ πŸ“± Admin/                    # Administrator Interface
β”‚   β”œβ”€β”€ CSS/                     # Admin styling
β”‚   β”‚   β”œβ”€β”€ login.css
β”‚   β”‚   β”œβ”€β”€ register.css
β”‚   β”‚   └── Administration/      # Dashboard styles
β”‚   └── HTML/                    # Admin pages
β”‚       β”œβ”€β”€ login.php
β”‚       β”œβ”€β”€ register.php
β”‚       └── Administration/      # Admin dashboard pages
β”œβ”€β”€ πŸ—³οΈ Voter/                    # Voter Interface
β”‚   β”œβ”€β”€ CSS/                     # Voter styling
β”‚   β”‚   β”œβ”€β”€ login.css
β”‚   β”‚   └── Dashboard/           # Voting interface styles
β”‚   └── HTML/                    # Voter pages
β”‚       β”œβ”€β”€ login.php
β”‚       β”œβ”€β”€ cast_vote_register.php
β”‚       └── Dashboard/           # Voting pages
β”œβ”€β”€ βš™οΈ includes/                 # Backend Logic
β”‚   β”œβ”€β”€ config_session.php      # Session configuration
β”‚   β”œβ”€β”€ dbh.php                 # Database connection
β”‚   β”œβ”€β”€ Admin/                  # Admin controllers
β”‚   └── Voter/                  # Voter controllers
β”œβ”€β”€ 🏠 first_page.php           # Landing page
β”œβ”€β”€ 🎨 first_page.css           # Landing page styles
└── πŸ—ƒοΈ voting.sql              # Database schema

πŸš€ Installation & Setup

Prerequisites

  • Web Server: Apache/Nginx with PHP support
  • Database: MySQL 5.7+ or MariaDB
  • PHP: Version 7.4 or higher
  • Extensions: PDO, PDO_MySQL, bcrypt

Installation Steps

  1. Clone the Repository

    git clone https://github.com/FayazNoor/Voting-System.git
    cd Voting-System
  2. Database Setup

    # Create database
    CREATE DATABASE voting;
    
    # Import schema
    mysql -u root -p voting < voting.sql
  3. Configuration

    • Update database credentials in includes/dbh.php:
    $host = 'localhost';
    $dbname = 'voting';
    $dbusername = 'your_username';
    $dbpassword = 'your_password';
  4. Web Server Setup

    • Place project files in your web server document root
    • Ensure proper file permissions
    • Access via http://localhost/Voting-System/first_page.php

πŸ“Έ Screenshots

🏠 Landing Page

Landing Page

The main entry point where users choose between Admin and Voter interfaces.

πŸ” Admin Login

Admin Login

Secure authentication portal for election administrators.

πŸ“Š Admin Dashboard

Admin Dashboard

Comprehensive control panel for election management with real-time statistics.

πŸ“Š Admin Dashboard - Candidate View

Admin Dashboard 2

Detailed view showing candidates registered for a specific constituency seat with their party affiliations.

οΏ½β€πŸŽ“ Candidate Registration

Candidate Registration

Interface for registering candidates and assigning them to parties and constituencies.

πŸ›οΈ Party Registration

Party Registration

System for registering political parties with unique symbols and information.

⚑ Election Management

Election Starting

Election creation and scheduling interface with timing controls.

πŸ—³οΈ Voter Dashboard

Voter Dashboard

Main voter interface after authentication, showing available elections and options.

πŸ—³οΈ Voting Interface

Voting Interface

Interactive ballot interface with candidate selection and party symbols.

Note: The voting interface UI structure requires improvement and was not fully updated due to time constraints during development. Future updates will focus on enhancing the user experience and visual design of this critical component.

πŸ—„οΈ Database Schema

The system uses a relational database with the following key entities:

  • Users: Base user information (CNIC, name, demographics)
  • Admins: Administrative accounts with elevated privileges
  • Voters: Voter accounts linked to constituencies
  • Parties: Political parties with symbols and leadership
  • Candidates: Election candidates linked to parties and seats
  • Seats: Electoral constituencies (NA/PA seats)
  • Elections: Election cycles with timing and results
  • Votes: Individual vote records with anonymity

🎯 Key Functionalities

Election Lifecycle Management

  1. Pre-Election: Party and candidate registration, voter enrollment
  2. Election Period: Real-time voting with security controls
  3. Post-Election: Results compilation and result declaration

Voting Process

  1. Voter authentication and verification
  2. Constituency-based ballot generation
  3. Secure vote casting with confirmation
  4. Real-time vote counting and result updates

Administrative Controls

  1. Election scheduling and management
  2. Candidate and party oversight
  3. Voter registration monitoring
  4. Result compilation and announcement

πŸ› οΈ Technical Features

  • MVC Architecture: Clean separation of concerns
  • Responsive Design: Mobile-friendly interface
  • Real-time Updates: AJAX-powered dynamic content
  • Data Validation: Client and server-side validation
  • Error Handling: Comprehensive error management
  • Audit Trails: Complete election audit capabilities

πŸ“Š System Requirements

Minimum Requirements

  • RAM: 512 MB
  • Storage: 100 MB
  • PHP Memory: 128 MB
  • MySQL: 50 MB database space

Recommended Specifications

  • RAM: 2 GB+
  • Storage: 1 GB+
  • Concurrent Users: 1000+
  • Database: Dedicated MySQL server

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ‘₯ Authors

πŸ™ Acknowledgments

  • Election Commission guidelines for system design
  • Security best practices from OWASP
  • PHP community for framework inspiration

πŸ“ž Support

For support, email fayaz.noor.afridi@gmail.com or create an issue in this repository.


⭐ Star this repository if you find it helpful!

About

Full-stack Electronic Voting System with PHP & MySQL. Features secure admin panel, real-time results, separate candidate/party management, voter authentication & responsive design. Database Systems course project - evolved from C++ version. Contributions welcome! πŸ—³οΈ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published