Skip to content

Instantly share code, notes, and snippets.

@kurotori
Created December 22, 2023 20:34
Show Gist options
  • Save kurotori/3ca15372854400816dfe697bec70b6f1 to your computer and use it in GitHub Desktop.
Save kurotori/3ca15372854400816dfe697bec70b6f1 to your computer and use it in GitHub Desktop.
Programación Web - Espacio de Acompañamiento
<?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;
}
?>
<?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;
?>
<?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;
}
?>
<?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