Created
December 22, 2023 20:34
-
-
Save kurotori/3ca15372854400816dfe697bec70b6f1 to your computer and use it in GitHub Desktop.
Programación Web - Espacio de Acompañamiento
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Funcionario | |
{ | |
public $ci; | |
public $nombre; | |
public $apellido; | |
} | |
class Firma | |
{ | |
public $id; | |
public $fechahora; | |
public $tipo; | |
public $id_ant = 0; | |
} | |
class Respuesta | |
{ | |
public $estado; | |
public $datos; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once "clases.php"; | |
$datos = file_get_contents('php://input'); | |
$respuesta = new Respuesta(); | |
if ( ! empty($datos) ) { | |
$datosJSON = json_decode($datos); | |
$ci_funcionario = $datosJSON->ci; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function crearSal(){ | |
$sal=""; | |
$caracteres="abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890!@#$%^&*()-_=+,.><:;"; | |
for ($i=0; $i < 100; $i++) { | |
$num=random_int(0, strlen($caracteres)); | |
$letra=$caracteres[$num]; | |
$sal="$sal"."$letra"; | |
} | |
return $sal; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BaseDeDatos { | |
public $conexion; | |
public $estado; | |
public $mensaje; | |
public function iniciarConexion($servidor, $usuario, $password, $bdd){ | |
try { | |
$this->conexion = new mysqli($servidor, $usuario, $password, $bdd); | |
$this->estado = "OK"; | |
$this->mensaje = "Conexión Exitosa"; | |
} | |
catch (mysqli_sql_exception $excepcion) { | |
$this->estado = "ERROR"; | |
$this->mensaje = $this->conexion->connect_error . " Excp: ".$excepcion->getMessage(); | |
} | |
} | |
public function cerrarConexion(){ | |
$this->conexion->close(); | |
$this->estado="CERRADA"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment