How successfulshreya/guesthouse_system works
Purpose and runtime
A server-rendered PHP/MySQL guesthouse booking system intended for XAMPP (Apache + MySQL). It supports separate admin and user workflows: users search availability and book rooms; administrators maintain guesthouses, rooms, users, and bookings. The database schema/data is supplied at database/guesthouse_db (2).sql, with connection setup centralized in db_connect.php.
Application entry and session boundary
index.php is the primary browser entry point and likely owns authentication/routing into role-specific dashboards. logout.php terminates authenticated access. The application is organized by URL-accessible PHP pages rather than a framework/router, so authorization/session checks must be consistently enforced at each page boundary.
Paths: index.php, logout.php, db_connect.php
User booking workflow
The user area provides the core reservation flow: availability lookup, room selection/details, rate lookup, and booking submission. Users can then inspect their reservations and reports from their dashboard. Dynamic room/rate endpoints suggest UI-driven requests that return room-specific data during booking.
Paths: user/dashboard.php, user/availability.php, user/book_room.php
Paths: user/get_room.php, user/get_room_rate.php, user/my_booking.php
Administration workflow
Admin pages are the operational control plane. The dashboard links to CRUD-style creation for guesthouses, rooms, and users, while booking management handles reservation review or updates. Admin actions operate directly against the shared MySQL data model used by user booking pages.
Paths: admin/dashboard.php, admin/manage_booking.php, admin/add_guesthouse.php
Paths: admin/add_room.php, admin/add_user.php
Data model and persistence
MySQL is the system of record for identities, guesthouse inventory, room data/rates, and bookings. The SQL export is therefore the authoritative source for table relationships, required booking fields, initial accounts, and constraints. All application pages should use the common database connection layer rather than independent connection definitions.
Paths: database/guesthouse_db (2).sql, db_connect.php
Notification integration
Email notifications are implemented through the bundled PHPMailer library and an application mail configuration file. Booking or administrative events can use SMTP, creating an external-service boundary: credentials and transport settings belong in mail configuration, while sending behavior should remain in application workflows.
Paths: includes/mail_config.php, includes/PHPMailer/src/PHPMailer.php, includes/PHPMailer/src/SMTP.php
Paths: testmail.php
Presentation boundary
Views are PHP pages with dedicated CSS per role, not a separate frontend application. Admin and user interfaces have separate styling assets, reinforcing the role-area split while sharing the same PHP/MySQL backend.
Paths: admin/styleadmin.css, user/style.css
Main entry points: db_connect.php Database connection · availability.php Availability search · dashboard.php Admin dashboard · index.php Application entry
Components 19
User booking area
- User dashboard
user/dashboard.php - Availability search
user/availability.php - Booking submission · Creates reservations from selected room details and rates.
user/book_room.php - Room details endpoint
user/get_room.php - Room rate endpoint
user/get_room_rate.php - My bookings
user/my_booking.php
Administration
- Admin dashboard
admin/dashboard.php - Booking management · Reviews or updates reservations.
admin/manage_booking.php - Guesthouse creation
admin/add_guesthouse.php - Room creation
admin/add_room.php - User creation
admin/add_user.php
Shared platform
- Application entry · Authentication and role routing boundary.
index.php - Logout
logout.php - Database connection · Shared MySQL connection setup.
db_connect.php - Guesthouse MySQL · Stores identities, inventory, rates, and bookings.
database/guesthouse_db (2).sql - Mail configuration · SMTP credentials and transport settings.
includes/mail_config.php - PHPMailer
includes/PHPMailer/src/PHPMailer.php - SMTP transport
includes/PHPMailer/src/SMTP.php - Mail test
testmail.php
Connections 24
- Application entry → User dashboard: user access
- Application entry → Admin dashboard: admin access
- Application entry → Logout: ends session
- User dashboard → Availability search: search rooms
- Availability search → Room details endpoint: loads room
- Availability search → Room rate endpoint: loads rate
- Availability search → Booking submission: selects room
- User dashboard → My bookings: views reservations
- Admin dashboard → Booking management: manages bookings
- Admin dashboard → Guesthouse creation: maintains guesthouses
- Admin dashboard → Room creation: maintains rooms
- Admin dashboard → User creation: maintains users
- Availability search → Database connection: uses
- Booking submission → Database connection: uses
- My bookings → Database connection: uses
- Booking management → Database connection: uses
- Guesthouse creation → Database connection: uses
- Room creation → Database connection: uses
- User creation → Database connection: uses
- Database connection → Guesthouse MySQL: connects
- Booking submission → Mail configuration: may notify
- Mail configuration → PHPMailer: configures
- PHPMailer → SMTP transport: sends via
- Mail test → Mail configuration: tests