# rohitm05/onlineexam architecture

> Architecture diagram of the GitHub repository rohitm05/onlineexam, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rohitm05/onlineexam
- Repository: https://github.com/rohitm05/onlineexam

## Overview

##### Project type and purpose
- This is a full-stack, monolithic PHP web application called “onlineexam.”
- It provides an online examination platform with user and admin interfaces for managing categories, questions, quizzes and sending email notifications.

##### High-level architecture based on the file tree
- Presentation layer (Frontend)
– PHP/HTML view pages: index.php, login/register pages, dashboard pages (usermanagement.php, postmanagement.php, questionmanagement.php, etc.)
– CSS (css/sb-admin.css, mystyle.css) and JS assets (js/sb-admin.js, jqueryvalidation.js, additional-methods.js, demo charts & datatables)
- Application layer (Backend logic)
– PHP scripts handling form submissions & CRUD: add-*.php, edit-*.php, delete-*.php, update-*.php
– Authentication & session management: user-login.php/back-end, admin-login.php, logout.php
– Business modules: quiz.php/quiz-calculate.php, mail.php/mail1.php for emailing, active-user.php/unactive-user.php
– Common utilities: con.php (database connection), header-admin.php, footer-admin.php
- Data layer
– Relational database (MySQL or MariaDB) accessed via con.php
- External service
– PHPMailer (vendor1/phpmailer) for sending emails

##### Key architectural patterns & design principles
- Layered architecture:
– Presentation → Application → Data
- Modular separation by feature: Authentication, Category Management, Question Management, Quiz Execution, Email Notification
- Dependencies managed via Composer (vendor1/)

##### Main components & interactions
a. Client Web Browser (Users & Admins)
– Sends HTTP requests to the Web Server, receives rendered HTML, CSS, JS
b. Web Server + PHP Runtime
– Routes requests to specific PHP scripts
– Executes business logic, accesses the database, triggers email sending
c. Database
– Stores users, categories, questions, quiz results
d. PHPMailer Service
– SMTP/email provider used by mail.php to send notifications or confirmations
e. Static Asset Server
– Serves CSS/JS under /css and /js

