A PHP/MySQL web application for managing student records, courses, and subjects - featuring a dashboard, full CRUD operations, session-based authentication, and a Singleton database pattern.
Overview โข Features โข Tech Stack โข Database โข Architecture โข Installation โข Usage
A full-stack web application for student information management, built with PHP and MySQL. The system allows administrators to manage students, courses, and subjects through a clean dashboard interface with complete Create, Read, Update, and Delete (CRUD) operations.
This was developed as a 3rd semester B.Tech project demonstrating practical database management, server-side scripting, MVC-like architecture, and the Singleton design pattern.
- Register new students with personal and academic details (name, gender, guardian, income, category, phone, email, course, session)
- View all enrolled students in a tabular format
- Edit student records
- Delete student entries
- Add new courses with short name, full name, and date
- View all available courses
- Edit course details
- Delete courses
- Check course availability
- Add subjects linked to courses (up to 3 subjects per entry)
- View all subjects
- Edit subject details
- Delete subjects
- Admin login with session management
- Session-based page protection
- Logout functionality
- Prepared statements for SQL injection prevention (
bind_param)
- Admin dashboard with statistics overview
- Morris.js and Flot data visualizations
- Quick access to all management modules
| Category | Technology | Purpose |
|---|---|---|
| Backend | PHP 7.x | Server-side logic and routing |
| Database | MySQL | Relational data storage |
| DB Pattern | Singleton (Database.php) | Single shared DB connection |
| Frontend | HTML5 / CSS3 | Page structure and styling |
| UI Framework | Bootstrap (via Bower) | Responsive layout and components |
| Charts | Morris.js, Flot | Dashboard data visualizations |
| JavaScript | Vanilla JS | Client-side interactions and alerts |
| Server | Apache (XAMPP/WAMP/LAMP) | PHP-capable web server |
| Package Manager | Bower | Frontend dependency management |
Database name: schoolmanagement
The system manages the following data entities:
| Entity | Key Fields | Operations |
|---|---|---|
| Login | loginid, password | Authentication |
| Courses | course_short, course_full, date | Full CRUD |
| Subjects | course_ref, subject1, subject2, subject3 | Full CRUD |
| Students | name, gender, guardian, course, session, phone, email, income, category | Full CRUD |
| Sessions | session year/period | Reference data |
| Countries | country list | Reference data for registration |
Default login credentials:
Username: admin
Password: admin
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Browser (Client) โ
โ Dashboard โ Students โ Courses โ Subjects โ Login โ
โโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTP
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PHP Backend โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ pages/ โ โ
โ โ dashboard.php login.php session.php โ โ
โ โ register.php view.php edit-std.php โ โ
โ โ add-course.php view-course.php edit-course.phpโ โ
โ โ add-subject.php view-subject.php edit-sub.php โ โ
โ โ leftbar.php logout.php dbcontroller.php โ โ
โ โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ config/ โ โ
โ โ Database.php โโ Singleton connection manager โ โ
โ โ DbFunction.php โโ All CRUD operations โ โ
โ โ โข login() โข register() โ โ
โ โ โข create_course() โข edit_course() โ โ
โ โ โข create_subject()โข edit_subject() โ โ
โ โ โข showStudents() โข del_course() โ โ
โ โ โข showCourse() โข del_std() โ โ
โ โ โข showSubject() โข del_subject() โ โ
โ โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ mysqli
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MySQL Database โ
โ schoolmanagement โ
โ tbl_login โ tbl_courses โ tbl_subjects โ tbl_students โ
โ tbl_session โ tbl_country โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Pattern | Implementation | Purpose |
|---|---|---|
| Singleton | Database.php |
Ensures only one DB connection exists throughout the application |
| Data Access Object (DAO) | DbFunction.php |
Centralizes all database queries in one class |
| Session Guard | session.php |
Protects pages from unauthorized access |
- XAMPP / WAMP / LAMP (Apache + PHP + MySQL)
- Web browser
# 1. Clone the repository
git clone https://github.com/zishnusarker/A-Student-Database-Management-System-.git
# 2. Copy the project to your web server directory
# The actual app code is inside this nested path:
# Student Management System/std php/std php/
# For XAMPP (Windows):
xcopy "Student Management System\std php\std php" C:\xampp\htdocs\student-mgmt /E /I
# For XAMPP (Linux/Mac):
cp -r "Student Management System/std php/std php/" /opt/lampp/htdocs/student-mgmt- Start Apache and MySQL from XAMPP/WAMP control panel
- Open phpMyAdmin at
http://localhost/phpmyadmin - Create a new database:
CREATE DATABASE schoolmanagement;
- Import the schema:
- Click on
schoolmanagementdatabase - Go to Import tab
- Select
schoolmanagement.sqlfrom the project folder - Click Go
- Click on
http://localhost/student-mgmt/index.php
Login with:
Username: admin
Password: admin
After login, the dashboard provides an overview with quick access links to all modules.
- Add Student - Fill in personal details, select course and session, submit
- View Students - Browse all enrolled students in a table
- Edit Student - Click edit on any record, modify fields, save
- Delete Student - Remove a student record permanently
- Add Course - Enter course short name, full name, and date
- View Courses - List all courses with edit/delete actions
- Course Availability - Check which courses are currently active
- Add Subject - Link up to 3 subjects to a course
- View Subjects - See all subject entries
- Edit/Delete - Modify or remove subject records
A-Student-Database-Management-System-/
โโโ README.md
โโโ .gitattributes
โ
โโโ Student Management System/
โโโ std php/std php/ # Main application root
โโโ index.php # Entry point
โโโ schoolmanagement.sql # Database schema
โโโ READ ME FIRST !!!!.txt # Original setup instructions
โ
โโโ config/ # Database layer
โ โโโ Database.php # Singleton DB connection
โ โโโ DbFunction.php # All CRUD operations (18 functions)
โ
โโโ pages/ # Application pages (17 files)
โ โโโ login.php # Admin login
โ โโโ logout.php # Session destroy
โ โโโ session.php # Session guard
โ โโโ dashboard.php # Main dashboard
โ โโโ leftbar.php # Sidebar navigation
โ โโโ dbcontroller.php # Form action handler
โ โโโ register.php # Student registration
โ โโโ view.php # View all students
โ โโโ edit-std.php # Edit student
โ โโโ add-course.php # Add course
โ โโโ view-course.php # View courses
โ โโโ edit-course.php # Edit course
โ โโโ course_availability.php # Check availability
โ โโโ add-subject.php # Add subject
โ โโโ view-subject.php # View subjects
โ โโโ edit-sub.php # Edit subject
โ โโโ subject.php # Subject details
โ
โโโ dist/ # Static assets (CSS, JS, images)
โโโ bower_components/ # Frontend libraries (Bootstrap, etc.)
โโโ js/ # Chart data files
โโโ flot-data.js # Flot chart data
โโโ morris-data.js # Morris chart data
What is the Singleton Design Pattern?
The Singleton pattern ensures a class has only one instance and provides a global access point to it. In this project, Database.php uses Singleton to maintain a single MySQL connection throughout the application - preventing multiple redundant connections that waste server resources.
Key elements: private constructor, private static instance variable, public getInstance() method, and a private __clone() to prevent duplication.
Why use Prepared Statements?
DbFunction.php uses prepared statements ($mysqli->prepare() + $stmt->bind_param()) instead of concatenating user input into SQL strings. This prevents SQL injection attacks - one of the most common web vulnerabilities (OWASP Top 10). The database treats bound parameters as data, never as executable SQL code.
What is Session-Based Authentication?
PHP sessions store user state between page requests. After a successful login, a session variable is set. The session.php guard checks for this variable on every protected page - redirecting unauthenticated users back to the login page. logout.php destroys the session.
What is the DAO pattern?
The Data Access Object (DAO) pattern separates database operations from business logic. DbFunction.php serves as the DAO - all SQL queries are centralized in one class with clearly named functions (create_course(), showStudents(), del_subject(), etc.). This makes the code maintainable and changes to the database only affect one file.
- Migrate from Bower to npm or CDN-based dependencies
- Add password hashing (bcrypt) instead of plaintext storage
- Implement CSRF token protection on forms
- Add input sanitization and server-side validation
- Implement role-based access control (admin vs teacher vs student)
- Add search and filtering on list views
- Implement pagination for large datasets
- Add student attendance and grade tracking modules
- Migrate to PDO from mysqli for better portability
- Add responsive mobile layout improvements
- Implement RESTful API endpoints for future frontend integration
This is an educational project. It uses default credentials (
admin/admin) and plaintext password storage. For production use, you would need to implement password hashing, CSRF protection, input sanitization, HTTPS, and proper access controls.
This project is available as open source.
Made with โค๏ธ as a B.Tech 3rd Semester Database Project