The project follows a straightforward separation between frontend views (views/) and backend form-processing handlers (php/). Static assets live in css/, img/, and js/. The single entry point is login.php at the project root.
Directory Tree
CRUD-HOTEL-GUEVARINI-Publico/
├── css/ # Stylesheets
├── img/ # Image assets
├── js/ # Client-side JavaScript
├── php/ # Backend PHP logic
│ ├── auth/ # Authentication handlers
│ │ ├── validar_login.php
│ │ ├── procesar_registro.php
│ │ ├── enviar_recuperacion.php
│ │ ├── procesar_reset_password.php
│ │ ├── reenviar_verificacion.php
│ │ └── logout.php
│ ├── clientes/ # Client CRUD
│ │ ├── guardar_cliente.php
│ │ ├── actualizar_cliente.php
│ │ └── eliminar_cliente.php
│ ├── habitaciones/ # Room CRUD
│ │ ├── guardar_habitacion.php
│ │ ├── actualizar_habitacion.php
│ │ └── eliminar_habitacion.php
│ ├── reservaciones/ # Reservation CRUD
│ │ ├── guardar_reserva.php
│ │ ├── actualizar_reserva.php
│ │ ├── cancelar_reserva.php
│ │ └── eliminar_reserva.php
│ ├── usuarios/ # User CRUD
│ │ ├── guardar_usuario.php
│ │ ├── actualizar_usuario.php
│ │ └── eliminar_usuario.php
│ └── conexion.php # Database connection class
├── views/ # Frontend views
│ ├── login.php # Login page (entry point)
│ ├── panel.php # Dashboard
│ ├── registro.php # Registration page
│ ├── recuperar.php # Password recovery page
│ ├── reset_password.php # Password reset form
│ ├── modal_eliminar.php # Delete confirmation modal
│ ├── clientes/ # Client views
│ ├── habitaciones/ # Room views
│ ├── reservaciones/ # Reservation views
│ └── usuarios/ # User views
├── vendor/ # Composer dependencies (auto-generated)
├── libs/ # Additional libraries
├── base_de_datos.sql # Database schema and seed data
├── composer.json # PHP dependency manifest
└── login.php # Root entry point
Key Files
Entry point — login.php
The root login.php is the first file a browser hits. It redirects to views/login.php, which renders the login form. All authenticated pages check for a valid session and redirect back to this entry point if the session is missing or expired.
Database connection — php/conexion.php
Contains the Conexion class, which encapsulates a PDO connection to MySQL. Every PHP handler that needs to query the database instantiates this class and calls obtenerConexion().
$bd = new Conexion();
$conn = $bd->obtenerConexion();
The four private properties you must configure before running the application are:
private $host = "localhost";
private $db_name = "hotel_guevarini_publico";
private $username = "root";
private $password = "";
php/conexion.php is the single place to update database credentials. No other file holds connection parameters.
Dashboard — views/panel.php
The main dashboard shown after a successful login. It serves as the navigation hub for all CRUD sections: clients, rooms, reservations, and users.
Architecture: views/ vs php/
The project separates concerns across two directories:
| Directory | Purpose |
|---|
views/ | HTML/PHP templates that render the UI. These files are what the browser requests directly. |
php/ | Form-processing handlers. Views submit HTML forms to these scripts, which validate input, interact with the database, and redirect back to the appropriate view. |
This means a typical user action flows like this:
Browser → views/clientes/clientes.php
(displays list + form)
↓ POST
php/clientes/guardar_cliente.php
(validates, inserts, redirects)
↓ redirect
views/clientes/clientes.php
Authentication handlers — php/auth/
| File | Responsibility |
|---|
validar_login.php | Verifies credentials, starts the session |
procesar_registro.php | Creates a new user, sends verification email |
enviar_recuperacion.php | Sends the password-reset email with a unique token |
procesar_reset_password.php | Validates the reset token and updates the password hash |
reenviar_verificacion.php | Resends the account verification email |
logout.php | Destroys the session and redirects to login |
Composer and vendor/
The only PHP dependency declared in composer.json is PHPMailer:
{
"require": {
"phpmailer/phpmailer": "^7.0"
}
}
The vendor/ directory is not included in version control. It is created by running:
from the project root. PHPMailer is used by the four SMTP-enabled handlers (procesar_registro.php, enviar_recuperacion.php, reenviar_verificacion.php, guardar_usuario.php) to send transactional emails.
If vendor/ does not exist, any feature that sends email will fail with a fatal PHP error. Always run composer install after cloning the repository.