Interaction flow example:
1. User submits quiz form → quiz.php
2. quiz.php reads questions from DB, calculates score in quiz-calculate.php
3. quiz-calculate.php updates DB, invokes mail1.php to notify user
4. Response rendered to the browser

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Layer
    Browser["Client Browser"]:::external
    Browser -->|HTTP GET/POST| WebServer

    %% Web Server & PHP Runtime
    subgraph "Web Server & PHP Runtime"
        direction TB

        subgraph "Presentation Layer" 
            direction TB
            index["index.php"]:::presentation
            userLogin["user-login.php"]:::presentation
            userRegister["user-register.php"]:::presentation
            adminLogin["admin-login.php"]:::presentation
            logoutPage["logout.php"]:::presentation
            userMgmtPage["usermanagement.php"]:::presentation
            postMgmtPage["postmanagement.php"]:::presentation
            questionMgmtPage["questionmanagement.php"]:::presentation
            categoryPage["category.php"]:::presentation
            helpPage["help.php / help1.php"]:::presentation
            thanksPage["thanks.php"]:::presentation
            viewPaperPage["viewpaper.php"]:::presentation
            samplePage["sample.html / sample.php"]:::presentation
        end

        subgraph "Static Assets" 
            direction TB
            cssSA["css/sb-admin.css"]:::presentation
            mystyle["mystyle.css"]:::presentation
            jsSA["js/sb-admin.js"]:::presentation
            validation["jqueryvalidation.js"]:::presentation
            additionalMethods["additional-methods.js"]:::presentation
            chartArea["js/demo/chart-area-demo.js"]:::presentation
            chartBar["js/demo/chart-bar-demo.js"]:::presentation
            chartPie["js/demo/chart-pie-demo.js"]:::presentation
            datatablesDemo["js/demo/datatables-demo.js"]:::presentation
        end

        subgraph "Application Layer"
            direction TB
            subgraph "Authentication & Session Management"
                loginBackend["loginbackend.php"]:::application
                userLoginBackend["user-login-backend.php"]:::application
                userRegisterBackend["user-register-backend.php"]:::application
                logoutLogic["logout.php"]:::application
            end
            subgraph "Category Management"
                addCategory["add-category.php"]:::application
                addCategoryBE["add-category-backend.php"]:::application
                editCategory["edit-category.php"]:::application
                updateCategory["update-category.php"]:::application
                deleteCategory["delete-category.php"]:::application
            end
            subgraph "Post Management"
                addPost["add-post.php"]:::application
                addPostBE["add-post-backend.php"]:::application
                deletePost["delete-post.php"]:::application
            end
            subgraph "Question Management"
                addQuestion["add-question.php"]:::application
                addQuestionBE["add-question-backend.php"]:::application
                editQuestion["edit-question.php"]:::application
                updateQuestion["update-question.php"]:::application
                deleteQuestion["delete-question.php"]:::application
            end
            subgraph "Quiz Engine"
                selection["selection.php"]:::application
                startQuiz["quiz.php / quiz1.php"]:::application
                processQuiz["quiz-calculate.php / quiz-calculate1.php"]:::application
                thanksQuiz["thanks.php"]:::application
                viewPaper["viewpaper.php"]:::application
            end
            subgraph "User Management (Admin Controls)"
                activeUser["active-user.php"]:::application
                unactiveUser["unactive-user.php"]:::application
                deleteUser["delete-user.php"]:::application
            end
            subgraph "Email Notification Module"
                mail["mail.php"]:::application
                mail1["mail1.php"]:::application
            end
            subgraph "Utilities & Includes"
                con["con.php"]:::application
                headerAdmin["header-admin.php"]:::application
                footerAdmin["footer-admin.php"]:::application
            end
        end
    end

    %% Data Layer
    Database["MySQL/MariaDB Database"]:::data

    %% External Service
    PHPMailer["PHPMailer Service (SMTP)"]:::external

    %% Connections
    WebServer -->|SQL Queries| Database
    WebServer -->|SMTP API Calls| PHPMailer
    WebServer -->|HTTP Responses| Browser

    %% Click Events Presentation
    click index "https://github.com/rohitm05/onlineexam/blob/master/index.php"
    click userLogin "https://github.com/rohitm05/onlineexam/blob/master/user-login.php"
    click userRegister "https://github.com/rohitm05/onlineexam/blob/master/user-register.php"
    click adminLogin "https://github.com/rohitm05/onlineexam/blob/master/admin-login.php"
    click logoutPage "https://github.com/rohitm05/onlineexam/blob/master/logout.php"
    click userMgmtPage "https://github.com/rohitm05/onlineexam/blob/master/usermanagement.php"
    click postMgmtPage "https://github.com/rohitm05/onlineexam/blob/master/postmanagement.php"
    click questionMgmtPage "https://github.com/rohitm05/onlineexam/blob/master/questionmanagement.php"
    click categoryPage "https://github.com/rohitm05/onlineexam/blob/master/category.php"
    click helpPage "https://github.com/rohitm05/onlineexam/blob/master/help.php"
    click thanksPage "https://github.com/rohitm05/onlineexam/blob/master/thanks.php"
    click viewPaperPage "https://github.com/rohitm05/onlineexam/blob/master/viewpaper.php"
    click samplePage "https://github.com/rohitm05/onlineexam/blob/master/sample.html"

    %% Click Events Static Assets
    click cssSA "https://github.com/rohitm05/onlineexam/blob/master/css/sb-admin.css"
    click mystyle "https://github.com/rohitm05/onlineexam/blob/master/mystyle.css"
    click jsSA "https://github.com/rohitm05/onlineexam/blob/master/js/sb-admin.js"
    click validation "https://github.com/rohitm05/onlineexam/blob/master/jqueryvalidation.js"
    click additionalMethods "https://github.com/rohitm05/onlineexam/blob/master/additional-methods.js"
    click chartArea "https://github.com/rohitm05/onlineexam/blob/master/js/demo/chart-area-demo.js"
    click chartBar "https://github.com/rohitm05/onlineexam/blob/master/js/demo/chart-bar-demo.js"
    click chartPie "https://github.com/rohitm05/onlineexam/blob/master/js/demo/chart-pie-demo.js"
    click datatablesDemo "https://github.com/rohitm05/onlineexam/blob/master/js/demo/datatables-demo.js"

    %% Click Events Application
    click loginBackend "https://github.com/rohitm05/onlineexam/blob/master/loginbackend.php"
    click userLoginBackend "https://github.com/rohitm05/onlineexam/blob/master/user-login-backend.php"
    click userRegisterBackend "https://github.com/rohitm05/onlineexam/blob/master/user-register-backend.php"
    click logoutLogic "https://github.com/rohitm05/onlineexam/blob/master/logout.php"
    click addCategory "https://github.com/rohitm05/onlineexam/blob/master/add-category.php"
    click addCategoryBE "https://github.com/rohitm05/onlineexam/blob/master/add-category-backend.php"
    click editCategory "https://github.com/rohitm05/onlineexam/blob/master/edit-category.php"
    click updateCategory "https://github.com/rohitm05/onlineexam/blob/master/update-category.php"
    click deleteCategory "https://github.com/rohitm05/onlineexam/blob/master/delete-category.php"
    click addPost "https://github.com/rohitm05/onlineexam/blob/master/add-post.php"
    click addPostBE "https://github.com/rohitm05/onlineexam/blob/master/add-post-backend.php"
    click deletePost "https://github.com/rohitm05/onlineexam/blob/master/delete-post.php"
    click addQuestion "https://github.com/rohitm05/onlineexam/blob/master/add-question.php"
    click addQuestionBE "https://github.com/rohitm05/onlineexam/blob/master/add-question-backend.php"
    click editQuestion "https://github.com/rohitm05/onlineexam/blob/master/edit-question.php"
    click updateQuestion "https://github.com/rohitm05/onlineexam/blob/master/update-question.php"
    click deleteQuestion "https://github.com/rohitm05/onlineexam/blob/master/delete-question.php"
    click selection "https://github.com/rohitm05/onlineexam/blob/master/selection.php"
    click startQuiz "https://github.com/rohitm05/onlineexam/blob/master/quiz.php"
    click processQuiz "https://github.com/rohitm05/onlineexam/blob/master/quiz-calculate.php"
    click activeUser "https://github.com/rohitm05/onlineexam/blob/master/active-user.php"
    click unactiveUser "https://github.com/rohitm05/onlineexam/blob/master/unactive-user.php"
    click deleteUser "https://github.com/rohitm05/onlineexam/blob/master/delete-user.php"
    click mail "https://github.com/rohitm05/onlineexam/blob/master/mail.php"
    click mail1 "https://github.com/rohitm05/onlineexam/blob/master/mail1.php"
    click con "https://github.com/rohitm05/onlineexam/blob/master/con.php"
    click headerAdmin "https://github.com/rohitm05/onlineexam/blob/master/header-admin.php"
    click footerAdmin "https://github.com/rohitm05/onlineexam/blob/master/footer-admin.php"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#1B6FAA,color:#000
    classDef application fill:#DFF5D0,stroke:#3A8F1A,color:#000
    classDef data fill:#FFD8A8,stroke:#D26900,color:#000
    classDef external fill:#E0E0E0,stroke:#888888,color:#000
```
