# malpongsu/socom_dtr architecture

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

- Interactive diagram: https://gitdiagram.com/malpongsu/socom_dtr
- Repository: https://github.com/malpongsu/socom_dtr

## Overview

SOCOM Daily Time Record is a PHP attendance system for RFID tap-in/tap-out, public user lookup, and administrator-managed users and reports. The primary workflow is a kiosk scan submitted to the scan handler, which resolves the registered user and records attendance; the home page then displays recent records. Admin workflows cover account access, user registration and maintenance, dashboard summaries, and monthly reporting/export. The sampled files show these calls and database operations; several admin pages are indexed but not excerpted, so their internal behavior is represented only where documented or indexed.

Main entry points: [`index.php`](https://github.com/malpongsu/socom_dtr/blob/main/index.php) (Kiosk and recent view), [`masterlist.php`](https://github.com/malpongsu/socom_dtr/blob/main/masterlist.php) (Public masterlist), [`includes/auth.php`](https://github.com/malpongsu/socom_dtr/blob/main/includes/auth.php) (Session authorization), [`config/db.php`](https://github.com/malpongsu/socom_dtr/blob/main/config/db.php) (PDO connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_attendance["Attendance"]
  node_kiosk["Kiosk and recent view<br/>[index.php]"]
  node_scan["Tap processing<br/>[rfid_scan.php]"]
  node_masterlist["Public masterlist<br/>[masterlist.php]"]
end

subgraph group_admin["Administration"]
  node_login["Admin login<br/>[login.php]"]
  node_bootstrap["Admin registration<br/>[register_admin.php]"]
  node_dashboard["Admin dashboard<br/>[dashboard.php]"]
  node_register_user["Register RFID user<br/>[register_user.php]"]
  node_users["User management<br/>[users.php]"]
  node_edit_user["Edit user<br/>[edit_user.php]"]
  node_delete_user["Delete user<br/>[delete_user.php]"]
  node_logout["Admin logout<br/>[logout.php]"]
end

subgraph group_reporting["Reporting"]
  node_monthly["Monthly report<br/>[reports.php]"]
  node_export["Report export<br/>[export_report.php]"]
end

subgraph group_foundation["Shared foundation"]
  node_auth["Session authorization<br/>[auth.php]"]
  node_functions["Session and form helpers<br/>[functions.php]"]
  node_database_config["PDO connection<br/>[db.php]"]
  node_store[("Attendance database")]
  node_header["Shared page header<br/>[header.php]"]
  node_footer["Shared page footer<br/>[footer.php]"]
end

node_reader(("RFID reader"))
node_admin_actor(("Administrator"))

node_reader -->|"types tag"| node_kiosk
node_kiosk -->|"posts scan"| node_scan
node_scan -->|"reads and writes"| node_store
node_kiosk -->|"reads attendance"| node_store
node_masterlist -->|"reads users"| node_store
node_admin_actor -->|"authenticates"| node_login
node_admin_actor -->|"creates first account"| node_bootstrap
node_admin_actor -->|"manages records"| node_dashboard
node_login -->|"checks credentials"| node_store
node_bootstrap -->|"creates admin"| node_store
node_register_user -->|"creates user"| node_store
node_users -->|"reads users"| node_store
node_edit_user -->|"updates user"| node_store
node_delete_user -->|"deletes user"| node_store
node_dashboard -->|"reads totals"| node_store
node_monthly -->|"reads attendance"| node_store
node_monthly -->|"links export"| node_export
node_export -->|"reads report data"| node_store
node_auth -->|"uses session helpers"| node_functions
node_kiosk -->|"loads connection"| node_database_config
node_scan -->|"loads connection"| node_database_config
node_masterlist -->|"loads connection"| node_database_config
node_register_user -->|"checks session"| node_auth
node_edit_user -->|"checks session"| node_auth
node_monthly -->|"checks session"| node_auth
node_kiosk -->|"renders"| node_header
node_kiosk -->|"renders"| node_footer
node_masterlist -->|"renders"| node_header
node_masterlist -->|"renders"| node_footer
node_database_config -->|"connects PDO"| node_store

click node_kiosk "https://github.com/malpongsu/socom_dtr/blob/main/index.php"
click node_scan "https://github.com/malpongsu/socom_dtr/blob/main/rfid_scan.php"
click node_masterlist "https://github.com/malpongsu/socom_dtr/blob/main/masterlist.php"
click node_login "https://github.com/malpongsu/socom_dtr/blob/main/admin/login.php"
click node_bootstrap "https://github.com/malpongsu/socom_dtr/blob/main/admin/register_admin.php"
click node_dashboard "https://github.com/malpongsu/socom_dtr/blob/main/admin/dashboard.php"
click node_register_user "https://github.com/malpongsu/socom_dtr/blob/main/admin/register_user.php"
click node_users "https://github.com/malpongsu/socom_dtr/blob/main/admin/users.php"
click node_edit_user "https://github.com/malpongsu/socom_dtr/blob/main/admin/edit_user.php"
click node_delete_user "https://github.com/malpongsu/socom_dtr/blob/main/admin/delete_user.php"
click node_logout "https://github.com/malpongsu/socom_dtr/blob/main/admin/logout.php"
click node_monthly "https://github.com/malpongsu/socom_dtr/blob/main/admin/reports.php"
click node_export "https://github.com/malpongsu/socom_dtr/blob/main/admin/export_report.php"
click node_auth "https://github.com/malpongsu/socom_dtr/blob/main/includes/auth.php"
click node_functions "https://github.com/malpongsu/socom_dtr/blob/main/includes/functions.php"
click node_database_config "https://github.com/malpongsu/socom_dtr/blob/main/config/db.php"
click node_header "https://github.com/malpongsu/socom_dtr/blob/main/includes/header.php"
click node_footer "https://github.com/malpongsu/socom_dtr/blob/main/includes/footer.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_kiosk,node_scan,node_masterlist toneBlue
class node_login,node_bootstrap,node_dashboard,node_register_user,node_users,node_edit_user,node_delete_user,node_logout toneAmber
class node_monthly,node_export toneMint
class node_auth,node_functions,node_database_config,node_store,node_header,node_footer toneRose
class node_reader,node_admin_actor toneIndigo
```

## Components

### Attendance

- [Kiosk and recent view](https://github.com/malpongsu/socom_dtr/blob/main/index.php): `index.php`
- [Tap processing](https://github.com/malpongsu/socom_dtr/blob/main/rfid_scan.php): `rfid_scan.php`
- [Public masterlist](https://github.com/malpongsu/socom_dtr/blob/main/masterlist.php): `masterlist.php`

### Administration

- [Admin login](https://github.com/malpongsu/socom_dtr/blob/main/admin/login.php): `admin/login.php`
- [Admin registration](https://github.com/malpongsu/socom_dtr/blob/main/admin/register_admin.php): `admin/register_admin.php`
- [Admin dashboard](https://github.com/malpongsu/socom_dtr/blob/main/admin/dashboard.php): `admin/dashboard.php`
- [Register RFID user](https://github.com/malpongsu/socom_dtr/blob/main/admin/register_user.php): `admin/register_user.php`
- [User management](https://github.com/malpongsu/socom_dtr/blob/main/admin/users.php): `admin/users.php`
- [Edit user](https://github.com/malpongsu/socom_dtr/blob/main/admin/edit_user.php): `admin/edit_user.php`
- [Delete user](https://github.com/malpongsu/socom_dtr/blob/main/admin/delete_user.php): `admin/delete_user.php`
- [Admin logout](https://github.com/malpongsu/socom_dtr/blob/main/admin/logout.php): `admin/logout.php`

### Reporting

- [Monthly report](https://github.com/malpongsu/socom_dtr/blob/main/admin/reports.php): `admin/reports.php`
- [Report export](https://github.com/malpongsu/socom_dtr/blob/main/admin/export_report.php): `admin/export_report.php`

### Shared foundation

- [Session authorization](https://github.com/malpongsu/socom_dtr/blob/main/includes/auth.php): `includes/auth.php`
- [Session and form helpers](https://github.com/malpongsu/socom_dtr/blob/main/includes/functions.php): `includes/functions.php`
- [PDO connection](https://github.com/malpongsu/socom_dtr/blob/main/config/db.php): `config/db.php`
- **Attendance database**
- [Shared page header](https://github.com/malpongsu/socom_dtr/blob/main/includes/header.php): `includes/header.php`
- [Shared page footer](https://github.com/malpongsu/socom_dtr/blob/main/includes/footer.php): `includes/footer.php`

### Other components

- **RFID reader**
- **Administrator**

## Connections

- RFID reader → Kiosk and recent view: types tag (evidence: `README.md`)
- Kiosk and recent view → Tap processing: posts scan (evidence: `index.php`)
- Tap processing → Attendance database: reads and writes (evidence: `rfid_scan.php`)
- Kiosk and recent view → Attendance database: reads attendance (evidence: `index.php`)
- Public masterlist → Attendance database: reads users (evidence: `masterlist.php`)
- Administrator → Admin login: authenticates (evidence: `README.md`)
- Administrator → Admin registration: creates first account (evidence: `admin/register_admin.php`)
- Administrator → Admin dashboard: manages records (evidence: `README.md`)
- Admin login → Attendance database: checks credentials (evidence: `admin/login.php`)
- Admin registration → Attendance database: creates admin (evidence: `admin/register_admin.php`)
- Register RFID user → Attendance database: creates user (evidence: `admin/register_user.php`)
- User management → Attendance database: reads users (evidence: `admin/users.php`)
- Edit user → Attendance database: updates user (evidence: `admin/edit_user.php`)
- Delete user → Attendance database: deletes user (evidence: `admin/delete_user.php`)
- Admin dashboard → Attendance database: reads totals (evidence: `admin/dashboard.php`)
- Monthly report → Attendance database: reads attendance (evidence: `admin/reports.php`)
- Monthly report → Report export: links export (evidence: `admin/reports.php`)
- Report export → Attendance database: reads report data (evidence: `admin/export_report.php`)
- Session authorization → Session and form helpers: uses session helpers (evidence: `includes/auth.php`)
- Kiosk and recent view → PDO connection: loads connection (evidence: `index.php`)
- Tap processing → PDO connection: loads connection (evidence: `rfid_scan.php`)
- Public masterlist → PDO connection: loads connection (evidence: `masterlist.php`)
- Register RFID user → Session authorization: checks session (evidence: `admin/register_user.php`)
- Edit user → Session authorization: checks session (evidence: `admin/edit_user.php`)
- Monthly report → Session authorization: checks session (evidence: `admin/reports.php`)
- Kiosk and recent view → Shared page header: renders (evidence: `index.php`)
- Kiosk and recent view → Shared page footer: renders (evidence: `index.php`)
- Public masterlist → Shared page header: renders (evidence: `masterlist.php`)
- Public masterlist → Shared page footer: renders (evidence: `masterlist.php`)
- PDO connection → Attendance database: connects PDO (evidence: `config/db.php`)
