How joshdev27/desarrollo_vii_proyecto_hotelweb works
1. Overall shape
- This is a plain PHP/MySQL hotel reservation system with a hand-rolled MVC-style structure, not a full framework app.
- The codebase is split between request handlers, views/templates, reusable UI partials, database scripts, and static assets.
2. Request entry and page flow
- The main public entry point is index.php.
- Requests are then routed into page/controller scripts under src/ and, in some cases, the older app/controller/ layer.
- Rendering is done through views/ and components/, which act as the presentation layer.
3. Application logic layer
- The newer page-oriented logic appears in src/:
- src/user/* for guest/user features
- src/admin/* for admin features
- src/login.php, src/logout.php, src/function.php, src/validaciones.php for cross-cutting auth/helpers/validation
- There is also an older MVC pair in app/controller/ and app/models/ with separate admin_* and user_* classes/files.
- The presence of both suggests an evolving or partially duplicated architecture, with src/ likely the current execution path and app/ a legacy or parallel structure.
4. Domain boundaries: user vs admin
- The system is clearly divided into two main user experiences:
- Guest/user portal: home, registration, login, profile, reservations, password recovery, contact.
- Admin portal: users, rooms, reservations, stats/reporting, email-related operations.
- This split is reflected consistently in:
- src/user/ vs src/admin/
- views/user/ vs views/admin/
- components/user/ vs components/admin/
5. Presentation layer
- views/ contains page-level templates for the main user and admin screens.
- components/ contains reusable partials such as headers, footers, navbars, forms, modals, and email templates.
- Important subgroups:
- components/user/: login, registration, profile, reservation UI
- components/admin/: room/user/reservation management UI
- components/plantillas_correos/: email HTML templates for reservation confirmation, contact, and password recovery
6. Data access and persistence
- Database connectivity lives in database/conection/Database.php.
- The database design is supported by SQL artifacts in:
- database/hotel_tablas/ for table creation
- database/hotel_sps/ for stored procedures
- This indicates a stored-procedure-driven data access pattern, where PHP calls MySQL procedures rather than embedding all SQL directly in the app.
7. Core business operations
- The stored procedures reveal the main system capabilities:
- authentication and registration
- user edit/delete
- room creation/editing
- reservations and cancellation
- reservation confirmation
- password updates and token handling
- contact/consultation registration
- totals/statistics queries
- So the database is not just storage; it also contains a significant part of the business rule execution path.
8. Authentication and session flow
- Login/logout and password recovery are first-class flows.
- The repo includes session-oriented UI and logic such as components/user/sesion.php, src/login.php, and src/logout.php.
- Token-related recovery support is backed by the database procedure for adding user tokens and updating passwords.
9. Reservation and email flow
- A reservation likely flows from the user interface through the user-side handler into the database reservation procedure.
- After booking or confirmation events, the system uses email templates under components/plantillas_correos/ and the corresponding src/user/correo.php / src/admin/correos.php logic to send notifications.
- This makes email a separate integration boundary tied to reservation and recovery events.
10. Static assets and UI dependencies
- Front-end assets are under public/:
- CSS/SCSS sources in public/assets/css
- JavaScript in public/assets/js
- images in public/img
- Third-party UI libraries are vendored directly:
- Font Awesome
- Hamburgers
- These are presentation-only dependencies and do not affect backend flow, but they shape the user/admin interface.
11. Configuration and environment
- config.php and .env indicate environment-based configuration, likely for DB credentials and runtime settings.
- The project also includes Composer metadata (composer.json, composer.lock), so PHP dependencies may be managed externally even though no framework is used.
12. Legacy/backup material
- The backup/ directory contains older controller copies, and there are duplicated concepts across app/, src/, and views/.
- For an architecture diagram, treat these as non-primary or historical artifacts unless verified otherwise.
- The core production structure is best represented as: HTTP entry → PHP handlers/controllers → DB procedures/connection → rendered views/components → browser, with admin and user branches layered on top.
Main entry points: src/user User flows · admin Admin flows · Database.php DB conn · views/user User views
Components 19
Runtime entry
HTTP entry and cross-cutting bootstrap
- index.php · Main public entry that starts request handling
index.php
Application logic
Current request handlers and business flows
- User flows · Guest-facing handlers for home, registration, reservations, contact, and recovery
src/user - Admin flows · Admin handlers for users, rooms, reservations, stats, and mail actions
src/admin - Auth helpers · Cross-cutting login, logout, validation, and utility logic
src/function.php - Login · Authentication entry and session start
src/login.php - Logout · Session termination flow
src/logout.php
Presentation
Page templates and reusable UI partials
- User views · Page templates for the guest and member experience
views/user - Admin views · Page templates for the admin experience
views/admin - Layouts · Shared page shell and error page template
views/layout.php - User parts · Reusable user UI pieces such as forms, profile, session, and reservation widgets
components/user - Admin parts · Reusable admin UI pieces for managing users, rooms, and reservations
components/admin - Mail templates · HTML templates for reservation confirmation, contact, and password recovery emails
components/plantillas_correos
Data layer
Database connection and SQL artifacts
- DB conn · Database connection and access bootstrap
database/conection/Database.php - Tables · Database table creation scripts for users, roles, reservations, rooms, and consultations
database/hotel_tablas - Stored procs · Stored procedures for auth, CRUD, reservations, totals, recovery, and messaging
database/hotel_sps
Legacy MVC
Older controller/model layer that overlaps the newer src flow
- Controllers · Older controller layer for admin and user actions
app/controller - Models · Older model layer paired with the legacy controllers
app/models
Static assets
Client-side styling, scripts, and vendored UI libraries
- Assets · Front-end assets, styles, scripts, and images used by the UI
public/assets - Vendored libs · Bundled Font Awesome and Hamburgers libraries
public/Lib
Connections 24
- index.php → User flows: routes to · Public requests enter the user-facing handlers
- index.php → Admin flows: routes to · Admin requests enter the admin handlers
- User flows → Auth helpers: uses · User flows share login, logout, and validation helpers
- Admin flows → Auth helpers: uses · Admin flows rely on shared helpers and validation
- Login → DB conn: auth queries · Login reads/writes via the database connection
- Logout → Auth helpers: session · Logout is part of the shared authentication surface
- User flows → Stored procs: calls · Guest and member actions are backed by stored procedures
- Admin flows → Stored procs: calls · Admin management actions are backed by stored procedures
- User flows → User views: renders · User handlers render user templates
- Admin flows → Admin views: renders · Admin handlers render admin templates
- User flows → User parts: includes · User pages compose reusable UI partials
- Admin flows → Admin parts: includes · Admin pages compose reusable UI partials
- User flows → Mail templates: sends mail · Reservation and recovery flows use email templates
- Admin flows → Mail templates: sends mail · Admin-side confirmation and contact mail flows use email templates
- User views → Layouts: wraps with · User templates share the common page shell
- Admin views → Layouts: wraps with · Admin templates share the common page shell
- DB conn → Tables: targets · Connection layer operates over the hotel schema
- DB conn → Stored procs: executes · Application data access is procedure-driven
- Controllers → Models: uses · Legacy controllers depend on legacy models
- Controllers → DB conn: db access · Legacy logic also reaches the database layer
- User flows → Assets: uses · User pages rely on shared front-end assets
- Admin flows → Assets: uses · Admin pages rely on shared front-end assets
- User views → Vendored libs: uses · User presentation uses vendored UI libraries
- Admin views → Vendored libs: uses · Admin presentation uses vendored UI libraries