How tramyardg/hotel-mgmt-system works
Purpose and runtime
A server-rendered PHP hotel management system for customer registration, login/profile management, room reservation, and administrator reservation management. It runs behind a PHP-capable web server (the README suggests XAMPP) with MySQL. Database setup/data are provided in hotel.sql; an alternate schema artifact exists at db/schema.sql.
HTTP entry points and page flow
Public PHP pages are the application’s HTTP entry points: index.php presents the customer-facing site; register.php, login.php, and sign-in.php support authentication; admin.php is the administrative landing page. Form POSTs are routed directly to procedural endpoint scripts rather than a central router, notably app/process_registration.php, app/process_login.php, app/process_reservation.php, and app/process_update_profile.php. Logout is handled by app/process_logout.php.
Persistence boundary
app/DB.php centralizes MySQL connection/configuration and is the boundary between application code and the hotel database. SQL access is organized into DAO classes: app/dao/CustomerDAO.php, app/dao/BookingReservationDAO.php, and app/dao/BookingDetailDAO.php; administrator-specific reads/updates use app/dao/AdminDAO.php. These DAOs mediate the core customer, reservation, booking-detail, and admin data tables defined by hotel.sql.
Domain model layer
PHP model objects represent core business entities and state: app/models/Customer.php, app/models/Reservation.php, app/models/Booking.php, and app/models/Pricing.php. Reservation/business status and requirements are constrained through app/models/StatusEnum.php and app/models/RequirementEnum.php. This separates record/domain representation from DAO persistence and endpoint handling.
Application service/handler layer
Handlers coordinate request-facing workflows with DAOs and models: app/handlers/CustomerHandler.php manages customer operations, app/handlers/BookingReservationHandler.php drives reservation workflows, and app/handlers/BookingDetailHandler.php manages booking detail behavior. app/handlers/AdminHandler.php provides the admin-facing orchestration used by reservation management. The expected control path is page/form → process_*.php endpoint → handler → DAO/DB → redirect or server-rendered response.
Customer and administrator boundaries
Customer capabilities include account creation, authenticated access, profile updates, room pricing/reservation submission, and viewing bookings. Administrative authority is represented by the customer isadmin database field per the README, with admin UI and management actions isolated in admin.php and app/admin/manage_reservation.php. This is an application-level authorization boundary rather than a separate admin service.
Client assets and dependencies
Browser-side behavior supports form submission and multistep reservation interaction through js/form-submission.js and js/multiStepsRsvn.js; admin interactions use js/admin.js. Styling is in css/main.css. PHP dependencies are installed through composer.json, while legacy/local password hashing code is bundled in lib/phpPasswordHashing/passwordLib.php and lib/phpPasswordHashing/passwordLibClass.php. JavaScript dependencies are managed through package.json.
Main entry points: CustomerHandler.php Customer handler · DB.php MySQL connection · index.php Customer pages · BookingReservationHandler.php Reservation handlers
Components 18
Web interface
- Customer pages · Registration, login, profile, and reservation views.
index.php - Auth pages
login.php - Admin landing
admin.php - Customer browser assets · Form and multistep reservation behavior.
js/form-submission.js - Admin browser assets
js/admin.js
PHP application
- Auth endpoints · Registration, login, profile update, and logout actions.
app/process_login.php - Reservation endpoint
app/process_reservation.php - Reservation management
app/admin/manage_reservation.php - Customer handler
app/handlers/CustomerHandler.php - Reservation handlers · Coordinates reservation and booking-detail workflows.
app/handlers/BookingReservationHandler.php - Admin handler
app/handlers/AdminHandler.php - Domain models · Customer, reservation, booking, pricing, status, and requirements.
app/models/Reservation.php - Password hashing
lib/phpPasswordHashing/passwordLib.php
Persistence
- Customer DAO
app/dao/CustomerDAO.php - Reservation DAOs · Reservation and booking-detail persistence.
app/dao/BookingReservationDAO.php - Admin DAO
app/dao/AdminDAO.php - MySQL connection
app/DB.php - Hotel database · Includes customer isadmin authorization field.
hotel.sql
Connections 19
- Customer browser assets → Customer pages: enhances forms
- Admin browser assets → Admin landing: supports admin UI
- Customer pages → Auth endpoints: POSTs account actions
- Auth pages → Auth endpoints: submits credentials
- Customer pages → Reservation endpoint: submits reservation
- Admin landing → Reservation management: manages reservations
- Auth endpoints → Customer handler: delegates
- Reservation endpoint → Reservation handlers: delegates
- Reservation management → Admin handler: delegates
- Customer handler → Domain models: uses
- Reservation handlers → Domain models: uses
- Customer handler → Password hashing: hashes passwords
- Customer handler → Customer DAO: persists customers
- Reservation handlers → Reservation DAOs: persists bookings
- Admin handler → Admin DAO: reads and updates
- Customer DAO → MySQL connection: uses
- Reservation DAOs → MySQL connection: uses
- Admin DAO → MySQL connection: uses
- MySQL connection → Hotel database: connects to