!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/apex_tdfonline/proyectos/toba_referencia/php/modelo/   drwxr-xr-x
Free 14.61 GB of 61.93 GB (23.59%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     modelo_persona.php (3.18 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

class modelo_filtro
{
    function 
__construct($campos)
    {
        
    }
}

class 
modelo_persona
{
    protected 
$id;

    static function 
get_personas($where ""$order_by ""$limit "")
    {
        if (
$order_by == "") {
            
$order_by "ORDER BY pers.id ASC";
        }
        
$sql "SELECT 
                    pers.id, 
                    pers.nombre, 
                    pers.fecha_nac 
                FROM 
                    ref_persona pers
                WHERE  
$where $order_by $limit";
        
$datos toba::db()->consultar($sql);
        return 
$datos;
    }
    
    static function 
get_cant_personas($where "")
    {
        
$sql "SELECT 
                    count(*) as cantidad
                FROM 
                    ref_persona pers
                WHERE 
$where";
        
$datos toba::db()->consultar_fila($sql);
        return 
$datos['cantidad'];
    }
    
    static function 
get_deportes($id_persona)
    {
        
$sql "SELECT
                    deporte,
                    dia_semana,
                    hora_inicio,
                    hora_fin
                FROM ref_persona_deportes
                WHERE persona = " 
quote($id_persona);
        return 
toba::db()->consultar($sql);
    }
    
    static function 
get_juegos($id_persona)
    {
        
$sql "SELECT
                    juego,
                    dia_semana,
                    hora_inicio,
                    hora_fin
                FROM ref_persona_juegos
                WHERE persona = " 
quote($id_persona);
        return 
toba::db()->consultar($sql);        
    }
    
    static function 
insert($datos)
    {
        
$sql "INSERT INTO ref_persona (nombre, fecha_nac) VALUES (" quote($datos['nombre']) . ", " quote($datos['fecha_nac']) . ")";
        
toba::db()->ejecutar($sql);
        return 
toba::db()->ultimo_insert_id("ref_persona_id_seq");
    }

    public static function 
validar($datos)
    {
        
//es de juguete esta validacion - Habría que chequear tipos, y diferenciar si está
        //modificando o creando, si tiene permisos y otras reglas de negocio.
        
$errores = array();
        if(!isset(
$datos['nombre']) && !isset($datos['imagen'])){
            
$errores['nombre'] = 'el campo es obligatorio a menos que se provea una imagen';
            
$errores['imagen'] = 'el campo es obligatorio a menos que se provea un nombre';
        }
        return 
$errores;
    }
    
    
//-------------------------------------
    //---        DINAMICO
    //-------------------------------------
    
    
function __construct($id)
    {
        
$this->id = (int)$id;
    }
    
    function 
update($datos)
    {
        
$sql "UPDATE ref_persona SET nombre = ".quote($datos['nombre'])." WHERE id = ".quote($this->id);
        return 
toba::db()->ejecutar($sql);
    }

    function 
update_imagen($datos){
        
$imagen base64_decode($datos['imagen']);

        
$sentencia toba::db()->sentencia_preparar("UPDATE ref_persona SET imagen = ? WHERE id = ".quote($this->id));
        
toba::db()->sentencia_agregar_binarios($sentencia, array($imagen));
        return 
toba::db()->sentencia_ejecutar($sentencia);
    }
    
    function 
delete()
    {
        
$sql "DELETE FROM ref_persona WHERE id = " quote($this->id);
        return 
toba::db()->ejecutar($sql);
    }
    
    function 
get_datos($incluir_imagen false)
    {
        
$imagen = ($incluir_imagen)? 'imagen,''';
        
$sql "SELECT
                    id,
                    nombre,
                    fecha_nac,
                    planilla_pdf_firmada,
                    
$imagen
                    (imagen IS NOT NULL) as tiene_imagen
                FROM ref_persona WHERE id = "
.quote($this->id);
        
$fila toba::db()->consultar_fila($sql);
        if(
$incluir_imagen && $fila['imagen']){
            
$fila['imagen'] = base64_encode(stream_get_contents($fila['imagen']));
        }
        return 
$fila;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.81 ]--