# mrnope25/phishguard architecture

> Architecture diagram of the GitHub repository mrnope25/phishguard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mrnope25/phishguard
- Repository: https://github.com/mrnope25/phishguard

## Overview

PhishGuard is a PHP/MySQL anti-phishing application with account security and link/message scanning. The main user journey is registration, email verification, login with CAPTCHA and OTP, then scanning links or message screenshots and reviewing saved results. Separate branches provide password recovery, profile management, user dashboards, and a read-only admin dashboard. The shared bootstrap loads security, persistence, scanning, and presentation services. Some route implementations were not sampled, so links between those features are included only where the README or source index supports them.

Main entry points: [`web/php/bootstrap.php`](https://github.com/mrnope25/phishguard/blob/main/web/php/bootstrap.php) (Application bootstrap), [`web/login.php`](https://github.com/mrnope25/phishguard/blob/main/web/login.php) (Login), [`web/php/scanner.php`](https://github.com/mrnope25/phishguard/blob/main/web/php/scanner.php) (Heuristic analysis), [`web/register.php`](https://github.com/mrnope25/phishguard/blob/main/web/register.php) (Registration wizard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry points"]
  node_home["Home and routing<br/>[index.php]"]
end

subgraph group_identity["Identity and security"]
  node_register["Registration wizard<br/>[register.php]"]
  node_register_submit["Registration submit"]
  node_login["Login<br/>[login.php]"]
  node_otp["OTP verification<br/>[otp.php]"]
  node_forgot["Password recovery<br/>[forgot.php]"]
  node_security["Access protection<br/>[security.php]"]
  node_otp_service["OTP service<br/>[otp_service.php]"]
  node_validation["Server validation<br/>[validation.php]"]
end

subgraph group_scanning["Threat scanning"]
  node_link_scan["Link scanner<br/>[link_scanner.php]"]
  node_image_scan["Image scanner<br/>[image_scanner.php]"]
  node_scanner["Heuristic analysis<br/>[scanner.php]"]
end

subgraph group_account["Account and reporting"]
  node_history["Scan history<br/>[scan_history.php]"]
  node_dashboard["User dashboard<br/>[dashboard.php]"]
  node_profile["User profile<br/>[profile.php]"]
  node_admin["Admin dashboard<br/>[admin.php]"]
end

subgraph group_shared["Shared services"]
  node_bootstrap["Application bootstrap<br/>[bootstrap.php]"]
  node_db[("MySQL persistence<br/>[db.php]")]
  node_activity["Activity log<br/>[activity_log.php]"]
  node_mailer["Email delivery<br/>[mailer.php]"]
  node_admin_queries["Admin queries<br/>[admin_queries.php]"]
end

node_user(("Visitor or user"))

node_user -->|"opens app"| node_home
node_home -->|"offers signup"| node_register
node_register -->|"submits details"| node_register_submit
node_register_submit -.->|"validates input"| node_validation
node_user -->|"signs in"| node_login
node_login -->|"requests verification"| node_otp
node_otp -.->|"creates session"| node_security
node_login -.->|"checks access"| node_security
node_otp -.->|"verifies code"| node_otp_service
node_user -->|"requests reset"| node_forgot
node_user -->|"submits link"| node_link_scan
node_user -->|"submits screenshot"| node_image_scan
node_link_scan -.->|"analyzes link"| node_scanner
node_image_scan -.->|"analyzes message"| node_scanner
node_user -->|"reviews scans"| node_history
node_history -->|"reads scan records"| node_scanner
node_user -.->|"views dashboard"| node_dashboard
node_user -.->|"manages profile"| node_profile
node_user -.->|"opens admin area"| node_admin
node_admin -->|"loads admin data"| node_admin_queries
node_register -->|"loads services"| node_bootstrap
node_login -->|"loads services"| node_bootstrap
node_link_scan -->|"loads services"| node_bootstrap
node_image_scan -->|"loads services"| node_bootstrap
node_history -->|"loads services"| node_bootstrap
node_bootstrap -->|"loads persistence"| node_db
node_bootstrap -->|"loads protection"| node_security
node_bootstrap -->|"loads OTP"| node_otp_service
node_bootstrap -->|"loads analysis"| node_scanner
node_bootstrap -->|"loads logging"| node_activity
node_bootstrap -->|"loads mailer"| node_mailer

click node_home "https://github.com/mrnope25/phishguard/blob/main/web/index.php"
click node_register "https://github.com/mrnope25/phishguard/blob/main/web/register.php"
click node_register_submit "https://github.com/mrnope25/phishguard/blob/main/web/php/register_submit.php"
click node_login "https://github.com/mrnope25/phishguard/blob/main/web/login.php"
click node_otp "https://github.com/mrnope25/phishguard/blob/main/web/otp.php"
click node_forgot "https://github.com/mrnope25/phishguard/blob/main/web/forgot.php"
click node_security "https://github.com/mrnope25/phishguard/blob/main/web/php/security.php"
click node_otp_service "https://github.com/mrnope25/phishguard/blob/main/web/php/otp_service.php"
click node_validation "https://github.com/mrnope25/phishguard/blob/main/web/php/validation.php"
click node_link_scan "https://github.com/mrnope25/phishguard/blob/main/web/link_scanner.php"
click node_image_scan "https://github.com/mrnope25/phishguard/blob/main/web/image_scanner.php"
click node_scanner "https://github.com/mrnope25/phishguard/blob/main/web/php/scanner.php"
click node_history "https://github.com/mrnope25/phishguard/blob/main/web/scan_history.php"
click node_dashboard "https://github.com/mrnope25/phishguard/blob/main/web/dashboard.php"
click node_profile "https://github.com/mrnope25/phishguard/blob/main/web/profile.php"
click node_admin "https://github.com/mrnope25/phishguard/blob/main/web/admin.php"
click node_bootstrap "https://github.com/mrnope25/phishguard/blob/main/web/php/bootstrap.php"
click node_db "https://github.com/mrnope25/phishguard/blob/main/web/php/db.php"
click node_activity "https://github.com/mrnope25/phishguard/blob/main/web/php/activity_log.php"
click node_mailer "https://github.com/mrnope25/phishguard/blob/main/web/php/mailer.php"
click node_admin_queries "https://github.com/mrnope25/phishguard/blob/main/web/php/admin_queries.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_home,node_user toneBlue
class node_register,node_register_submit,node_login,node_otp,node_forgot,node_security,node_otp_service,node_validation toneAmber
class node_link_scan,node_image_scan,node_scanner toneMint
class node_history,node_dashboard,node_profile,node_admin toneRose
class node_bootstrap,node_db,node_activity,node_mailer,node_admin_queries toneIndigo
```

## Components

### Web entry points

- [Home and routing](https://github.com/mrnope25/phishguard/blob/main/web/index.php): `web/index.php`

### Identity and security

- [Registration wizard](https://github.com/mrnope25/phishguard/blob/main/web/register.php): `web/register.php`
- [Registration submit](https://github.com/mrnope25/phishguard/blob/main/web/php/register_submit.php): `web/php/register_submit.php`
- [Login](https://github.com/mrnope25/phishguard/blob/main/web/login.php): `web/login.php`
- [OTP verification](https://github.com/mrnope25/phishguard/blob/main/web/otp.php): `web/otp.php`
- [Password recovery](https://github.com/mrnope25/phishguard/blob/main/web/forgot.php): `web/forgot.php`
- [Access protection](https://github.com/mrnope25/phishguard/blob/main/web/php/security.php): `web/php/security.php`
- [OTP service](https://github.com/mrnope25/phishguard/blob/main/web/php/otp_service.php): `web/php/otp_service.php`
- [Server validation](https://github.com/mrnope25/phishguard/blob/main/web/php/validation.php): `web/php/validation.php`

### Threat scanning

- [Link scanner](https://github.com/mrnope25/phishguard/blob/main/web/link_scanner.php): `web/link_scanner.php`
- [Image scanner](https://github.com/mrnope25/phishguard/blob/main/web/image_scanner.php): `web/image_scanner.php`
- [Heuristic analysis](https://github.com/mrnope25/phishguard/blob/main/web/php/scanner.php): `web/php/scanner.php`

### Account and reporting

- [Scan history](https://github.com/mrnope25/phishguard/blob/main/web/scan_history.php): `web/scan_history.php`
- [User dashboard](https://github.com/mrnope25/phishguard/blob/main/web/dashboard.php): `web/dashboard.php`
- [User profile](https://github.com/mrnope25/phishguard/blob/main/web/profile.php): `web/profile.php`
- [Admin dashboard](https://github.com/mrnope25/phishguard/blob/main/web/admin.php): `web/admin.php`

### Shared services

- [Application bootstrap](https://github.com/mrnope25/phishguard/blob/main/web/php/bootstrap.php): `web/php/bootstrap.php`
- [MySQL persistence](https://github.com/mrnope25/phishguard/blob/main/web/php/db.php): `web/php/db.php`
- [Activity log](https://github.com/mrnope25/phishguard/blob/main/web/php/activity_log.php): `web/php/activity_log.php`
- [Email delivery](https://github.com/mrnope25/phishguard/blob/main/web/php/mailer.php): `web/php/mailer.php`
- [Admin queries](https://github.com/mrnope25/phishguard/blob/main/web/php/admin_queries.php): `web/php/admin_queries.php`

### Other components

- **Visitor or user**

## Connections

- Visitor or user → Home and routing: opens app (evidence: `web/index.php`)
- Home and routing → Registration wizard: offers signup (evidence: `web/index.php`)
- Registration wizard → Registration submit: submits details (evidence: `web/register.php`)
- Registration submit → Server validation: validates input
- Visitor or user → Login: signs in (evidence: `README.md`)
- Login → OTP verification: requests verification (evidence: `README.md`)
- OTP verification → Access protection: creates session
- Login → Access protection: checks access
- OTP verification → OTP service: verifies code
- Visitor or user → Password recovery: requests reset (evidence: `README.md`)
- Visitor or user → Link scanner: submits link
- Visitor or user → Image scanner: submits screenshot
- Link scanner → Heuristic analysis: analyzes link
- Image scanner → Heuristic analysis: analyzes message
- Visitor or user → Scan history: reviews scans (evidence: `web/scan_history.php`)
- Scan history → Heuristic analysis: reads scan records (evidence: `web/scan_history.php`)
- Visitor or user → User dashboard: views dashboard
- Visitor or user → User profile: manages profile
- Visitor or user → Admin dashboard: opens admin area
- Admin dashboard → Admin queries: loads admin data (evidence: `web/admin.php`)
- Registration wizard → Application bootstrap: loads services (evidence: `web/register.php`)
- Login → Application bootstrap: loads services (evidence: `web/login.php`)
- Link scanner → Application bootstrap: loads services (evidence: `web/link_scanner.php`)
- Image scanner → Application bootstrap: loads services (evidence: `web/image_scanner.php`)
- Scan history → Application bootstrap: loads services (evidence: `web/scan_history.php`)
- Application bootstrap → MySQL persistence: loads persistence (evidence: `web/php/bootstrap.php`)
- Application bootstrap → Access protection: loads protection (evidence: `web/php/bootstrap.php`)
- Application bootstrap → OTP service: loads OTP (evidence: `web/php/bootstrap.php`)
- Application bootstrap → Heuristic analysis: loads analysis (evidence: `web/php/bootstrap.php`)
- Application bootstrap → Activity log: loads logging (evidence: `web/php/bootstrap.php`)
- Application bootstrap → Email delivery: loads mailer (evidence: `web/php/bootstrap.php`)
