Add files via upload

This commit is contained in:
Fernando Méndez
2021-04-26 22:40:34 +02:00
committed by GitHub
parent b033bdf328
commit 1e9685ee9b
99 changed files with 4870 additions and 0 deletions

37
assets/php/dao.php Normal file
View File

@ -0,0 +1,37 @@
<?php
// TO-DO: Completar
class DAO {
//Constants:
private const _SERVERNAME = "localhost";
private const _USERNAME = "sw";
private const _PASSWORD = "_admin_";
private const _BD = "complucine";
//Atributes:
public $mysqli;
//Constructor:
public function __construct($bd_name){
if($bd_name == null) $bd_name = self::_BD;
try{
if (!$this->mysqli) {
$this->mysqli = new mysqli(self::_SERVERNAME, self::_USERNAME,
self::_PASSWORD, $bd_name);
}
// echo "Conexión a la BD, satisfactoria.";
} catch (Exception $e){
echo "Error de conexión a la BD: ". mysqli_connect_error();
exit();
}
/* ... */
}
//Destructor:
public function __destruct(){
$this->mysqli->close();
}
//Methods:
}
?>