PromptHub
ChatGPT Coding Free

Laravel-Inspired MVC PHP Quiz System for University Campus

Create a PHP web application using a custom MVC architecture similar to Laravel, but do NOT use Laravel framework or Composer packages.

The project name is University Campus Quiz System.

The system must be mobile and desktop responsive, using TailwindCSS with a dark blue themed modern UI.


1. Architecture

Use a clean MVC structure similar to Laravel.

Project structure:

  /app
/controllers
/models
/views
/core
Controller.php
Model.php
Router.php
/config
config.php
/public
index.php
/assets
css
js
/routes
web.php
/storage
/database  

Requirements:

• Routing system like Laravel
• Clean controller based structure
• PDO database connection
• Autoload classes
• Simple middleware support
• Error handling page


2. UI Design

Use TailwindCSS CDN.

Theme requirements:

Primary color:

  Dark Blue
#0f172a
#1e3a8a
#2563eb  

UI requirements:

• modern dashboard layout
• mobile responsive
• quiz cards
• smooth hover animations
• modern buttons
• rounded cards
• dark/light compatible
• animated progress bar for quiz timer

Pages must be responsive for:

• desktop
• tablet
• mobile


3. User Roles

Two roles:

Admin

Admin can:

• create quiz categories
• add quiz questions
• edit questions
• delete questions
• view quiz results
• manage users
• dashboard statistics


Student / Participant

Student can:

• register/login
• browse quiz categories
• start quiz
• answer questions
• see score instantly
• see leaderboard
• see previous results


4. Database Structure

Create SQL tables.

users

  id
name
email
password
role
created_at  

categories

  id
title
description
created_at  

quizzes

  id
category_id
title
time_limit
created_at  

questions

  id
quiz_id
question
option_a
option_b
option_c
option_d
correct_answer  

results

  id
user_id
quiz_id
score
completed_at  

5. Quiz System Logic

Quiz must include:

• countdown timer
• multiple choice questions
• auto submit when time finishes
• calculate score
• store results in database

Flow:

  Category → Quiz → Questions → Submit → Score → Leaderboard  

6. Dashboard Pages

Admin dashboard should show:

• total users
• total quizzes
• total questions
• recent quiz results

Student dashboard should show:

• available quizzes
• completed quizzes
• leaderboard


7. Leaderboard

Leaderboard must display:

  Rank
Student Name
Quiz Title
Score
Completion Time  

Sorted by highest score.


8. Security

Include:

• password hashing
• CSRF protection
• prepared PDO queries
• login session system


9. Additional Features

Add modern UI elements:

• animated quiz progress bar
• countdown timer
• success / error alerts
• modal popup for quiz start


10. Deliverables

The generated code must include:

• full MVC structure
• database SQL file
• sample data
• clean commented code
• easy installation steps


Optional Extra Feature

Add:

• live leaderboard update using AJAX
• quiz result chart using Chart.js