How mahfujul-01726/tourandtraveltouch works
1. Overall shape: This is a small monolithic travel-booking application built with PHP 8+, MySQL/MariaDB, vanilla JavaScript, and Bootstrap 5. The browser serves a mostly static frontend, while PHP scripts in backend/ act as request handlers for auth, booking, search, and admin functions.
2. Frontend shell: index.html is the main public landing page. pages/login.html and pages/signup.html are separate auth screens. The UI is styled and themed through assets/css/theme-orange.css and assets/css/theme-red.css, with images and branding assets under assets/images/.
3. Client-side behavior: assets/js/config.js is the main browser-side integration point; it points frontend calls to the backend base URL. JavaScript also drives the interactive presentation layer described in the README: theme switching, animations, parallax, particles, scroll reveal, and flash/toast display.
4. Backend configuration boundary: backend/config/app.php and backend/config/database.php centralize environment settings and database connectivity. app.php governs session and frontend-origin related behavior, while database.php establishes the MySQL connection used by all handlers.
5. Shared backend utilities: backend/helpers.php provides cross-cutting server-side utilities used across handlers and admin pages. This is where common concerns like sanitization, token/session helpers, or response formatting are likely consolidated.
6. Request handlers: backend/handlers/ is the application’s functional API layer. Each file is a focused endpoint:
- register.php, login.php, logout.php handle user authentication
- auth-status.php reports whether a session is authenticated
- csrf-token.php issues CSRF tokens to the client
- booking.php persists travel bookings
- search.php performs booking/destination searches
- flash.php exposes session-backed status messages
7. Data model and persistence: database/schema.sql defines the core relational schema. The main entities are users, information (booking records), and admins. The information table links bookings back to users, so the primary data flow is user account creation → authenticated session → booking insertion → later admin review.
8. Admin subsystem: backend/admin/login.php, logout.php, and dashboard.php form a separate admin realm from the public user flow. The admin panel is not just another page; it is a distinct authenticated boundary for reviewing and managing booking/user data.
9. Security and trust boundaries: The repository emphasizes server-side protection at every state-changing boundary. Public forms submit to PHP handlers protected by CSRF tokens, credentials are stored with bcrypt, database access uses prepared statements, and output is sanitized to reduce XSS risk. Session-based auth is the main trust mechanism between browser and backend.
10. Operational/deployment flow: .github/workflows/deploy.yml automates deployment by pushing the repository contents to an InfinityFree host over FTP on every push to main. That means the architecture has a simple CI/CD path: GitHub repository → Actions runner → FTP upload → shared hosting runtime.
11. Runtime profile: The app is deployed as a classic PHP site rather than a containerized service or SPA. The browser talks directly to PHP endpoints over HTTP, and PHP talks directly to MySQL. There is no separate application server layer, queue, or external API dependency visible in the repository.
12. What to draw in a diagram: The important diagram boundaries are: browser/frontend assets, PHP backend handlers/config, admin area, MySQL database, and FTP-based deployment pipeline. The main data flow is user interaction in the browser → PHP request handlers → MySQL → response/flash/session back to the browser.
Main entry points: config.js Client Config · database.php DB Config · deploy.yml Deploy · dashboard.php Admin Area
Components 19
Frontend
Public browser-facing pages and assets
- Landing · Main public entry page
index.html - Login · Public sign-in screen
pages/login.html - Signup · Public account creation screen
pages/signup.html - Client Config · Frontend base URL and integration settings
assets/js/config.js - Themes · Shared visual themes for the site
assets/css/theme-orange.css
Backend
PHP request handlers and shared server logic
- App Config · Session and app-level runtime settings
backend/config/app.php - DB Config · Database connection setup
backend/config/database.php - Helpers · Shared PHP utility functions
backend/helpers.php - Register · Creates user accounts
backend/handlers/register.php - Login API · Authenticates users and starts sessions
backend/handlers/login.php - Logout API · Ends user sessions
backend/handlers/logout.php - Auth Status · Reports whether a user is signed in
backend/handlers/auth-status.php - CSRF Token · Issues CSRF tokens to the browser
backend/handlers/csrf-token.php - Booking · Stores travel bookings
backend/handlers/booking.php - Search · Searches destinations and booking data
backend/handlers/search.php - Flash · Returns session-backed messages
backend/handlers/flash.php - Admin Area · Separate admin login and dashboard boundary
backend/admin/dashboard.php
Data
Database schema and persistence model
- Schema · Core tables for users, bookings, and admins
database/schema.sql
Deployment
Automated hosting pipeline
- Deploy · FTP deployment to shared hosting
.github/workflows/deploy.yml
Connections 22
- Landing → Client Config: uses · Browser code reads backend base URL and integration settings
- Login → Client Config: uses · Auth screens call the backend through shared client config
- Signup → Client Config: uses · Auth screens call the backend through shared client config
- Client Config → Register: calls · Client submits account creation requests
- Client Config → Login API: calls · Client submits login requests
- Client Config → Logout API: calls · Client submits logout requests
- Client Config → Auth Status: calls · Client checks session state
- Client Config → CSRF Token: calls · Client fetches CSRF tokens
- Client Config → Booking: calls · Client submits booking requests
- Client Config → Search: calls · Client performs search requests
- Client Config → Flash: calls · Client fetches status messages
- App Config → Helpers: supports · Shared runtime behavior and utilities are centralized here
- DB Config → Schema: connects · Database configuration targets the schema-backed MySQL store
- Register → DB Config: uses · Account creation needs database access
- Login API → DB Config: uses · Authentication reads and verifies stored credentials
- Booking → DB Config: uses · Booking writes persist to the database
- Search → DB Config: uses · Search queries read from the database
- Admin Area → DB Config: uses · Admin dashboard reviews persisted users and bookings
- Admin Area → Helpers: uses · Admin realm shares common server utilities
- Deploy → Landing: deploys · Workflow uploads the public site
- Deploy → App Config: deploys · Workflow uploads backend runtime files
- Deploy → Schema: deploys · Workflow includes the database schema artifacts