CashMan H.A. uses two PHP front controllers that route all requests via GET parameters. Rather than a URL-rewriting framework, each controller reads a single query-string key and dispatches to the appropriate logic through aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/DanielRivera03/SistemaBancario/llms.txt
Use this file to discover all available pages before exploring further.
switch statement. cIniciosSesionesUsuarios.php owns everything before a session exists; once authenticated, every subsequent action flows through cGestionesCashman.php.
cIniciosSesionesUsuarios.php
Location: controlador/cIniciosSesionesUsuarios.php
Purpose
Handles all pre-authentication operations: login validation, session creation, password recovery via emailed security codes, new password submission, and logout.Routing Parameter
iniciarsesion.
Dependencies
| Dependency | Role |
|---|---|
PHPMailer/Exception.php | PHPMailer exception class |
PHPMailer/PHPMailer.php | Core mailer class |
PHPMailer/SMTP.php | SMTP transport |
modelo/conexion.php | Opens $conectarsistema and auxiliary MySQLi connections |
modelo/mRecuperacionCuentas.php | RecuperacionCuentas model — account recovery DB operations |
Global Configuration
$UrlGlobal is used in email body HTML to construct absolute links back to the application (e.g., the “Change Password” button href). The :90 port prefix matches the default development server configuration and must be updated for any other environment.
PHPMailer SMTP Settings
The controller configures PHPMailer inline within therecuperar-cuentas and cambiar-contrasenia-recuperacion cases. Key properties that must be set for your environment:
The project was developed using Papercut SMTP for local email capture. For production, configure a real SMTP provider (e.g., Mailtrap, SendGrid, or an institutional mail server) and consult the PHPMailer documentation.
Key Operations
Login Validation (`validar-sesiones`)
Receives
val-username and val-password via POST. Hashes the password with SHA-1 + crypt(), calls IniciarSesionUsuarios() on the connection, and redirects to the role-appropriate dashboard. Optionally sets a 30-day cookie for “remember me”.Recovery Code Generation (`recuperar-cuentas`)
Generates a 5-digit random code with
rand(10000, 99999) and a 10-character hex token with random_bytes(5) + bin2hex(). Stores both in $_SESSION and calls RecuperarCuentasUsuarios() to persist them in the database. Sends the code by email — the clickable link in the email includes the token as a URL parameter.Code Validation (`cambio-estado-token`)
Reads the code from session and upgrades
$_SESSION['EstadoCodigos'] from BloquearCodigoAcceso to ValidarCodigoAcceso, gating access to the new-password form.Password Reset (`cambiar-contrasenia-recuperacion`)
Accepts the new password via POST, hashes it identically to the login flow, calls
CambioContraseniaRecuperacion(), sends a confirmation email, then destroys the session.cGestionesCashman.php
Location: controlador/cGestionesCashman.php
Purpose
Handles all post-login business logic: dashboards, user management, credit lifecycle, savings accounts, transfers, messaging, notifications, products, and PDF generation.Routing Parameter
inicioadministradores.
Dependencies
| Dependency | Role |
|---|---|
PHPMailer (3 files) | Email delivery for transfer security codes and notifications |
modelo/conexion.php | Opens $conectarsistema through $conectarsistema7 |
modelo/mGestionesCashman.php | GestionesClientes model — all business logic DB calls |
Timezone
Set at the very top of the file, before any routing:date() calls in this controller — including installment due-date calculations and file-upload timestamps — use this timezone.
Global Configuration
Identical$UrlGlobal pattern as in cIniciosSesionesUsuarios.php:
Access Control Pattern
Everyswitch case checks the session role before executing any logic:
redirecciones-sistema-cashmanha, which itself routes the user to their own role-appropriate home page. There is no unauthenticated access path in this controller.
AJAX Response Pattern
Write operations returnecho json_encode($result) directly for AJAX-compatible responses. The model methods return the string "OK" on success or "ERROR" on failure, which is then JSON-encoded and sent to the browser:
Multi-Connection Strategy
Because PHP’s MySQLi extension does not natively support running multiple stored-procedure result sets in parallel on a single connection,cGestionesCashman.php opens up to seven independent connections from conexion.php ($conectarsistema through $conectarsistema7). Dashboard pages that need several result sets simultaneously assign each query to a separate connection:
modelo/mGestionesCashman.php — GestionesClientes Class
Location: modelo/mGestionesCashman.php
Architecture
GestionesClientes is a PHP class with private properties for all entity fields and public methods that map 1:1 to stored procedures in the cashmanha database schema. No raw SQL is written inline in the application code — every database operation is a CALL ProcedureName(...) statement.
Pattern
Each method uses the setter/call pattern:- The controller calls a setter to populate a private property.
- The method builds a
CALL ProcedureName(...)string using the interpolated private properties. mysqli_query()executes the call on the connection passed as an argument.- The raw MySQLi result is returned to the controller.
- The controller (or the view) calls
mysqli_fetch_assoc(),mysqli_fetch_array(), or iterates withwhileto extract rows.
Representative Method Signatures
Private Properties Declared
The class declares private properties covering all entity fields across every module:| Group | Properties |
|---|---|
| User account | $IdUsuarios, $NombresUsuarios, $ApellidosUsuarios, $CodigoUsuarios, $CorreoUsuarios, $IdRolUsuarios, $FotoUsuarios, $EstadoUsuarios |
| User details | $DuiUsuarios, $NitUsuarios, $TelefonoUsuarios, $CelularUsuarios, $TelefonoTrabajoUsuarios, $DireccionUsuarios, $EmpresaUsuarios, $CargoEmpresaUsuarios, $DireccionTrabajoUsuarios, $FechaNacimientoUsuarios, $GeneroUsuarios, $EstadoCivilUsuarios |
| Documents | $FotoDuiFrontalUsuarios, $FotoDuiReversoUsuarios, $FotoNitUsuarios, $FotoFirmaUsuarios |
| Roles | $NombreRolUsuario, $DescripcionRolUsuario |
| Products | $IdProductos, $CodigoProductos, $NombreProductos, $DescripcionProductos, $RequisitosProductos, $EstadoProductos |
| Credits | $IdCreditos, $TipoClienteCreditos, $MontoFinanciamientoCreditos, $TasaInteresCreditos, and many more |
The database schema backing
GestionesClientes contains 148 stored procedures, 67 views, 21 triggers, and 5 scheduled events across 21 tables. Every public method in the model corresponds to one of those stored procedures.