function searchAdmin(Administrador $a)
 {
     require_once '../conexion.php';
     require_once '../model.business/Administrador.php';
     require_once '../model.business/Persona.php';
     try {
         $conexion = new conexion();
         $administrador = new Administrador();
         $sql = "SELECT a.nombre, a.apellido FROM administrador a " . "INNER JOIN login l ON a.username = l.username " . "WHERE l.username = '******' AND l.contraseña = '" . $a->getPassword() . "';";
         $conn = $conexion->conn();
         $query = $conn->query($sql);
         $rows = $query->fetchAll();
         foreach ($rows as $row) {
             $administrador->setUsername($a->getUsername());
             $administrador->setPassword($a->getPassword());
             $administrador->setRol(0);
             $administrador->setNombre($row["nombre"]);
             $administrador->setApellido($row["apellido"]);
         }
         return $administrador;
     } catch (Exception $ex) {
         $ex->getTraceAsString();
     }
 }
$clientesDal = new ClientesDal();
$adminDal = new AdministradorDal();
$gerenteDal = new GerenteDal();
$admin = new Administrador();
$cliente = new Cliente();
$gerente = new Gerente();
////Get
$username = $_POST["txt_rut"];
$password = $_POST["txt_password"];
if (crypt($password, $clientesDal->passwordClient($username)) == $clientesDal->passwordClient($username)) {
    $esIgual = TRUE;
} else {
    $esIgual = FALSE;
}
////SET Admin
$admin->setUsername($username);
$admin->setPassword(crypt($password, $adminDal->passwordAdmin($username)));
////SET Cliente
$cliente->setUsername($username);
$cliente->setPassword(crypt($password, $clientesDal->passwordClient($username)));
////SET Gerente
$gerente->setUsername($username);
$gerente->setPassword(crypt($password, $gerenteDal->passwordGerente($username)));
////Consulta si existe el cliente
if ($clientesDal->searchClient($cliente) != NULL || $esIgual == TRUE) {
    $cliente = $clientesDal->searchClient($cliente);
    $admin = $adminDal->searchAdmin($admin);
    $gerente = $gerenteDal->searchGerente($gerente);
    if ($cliente->getNombre() != null) {
        //Pagina
        $nombre = $cliente->getNombre() . ' </br> ' . $cliente->getApellido();
<?php

include_once "../Librerias/Datasource.php";
include_once "../Librerias/Administrador.php";
include_once "../Librerias/AdministradorDao.php";
include_once "../Librerias/Variables.php";
$conn = new Datasource($dbhost, $dbName, $dbUser, $dbPassword);
$admDao = new AdministradorDao();
$username = $_POST["username"];
$busqueda = new Administrador();
$busqueda->setUsername($username);
$lista = $admDao->searchMatching($conn, $busqueda);
if (count($lista) == 0) {
    ?>
		<meta http-equiv="REFRESH" content="0,url=../Interfaces/recuperarContrasenaAdmin.php">
		<script type="text/javascript">
			alert("No existe ese username. Intenta de nuevo");
		</script>
		<?php 
} else {
    $administrador = $lista[0];
    $destino = $administrador->getEmail();
    $cadena = "Solicitaste que se te devolviera tu contraseña. La contraseña que tienes actualmente es: " . $administrador->getPassword() . "<br>Atentamente,<br>Artesanías Manos de Oro";
    $cabeceras = 'MIME-Version: 1.0' . "\r\n";
    $cabeceras .= 'Content-type: text/html; charset=utf-8' . "\r\n";
    if (mail($destino, "Recuperación de la contraseña - Manos de Oro", $cadena, $cabeceras)) {
        ?>
				<meta http-equiv="REFRESH" content="0,url=../Interfaces">
				<script type="text/javascript">
					alert("El correo fue enviado");
				</script>
 /**
  * Clone will return identical deep copy of this valueObject.
  * Note, that this method is different than the clone() which
  * is defined in java.lang.Object. Here, the retuned cloned object
  * will also have all its attributes cloned.
  */
 function cloneObject()
 {
     $cloned = new Administrador();
     $cloned->setIdAdministrador($this->idAdministrador);
     $cloned->setPrimerNom($this->primerNom);
     $cloned->setSegundoNom($this->segundoNom);
     $cloned->setPrimerApe($this->primerApe);
     $cloned->setSegundoApe($this->segundoApe);
     $cloned->setUsername($this->username);
     $cloned->setPassword($this->password);
     $cloned->setEmail($this->email);
     $cloned->setTipo($this->tipo);
     return $cloned;
 }
require_once '../model.business/Administrador.php';
require_once '../model.dal/AdministradorDal.php';
require_once '../model.dal/LoginDal.php';
require_once '../conexion.php';
//Clases
$admin = new Administrador();
$adminDal = new AdministradorDal();
$loginDal = new LoginDal();
if (isset($_POST["txt_nuevo_rut"])) {
    //Set Class
    $admin->setRut($_POST["txt_nuevo_rut"]);
    $admin->setNombre($_POST["txt_nuevo_nombre"]);
    $admin->setApellido($_POST["txt_nuevo_apellido"]);
    $admin->setEmail($_POST["txt_nuevo_email"]);
    $admin->setTelefono($_POST["txt_nuevo_telefono"]);
    $admin->setUsername($_POST["txt_nuevo_rut"]);
    $password1 = $_POST["txt_nuevo_password_1"];
    $password2 = $_POST["txt_nuevo_password_2"];
    $passwordDefinitiva = NULL;
    if ($password1 == $password2) {
        $passwordDefinitiva = $password1;
    }
    $password = $admin->crypt_blowfish_bydinvaders($passwordDefinitiva);
    $admin->setPassword($password);
    //Nos retornará un numero la consulta
    $resultado = $loginDal->insertLoginAdmin($admin);
    if ($passwordDefinitiva != null) {
        switch ($resultado) {
            //Si retorna 1 todo Ok
            case 1:
                $adminDal->insertAdmin($admin);