<?php

include_once "../Librerias/Datasource.php";
include_once "../Librerias/ArtesanoDao.php";
include_once "../Librerias/Artesano.php";
include_once "../Librerias/Variables.php";
$tipoDoc = $_POST["tipo"];
$docId = $_POST["docId"];
$conn = new Datasource($dbhost, $dbName, $dbUser, $dbPassword);
$adao = new ArtesanoDao();
$busqueda = new Artesano();
$busqueda->setTipoDoc($tipoDoc);
$reemplazar = array("/", "-", "\\", "_", " ", ".", ",", "'");
$username = str_replace($reemplazar, "", $docId);
$busqueda->setUsername($username);
$lista = $adao->searchMatching($conn, $busqueda);
if (count($lista) == 0) {
    ?>
    	<meta http-equiv="REFRESH" content="0,url=../Interfaces/recuperarContrasena.php"> 
    	<script type="text/javascript">
    		alert("No se ha encontrado el documento de identidad. Intenta de nuevo");
    	</script>
    	<?php 
} else {
    $artesano = $lista[0];
    $destino = $artesano->getEmail();
    $cadena = "Solicitaste que se te devolviera tu contraseña. La contraseña que tienes actualmente es: " . $artesano->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)) {
        ?>
 $direccion = utf8_decode($_POST["direccion"]);
 $telefono = utf8_decode($_POST["telefono"]);
 $telefono2 = utf8_decode($_POST["telefono2"]);
 $email = utf8_decode($_POST["email"]);
 $celular = utf8_decode($_POST["celular"]);
 $certificacion = $_POST["certificacion"];
 $estudios = $_POST["estudios"];
 $artesano = new Artesano();
 $artesano->setNombre($nombre);
 $artesano->setTipoDoc($tipodoc);
 $artesano->setNroDoc($nroDoc);
 $artesano->setPassword($password);
 $artesano->setDireccion($direccion);
 $artesano->setTelefono($telefono);
 $artesano->setTelefono2($telefono2);
 $artesano->setUsername($username);
 $artesano->setCelular($celular);
 $artesano->setCertificacion($certificacion);
 $artesano->setEmail($email);
 $artesano->setNivelestudio($estudios);
 $artesano->setEstado(0);
 if ($artesanoDao->create($conn, $artesano)) {
     $list = $artesanoDao->searchMatching($conn, $artesano);
     $artesano = $list[0];
     $nombproducto = $_POST["nombproducto"];
     $descripcion = $_POST["descripcion"];
     $link = $_POST["link"];
     $empresa = utf8_decode($_POST["empresa"]);
     $nroenvio = $_POST["nroenvio"];
     $producto = new Producto();
     $producto->setAll(1, $nombproducto, $descripcion, $link, $artesano->getIdArtesano(), 0, $empresa, $nroenvio, 0, 0, 0, 0, 0, $_POST["mostrar"]);
Beispiel #3
0
 /**
  * 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 Artesano();
     $cloned->setIdArtesano($this->idArtesano);
     $cloned->setTipoDoc($this->TipoDoc);
     $cloned->setNroDoc($this->NroDoc);
     $cloned->setPassword($this->password);
     $cloned->setDireccion($this->direccion);
     $cloned->setTelefono($this->telefono);
     $cloned->setTelefono2($this->telefono2);
     $cloned->setUsername($this->username);
     $cloned->setEstado($this->estado);
     $cloned->setNombre($this->nombre);
     $cloned->setCelular($this->celular);
     $cloned->setEmail($this->email);
     $cloned->setCertificacion($this->certificacion);
     $cloned->setNivelestudio($this->nivelestudio);
     $cloned->setAprendices($this->aprendices);
     $cloned->setCursos($this->cursos);
     $cloned->setFormatofoto($this->formatofoto);
     return $cloned;
 }