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.
- 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
- 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
- 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
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
- Web Server: Apache/Nginx with PHP support
- Database: MySQL 5.7+ or MariaDB
- PHP: Version 7.4 or higher
- Extensions: PDO, PDO_MySQL, bcrypt
-
Clone the Repository
git clone https://github.com/FayazNoor/Voting-System.git cd Voting-System -
Database Setup
# Create database CREATE DATABASE voting; # Import schema mysql -u root -p voting < voting.sql
-
Configuration
- Update database credentials in
includes/dbh.php:
$host = 'localhost'; $dbname = 'voting'; $dbusername = 'your_username'; $dbpassword = 'your_password';
- Update database credentials in
-
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
The main entry point where users choose between Admin and Voter interfaces.
Secure authentication portal for election administrators.
Comprehensive control panel for election management with real-time statistics.
Detailed view showing candidates registered for a specific constituency seat with their party affiliations.
Interface for registering candidates and assigning them to parties and constituencies.
System for registering political parties with unique symbols and information.
Election creation and scheduling interface with timing controls.
Main voter interface after authentication, showing available elections and options.
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.
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
- Pre-Election: Party and candidate registration, voter enrollment
- Election Period: Real-time voting with security controls
- Post-Election: Results compilation and result declaration
- Voter authentication and verification
- Constituency-based ballot generation
- Secure vote casting with confirmation
- Real-time vote counting and result updates
- Election scheduling and management
- Candidate and party oversight
- Voter registration monitoring
- Result compilation and announcement
- 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
- RAM: 512 MB
- Storage: 100 MB
- PHP Memory: 128 MB
- MySQL: 50 MB database space
- RAM: 2 GB+
- Storage: 1 GB+
- Concurrent Users: 1000+
- Database: Dedicated MySQL server
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Fayaz Noor Afridi - Lead Developer - GitHub Profile
- Election Commission guidelines for system design
- Security best practices from OWASP
- PHP community for framework inspiration
For support, email fayaz.noor.afridi@gmail.com or create an issue in this repository.
β Star this repository if you find it helpful!








