# az101708/hotel2 architecture

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

- Interactive diagram: https://gitdiagram.com/az101708/hotel2
- Repository: https://github.com/az101708/hotel2

## Overview

This is a PHP hotel-reservation application: visitors browse room types and prices, register or log in, then customers submit time-bounded bookings that are assigned an available room and left Pending moderator approval. Moderators review and change reservation status or details and update prices; customers can view room status and their reservations. The PHP pages use shared session, authentication, and database helpers in config.php. Relationships below follow shown includes, SQL, forms, and redirects; database.sql is present in the tree but its schema was not sampled.

Main entry points: [`admin.php`](https://github.com/az101708/hotel2/blob/main/admin.php) (Moderator dashboard), [`config.php`](https://github.com/az101708/hotel2/blob/main/config.php) (Session and access helpers), [`database.sql`](https://github.com/az101708/hotel2/blob/main/database.sql) (Hotel database), [`login.php`](https://github.com/az101708/hotel2/blob/main/login.php) (Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public access"]
  node_catalog["Room catalog<br/>[index.php]"]
end

subgraph group_identity["Accounts and sessions"]
  node_registration["Account registration<br/>[register.php]"]
  node_login["Login<br/>[login.php]"]
  node_logout["Logout<br/>[logout.php]"]
end

subgraph group_customer["Customer reservations"]
  node_customer_dashboard["Customer dashboard<br/>[customer.php]"]
  node_booking["Booking submission<br/>[book.php]"]
end

subgraph group_moderation["Moderator operations"]
  node_moderator_dashboard["Moderator dashboard<br/>[admin.php]"]
  node_reservation_edit["Edit reservation"]
  node_reservation_status["Update reservation status"]
  node_price_update["Update room prices<br/>[update_price.php]"]
end

subgraph group_state["Shared state"]
  node_shared_helpers["Session and access helpers<br/>[config.php]"]
  node_hotel_database[("Hotel database<br/>[database.sql]")]
end

node_visitor(("Visitor"))
node_customer_user(("Customer"))
node_moderator_user(("Moderator"))

node_visitor -.->|"browses"| node_catalog
node_catalog -->|"loads"| node_shared_helpers
node_catalog -->|"reads prices and rooms"| node_hotel_database
node_catalog -->|"links to"| node_registration
node_catalog -->|"links to"| node_login
node_customer_user -.->|"creates account"| node_registration
node_registration -->|"loads"| node_shared_helpers
node_registration -->|"writes user"| node_hotel_database
node_registration -->|"redirects to"| node_login
node_customer_user -.->|"signs in"| node_login
node_moderator_user -.->|"signs in"| node_login
node_login -->|"loads"| node_shared_helpers
node_login -->|"reads user"| node_hotel_database
node_login -->|"routes customer"| node_customer_dashboard
node_login -->|"routes moderator"| node_moderator_dashboard
node_customer_dashboard -->|"loads"| node_shared_helpers
node_customer_dashboard -->|"reads prices, rooms, bookings"| node_hotel_database
node_customer_dashboard -->|"posts booking"| node_booking
node_customer_dashboard -->|"links to"| node_logout
node_booking -->|"loads"| node_shared_helpers
node_booking -->|"checks availability and writes booking"| node_hotel_database
node_booking -->|"redirects to"| node_customer_dashboard
node_moderator_dashboard -->|"loads"| node_shared_helpers
node_moderator_dashboard -->|"reads reservations, prices, rooms"| node_hotel_database
node_moderator_dashboard -->|"posts status"| node_reservation_status
node_moderator_dashboard -->|"links to edit"| node_reservation_edit
node_moderator_dashboard -->|"posts prices"| node_price_update
node_moderator_dashboard -->|"links to"| node_logout
node_reservation_edit -->|"loads"| node_shared_helpers
node_reservation_edit -->|"checks and updates booking"| node_hotel_database
node_reservation_edit -->|"redirects to"| node_moderator_dashboard
node_reservation_status -->|"loads"| node_shared_helpers
node_reservation_status -->|"updates status"| node_hotel_database
node_reservation_status -->|"redirects to"| node_moderator_dashboard
node_price_update -->|"loads"| node_shared_helpers
node_price_update -->|"updates prices"| node_hotel_database
node_price_update -->|"redirects to"| node_moderator_dashboard
node_logout -->|"loads"| node_shared_helpers
node_logout -->|"redirects to"| node_catalog
node_shared_helpers -->|"connects to"| node_hotel_database

click node_catalog "https://github.com/az101708/hotel2/blob/main/index.php"
click node_registration "https://github.com/az101708/hotel2/blob/main/register.php"
click node_login "https://github.com/az101708/hotel2/blob/main/login.php"
click node_logout "https://github.com/az101708/hotel2/blob/main/logout.php"
click node_customer_dashboard "https://github.com/az101708/hotel2/blob/main/customer.php"
click node_booking "https://github.com/az101708/hotel2/blob/main/book.php"
click node_moderator_dashboard "https://github.com/az101708/hotel2/blob/main/admin.php"
click node_reservation_edit "https://github.com/az101708/hotel2/blob/main/edit_reservation.php"
click node_reservation_status "https://github.com/az101708/hotel2/blob/main/manage_reservation.php"
click node_price_update "https://github.com/az101708/hotel2/blob/main/update_price.php"
click node_shared_helpers "https://github.com/az101708/hotel2/blob/main/config.php"
click node_hotel_database "https://github.com/az101708/hotel2/blob/main/database.sql"

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_catalog toneBlue
class node_registration,node_login,node_logout toneAmber
class node_customer_dashboard,node_booking toneMint
class node_moderator_dashboard,node_reservation_edit,node_reservation_status,node_price_update toneRose
class node_shared_helpers,node_hotel_database,node_visitor,node_customer_user,node_moderator_user toneIndigo
```

## Components

### Public access

- [Room catalog](https://github.com/az101708/hotel2/blob/main/index.php): `index.php`

### Accounts and sessions

- [Account registration](https://github.com/az101708/hotel2/blob/main/register.php): `register.php`
- [Login](https://github.com/az101708/hotel2/blob/main/login.php): `login.php`
- [Logout](https://github.com/az101708/hotel2/blob/main/logout.php): `logout.php`

### Customer reservations

- [Customer dashboard](https://github.com/az101708/hotel2/blob/main/customer.php): `customer.php`
- [Booking submission](https://github.com/az101708/hotel2/blob/main/book.php): `book.php`

### Moderator operations

- [Moderator dashboard](https://github.com/az101708/hotel2/blob/main/admin.php): `admin.php`
- [Edit reservation](https://github.com/az101708/hotel2/blob/main/edit_reservation.php): `edit_reservation.php`
- [Update reservation status](https://github.com/az101708/hotel2/blob/main/manage_reservation.php): `manage_reservation.php`
- [Update room prices](https://github.com/az101708/hotel2/blob/main/update_price.php): `update_price.php`

### Shared state

- [Session and access helpers](https://github.com/az101708/hotel2/blob/main/config.php): `config.php`
- [Hotel database](https://github.com/az101708/hotel2/blob/main/database.sql): `database.sql`

### Other components

- **Visitor**
- **Customer**
- **Moderator**

## Connections

- Visitor → Room catalog: browses
- Room catalog → Session and access helpers: loads (evidence: `index.php`)
- Room catalog → Hotel database: reads prices and rooms (evidence: `index.php`)
- Room catalog → Account registration: links to (evidence: `index.php`)
- Room catalog → Login: links to (evidence: `index.php`)
- Customer → Account registration: creates account
- Account registration → Session and access helpers: loads (evidence: `register.php`)
- Account registration → Hotel database: writes user (evidence: `register.php`)
- Account registration → Login: redirects to (evidence: `register.php`)
- Customer → Login: signs in
- Moderator → Login: signs in
- Login → Session and access helpers: loads (evidence: `login.php`)
- Login → Hotel database: reads user (evidence: `login.php`)
- Login → Customer dashboard: routes customer (evidence: `login.php`)
- Login → Moderator dashboard: routes moderator (evidence: `login.php`)
- Customer dashboard → Session and access helpers: loads (evidence: `customer.php`)
- Customer dashboard → Hotel database: reads prices, rooms, bookings (evidence: `customer.php`)
- Customer dashboard → Booking submission: posts booking (evidence: `customer.php`)
- Customer dashboard → Logout: links to (evidence: `customer.php`)
- Booking submission → Session and access helpers: loads (evidence: `book.php`)
- Booking submission → Hotel database: checks availability and writes booking (evidence: `book.php`)
- Booking submission → Customer dashboard: redirects to (evidence: `book.php`)
- Moderator dashboard → Session and access helpers: loads (evidence: `admin.php`)
- Moderator dashboard → Hotel database: reads reservations, prices, rooms (evidence: `admin.php`)
- Moderator dashboard → Update reservation status: posts status (evidence: `admin.php`)
- Moderator dashboard → Edit reservation: links to edit (evidence: `admin.php`)
- Moderator dashboard → Update room prices: posts prices (evidence: `admin.php`)
- Moderator dashboard → Logout: links to (evidence: `admin.php`)
- Edit reservation → Session and access helpers: loads (evidence: `edit_reservation.php`)
- Edit reservation → Hotel database: checks and updates booking (evidence: `edit_reservation.php`)
- Edit reservation → Moderator dashboard: redirects to (evidence: `edit_reservation.php`)
- Update reservation status → Session and access helpers: loads (evidence: `manage_reservation.php`)
- Update reservation status → Hotel database: updates status (evidence: `manage_reservation.php`)
- Update reservation status → Moderator dashboard: redirects to (evidence: `manage_reservation.php`)
- Update room prices → Session and access helpers: loads (evidence: `update_price.php`)
- Update room prices → Hotel database: updates prices (evidence: `update_price.php`)
- Update room prices → Moderator dashboard: redirects to (evidence: `update_price.php`)
- Logout → Session and access helpers: loads (evidence: `logout.php`)
- Logout → Room catalog: redirects to (evidence: `logout.php`)
- Session and access helpers → Hotel database: connects to (evidence: `config.php`)
