# stephen-mumba/data-leakage-detection-project architecture

> Architecture diagram of the GitHub repository stephen-mumba/data-leakage-detection-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stephen-mumba/data-leakage-detection-project
- Repository: https://github.com/stephen-mumba/data-leakage-detection-project

## Overview

This PHP application lets users register and sign in, exchange PDF files using per-file secret keys, and review files sent or received. Downloads track failed key attempts and can record suspected leaks; administrators manage users and inspect leak reports. The diagram follows the sampled PHP pages and the SOURCE INDEX. Several capabilities are represented by named view files whose full implementation was not sampled, so their internal behavior and some links are intentionally omitted.

Main entry points: [`server/connect.php`](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/server/connect.php) (Database setup), [`views/dashboard.php`](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/dashboard.php) (Dashboard), [`views/download.php`](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/download.php) (Keyed download), [`index.php`](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/index.php) (Home page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and access"]
  node_home["Home page<br/>[index.php]"]
  node_login["Login<br/>[login.php]"]
  node_dashboard["Dashboard<br/>[dashboard.php]"]
end

subgraph group_exchange["File exchange"]
  node_send["Send file"]
  node_sent["Sent files"]
  node_received["Received files"]
  node_keyrequest["Key requests"]
  node_askkey["Request key<br/>[ask_for_key.php]"]
  node_download["Keyed download<br/>[download.php]"]
  node_watermark["PDF watermark download"]
end

subgraph group_monitor["Leak monitoring"]
  node_leakers["Leaker reports"]
  node_leakalerts["Leak alerts<br/>[dashboard.php]"]
  node_attempts["Attempt tracking<br/>[library.php]"]
end

subgraph group_accounts["Accounts and administration"]
  node_register["Registration<br/>[register.php]"]
  node_profile["Profile management<br/>[profile.php]"]
  node_userprofile["User profile view<br/>[user_profile.php]"]
  node_useradmin["User administration<br/>[users.php]"]
end

subgraph group_storage["Persistence and files"]
  node_dbconnect["Database setup<br/>[connect.php]"]
  node_schema["Table definitions<br/>[query.php]"]
  node_database[("MySQL database")]
  node_filevault[("Uploaded PDFs")]
end

node_visitor(("Visitor / user"))

node_visitor -->|"opens"| node_home
node_visitor -->|"signs in"| node_login
node_visitor -->|"registers"| node_register
node_home -->|"initializes"| node_dbconnect
node_home -.->|"opens"| node_dashboard
node_dashboard -->|"links to"| node_send
node_dashboard -->|"links to"| node_keyrequest
node_dashboard -->|"links to"| node_sent
node_dashboard -->|"links to"| node_received
node_dashboard -->|"links to"| node_userprofile
node_dashboard -->|"admin link"| node_useradmin
node_dashboard -->|"admin link"| node_leakers
node_send -->|"writes metadata"| node_dbconnect
node_send -->|"stores upload"| node_filevault
node_sent -->|"queries files"| node_dbconnect
node_received -->|"queries files"| node_dbconnect
node_keyrequest -.->|"request flow"| node_askkey
node_keyrequest -->|"queries requests"| node_dbconnect
node_askkey -->|"queries data"| node_dbconnect
node_download -->|"checks attempts"| node_attempts
node_download -->|"validates key"| node_dbconnect
node_download -->|"reads file"| node_filevault
node_download -->|"redirects PDF"| node_watermark
node_attempts -->|"updates records"| node_dbconnect
node_download -->|"records suspected leak"| node_leakers
node_download -->|"records failed attempts"| node_leakalerts
node_leakalerts -->|"reads alerts"| node_dbconnect
node_leakalerts -->|"formats file details"| node_attempts
node_profile -->|"updates profile"| node_dbconnect
node_userprofile -->|"queries user"| node_dbconnect
node_useradmin -->|"queries users"| node_dbconnect
node_leakers -->|"queries reports"| node_dbconnect
node_dbconnect -->|"loads definitions"| node_schema
node_dbconnect -->|"creates tables"| node_database

click node_home "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/index.php"
click node_login "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/login.php"
click node_register "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/register.php"
click node_dashboard "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/dashboard.php"
click node_send "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/send_files_to_users.php"
click node_sent "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/list_of_files_send_by_me.php"
click node_received "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/list_of_files_send_by_other_users.php"
click node_keyrequest "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/list_of_key_requests.php"
click node_askkey "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/ask_for_key.php"
click node_download "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/download.php"
click node_watermark "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/download_with_watermark.php"
click node_profile "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/profile.php"
click node_userprofile "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/user_profile.php"
click node_useradmin "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/users.php"
click node_leakers "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/leaker_user_list.php"
click node_leakalerts "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/dashboard.php"
click node_attempts "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/library.php"
click node_dbconnect "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/server/connect.php"
click node_schema "https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/server/query.php"
click node_filevault "https://github.com/stephen-mumba/data-leakage-detection-project/tree/main/assets/files"

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_login,node_dashboard,node_visitor toneBlue
class node_send,node_sent,node_received,node_keyrequest,node_askkey,node_download,node_watermark toneAmber
class node_leakers,node_leakalerts,node_attempts toneMint
class node_register,node_profile,node_userprofile,node_useradmin toneRose
class node_dbconnect,node_schema,node_database,node_filevault toneIndigo
```

## Components

### Entry and access

- [Home page](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/index.php): `index.php`
- [Login](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/login.php): `views/login.php`
- [Dashboard](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/dashboard.php): `views/dashboard.php`

### File exchange

- [Send file](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/send_files_to_users.php): `views/send_files_to_users.php`
- [Sent files](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/list_of_files_send_by_me.php): `views/list_of_files_send_by_me.php`
- [Received files](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/list_of_files_send_by_other_users.php): `views/list_of_files_send_by_other_users.php`
- [Key requests](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/list_of_key_requests.php): `views/list_of_key_requests.php`
- [Request key](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/ask_for_key.php): `views/ask_for_key.php`
- [Keyed download](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/download.php): `views/download.php`
- [PDF watermark download](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/download_with_watermark.php): `download_with_watermark.php`

### Leak monitoring

- [Leaker reports](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/leaker_user_list.php): `views/leaker_user_list.php`
- [Leak alerts](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/dashboard.php): `views/dashboard.php`
- [Attempt tracking](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/library.php): `views/library.php`

### Accounts and administration

- [Registration](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/register.php): `views/register.php`
- [Profile management](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/profile.php): `views/profile.php`
- [User profile view](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/user_profile.php): `views/user_profile.php`
- [User administration](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/views/users.php): `views/users.php`

### Persistence and files

- [Database setup](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/server/connect.php): `server/connect.php`
- [Table definitions](https://github.com/stephen-mumba/data-leakage-detection-project/blob/main/server/query.php): `server/query.php`
- **MySQL database**
- [Uploaded PDFs](https://github.com/stephen-mumba/data-leakage-detection-project/tree/main/assets/files): `assets/files`

### Other components

- **Visitor / user**

## Connections

- Visitor / user → Home page: opens (evidence: `index.php`)
- Visitor / user → Login: signs in (evidence: `views/login.php`)
- Visitor / user → Registration: registers (evidence: `views/register.php`)
- Home page → Database setup: initializes (evidence: `index.php`)
- Home page → Dashboard: opens
- Dashboard → Send file: links to (evidence: `views/dashboard.php`)
- Dashboard → Key requests: links to (evidence: `views/dashboard.php`)
- Dashboard → Sent files: links to (evidence: `views/dashboard.php`)
- Dashboard → Received files: links to (evidence: `views/dashboard.php`)
- Dashboard → User profile view: links to (evidence: `views/dashboard.php`)
- Dashboard → User administration: admin link (evidence: `views/dashboard.php`)
- Dashboard → Leaker reports: admin link (evidence: `views/dashboard.php`)
- Send file → Database setup: writes metadata (evidence: `views/send_files_to_users.php`)
- Send file → Uploaded PDFs: stores upload (evidence: `views/send_files_to_users.php`)
- Sent files → Database setup: queries files (evidence: `views/list_of_files_send_by_me.php`)
- Received files → Database setup: queries files (evidence: `views/list_of_files_send_by_other_users.php`)
- Key requests → Request key: request flow
- Key requests → Database setup: queries requests (evidence: `views/list_of_key_requests.php`)
- Request key → Database setup: queries data (evidence: `views/ask_for_key.php`)
- Keyed download → Attempt tracking: checks attempts (evidence: `views/download.php`)
- Keyed download → Database setup: validates key (evidence: `views/download.php`)
- Keyed download → Uploaded PDFs: reads file (evidence: `views/download.php`)
- Keyed download → PDF watermark download: redirects PDF (evidence: `views/download.php`)
- Attempt tracking → Database setup: updates records (evidence: `views/library.php`)
- Keyed download → Leaker reports: records suspected leak (evidence: `views/download.php`)
- Keyed download → Leak alerts: records failed attempts (evidence: `views/download.php`)
- Leak alerts → Database setup: reads alerts (evidence: `views/dashboard.php`)
- Leak alerts → Attempt tracking: formats file details (evidence: `views/dashboard.php`)
- Profile management → Database setup: updates profile (evidence: `views/profile.php`)
- User profile view → Database setup: queries user (evidence: `views/user_profile.php`)
- User administration → Database setup: queries users (evidence: `views/users.php`)
- Leaker reports → Database setup: queries reports (evidence: `views/leaker_user_list.php`)
- Database setup → Table definitions: loads definitions (evidence: `server/connect.php`)
- Database setup → MySQL database: creates tables (evidence: `server/connect.php`)
