This project is a basic Online Examination System built with PHP, MySQL, HTML, and CSS. It allows an administrator to create and manage exams and users to take those exams. This system is intended as a foundational project for learning web development concepts, and it can be expanded with additional features as needed.
- Admin Panel: Allows the admin to create, update, delete exams and questions.
- User Dashboard: Enables users to log in, take exams, and review results.
- Question Management: Supports multiple-choice questions.
- Result Calculation: Automatic grading upon exam completion.
- PHP >= 7.4
- MySQL >= 5.7
- Apache Web Server (or any compatible PHP server)
- Composer (optional, if using dependencies)
git clone [https://github.com/your-username/online-exam-system.git](https://github.com/Chowdhurynaseeh/online-examination-system)
cd online-examination-system
Create a MySQL database. You can name it online_exam_system. Import the database.sql file in the sql/ directory to create tables. Update the database configuration in config.php with your MySQL credentials. // config.php
<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'your_username');
define('DB_PASSWORD', 'your_password');
define('DB_DATABASE', 'online_exam_system');
$conn = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
Start your local server (e.g., Apache or XAMPP). Place the project folder in the server's root directory (e.g., htdocs for XAMPP). Open your web browser and navigate to http://localhost/online-examination-system.
Username: admin Password: admin123 You can change the default admin credentials directly in the users table in the database.
online-exam-system/ ├── config.php # Database connection configuration ├── index.php # Home page with login and signup ├── admin/ │ ├── dashboard.php # Admin dashboard for managing exams │ ├── add_exam.php # Form to add a new exam │ ├── add_question.php # Form to add questions to exams ├── user/ │ ├── dashboard.php # User dashboard to view available exams │ ├── take_exam.php # Exam interface for users │ ├── results.php # Shows exam results for users ├── assets/ # CSS, JavaScript, and images └── sql/ └── database.sql # SQL file to create the initial database and tables
Stores user data with the following columns:
id
: Primary keyusername
: Unique username for loginpassword
: Hashed passwordrole
:admin
oruser
to differentiate permissions
Stores exam data with the following columns:
id
: Primary keytitle
: Title of the examdescription
: Description of the examcreated_at
: Timestamp of exam creation
Stores questions for each exam with the following columns:
id
: Primary keyexam_id
: Foreign key linked toexams
tablequestion
: The question textoption_a
,option_b
,option_c
,option_d
: Multiple-choice optionscorrect_option
: Specifies the correct option for grading
Stores user exam results with the following columns:
id
: Primary keyuser_id
: Foreign key linked tousers
tableexam_id
: Foreign key linked toexams
tablescore
: User’s score in the exam
- Admin Login: Log in as an admin to create exams and add questions.
- User Registration/Login: Users can register or log in to view and take exams.
- Take Exam: Users can select an exam, answer questions, and submit.
- View Results: Upon completion, users can view their score, and the admin can view all users' scores.
- Password Hashing: Make sure to hash user passwords in production (use
password_hash()
in PHP). - SQL Injection: Use prepared statements for all SQL queries to prevent SQL injection.
- Session Management: Ensure sessions are managed securely to protect user data.
- Add user role management (e.g., for moderators).
- Allow admins to upload images for questions.
- Improve the UI with more advanced CSS and JavaScript.
- Implement time limits for exams.
- Add a feedback system for exam reviews.