Пример #1
0
 /**
  * @brief Function set
  *      seta todos os campos no Banco de dados e criptografando-os antes.
  * @param id_adm do usuario logado
  * @return mensagem indicador de erro ou sucesso
  */
 public function set($id_adm)
 {
     $this->id_adm = $id_adm;
     $this->name = Dbcommand::post('name_link');
     $this->about = Dbcommand::post('about_link');
     $this->url = Dbcommand::post('url_link');
     $this->key = "LINK_" . date("d-H-i-s");
     $this->get();
     $this->album->addPhoto($this->id_adm);
     if (empty($this->name) || empty($this->url)) {
         return "erro_campos";
     }
     if (!ValidationData::text($this->name) || !ValidationData::text($this->url)) {
         return "erro_campo";
     } else {
         $this->name = Criptography::BASE64($this->name, 1);
         $this->about = Criptography::BASE64($this->about, 1);
         $this->url = Criptography::BASE64($this->url, 1);
         $this->date_in = Criptography::BASE64(date("Y-m-d H:i:s"), 1);
         $this->log = $this->date_in;
         $this->key = Criptography::BASE64($this->key, 1);
         Dbcommand::insert('tb_links', array('LINK_ID_ADM', 'LINK_DATA', 'LINK_LOG', 'LINK_NOME', 'LINK_SOBRE', 'LINK_CHAVE', 'LINK_URL'), array($this->id_adm, $this->date_in, $this->log, $this->name, $this->about, $this->key, $this->url));
         return "sucesso_cadastro";
     }
 }
Пример #2
0
 /**
  * @brief Funcao set
  *      insere no Banco de dados todos os valores ja criptografado checando se o campo url nao esta vazio.
  * @param id_adm do usuario logado
  * @param url da imagem
  * @return mensagem indicador de erro ou sucesso
  */
 public function set($id_adm, $url)
 {
     $this->id_adm = $id_adm;
     $this->name = Dbcommand::post("name_photo");
     $this->url = $url;
     if (!empty($this->name) && !ValidationData::text($this->name)) {
         return "erro_campo";
     }
     if (empty($this->url)) {
         return "erro_campos";
     } else {
         $this->name = Criptography::BASE64($this->name, 1);
         $this->url = Criptography::BASE64($this->url, 1);
         $this->albumName = Criptography::BASE64($this->albumName, 1);
         $this->date_in = Criptography::BASE64(date("Y-m-d H:i:s"), 1);
         $this->log = $this->date_in;
         Dbcommand::insert('tb_fotos', array('FOTO_ID_ADM', 'FOTO_DATA', 'FOTO_NOME', 'FOTO_NOME_ALBUM', 'FOTO_URL', 'FOTO_LOG'), array($this->id_adm, $this->date_in, $this->name, $this->albumName, $this->url, $this->log));
         return "sucesso_cadastro";
     }
 }
Пример #3
0
 /**
  * @brief Function set
  *      insere no Banco de dados informacoes sobre o "serviço" ja criptografado.
  * @param id_adm do usuario logado
  * @return mensagem indicador de erro ou sucesso
  */
 public function set($id_adm)
 {
     $this->id_adm = $id_adm;
     $this->name = Dbcommand::post('name_service');
     $this->about = Dbcommand::post('about_service');
     $this->key = "SER_" . date("d-H-i-s");
     $this->get();
     $this->album->addPhoto($this->id_adm);
     if (empty($this->name)) {
         return "erro_campos";
     }
     if (!ValidationData::text($this->name)) {
         return "erro_campo";
     } else {
         $this->name = Criptography::BASE64($this->name, 1);
         $this->about = Criptography::BASE64($this->about, 1);
         $this->date_in = Criptography::BASE64(date("Y-m-d H:i:s"), 1);
         $this->log = $this->date_in;
         $this->key = Criptography::BASE64($this->key, 1);
         Dbcommand::insert('tb_servicos', array('SER_ID_ADM', 'SER_DATA', 'SER_LOG', 'SER_NOME', 'SER_SOBRE', 'SER_CHAVE'), array($this->id_adm, $this->date_in, $this->log, $this->name, $this->about, $this->key));
         return "sucesso_cadastro";
     }
 }
Пример #4
0
 /**
  * @brief Function setName
  *      armazena o nome da empresa.
  * @param void
  * @return void
  */
 public function setName()
 {
     $this->name = Dbcommand::post('name_corporation');
     $this->name = Criptography::BASE64($this->name, 1);
     Dbcommand::insert('tb_empresa', array('EMP_NOME'), array($this->name));
     return $this;
 }
Пример #5
0
 /**
  * @brief Function setRecovery
  *      verifica se é possivel recuperar a senha, verificando se ja foi feito o pedido e se o email ja esta cadastrado; assim depois realiza a recuperação.
  * @param void
  * @return mensagem indicador de erro ou sucesso
  */
 public function setRecovery()
 {
     $this->mail_job = Dbcommand::post("email");
     if (!ValidationData::mail($this->mail_job)) {
         return "erro_campo";
     } else {
         $this->mail_job = Criptography::BASE64($this->mail_job, 1);
         $results = Dbcommand::select("tb_administradores", array('ADM_EMAIL' => $this->mail_job));
         if (Dbcommand::count_rows($results) == 1) {
             /*  Verifica se o email esta cadastrado	 */
             $chave = sha1(uniqid(mt_rand(), true));
             /* Guardar este par de valores na tabela para confirmar mais tarde  */
             $check = Dbcommand::select("tb_recuperacao", array('REC_ADM' => $this->mail_job));
             if (Dbcommand::count_rows($check) > 0) {
                 /*  Verifica se o email ja solicitou a recuperacao  */
                 Dbcommand::update("tb_recuperacao", array('REC_CONFIRMACAO' => $chave), array('REC_ADM' => $this->mail_job));
             } else {
                 Dbcommand::insert("tb_recuperacao", array('REC_ADM', 'REC_CONFIRMACAO'), array($this->mail_job, $chave));
             }
             /* 	  ====      Setando valores 	====	 */
             $link = $_SERVER['HTTP_HOST'] . "/ej-admin/recuperar/recuperar.php?utilizador={$this->mail_job}&confirmacao={$chave}";
             $this->mail_job = Criptography::BASE64($this->mail_job, 0);
             $this->title = "Recuperação de senha";
             $this->message = 'Olá ' . $this->mail_job . ', visite este link para recuperar a senha: ' . $link . '<br><br><br>
                                 Solicitação: ' . date("d/m/Y H:i:s", strtotime(date("Y-m-d H:i:s")));
             /*  	==========	    ==========	 */
             $mail = new PHPMailer();
             /* Classe para enviar emails   */
             $mail->IsSMTP();
             /* Define que a mensagem sera SMTP     */
             /*  Define o remetente   */
             $mail->From = $this->from;
             // Seu e-mail
             $mail->Sender = $this->from;
             // Seu e-mail
             $mail->FromName = $this->fromName;
             // Seu nome
             /* Define os destinatario(s)    */
             $mail->AddAddress($this->mail_job);
             /* Sera para o solicitante */
             $mail->IsHTML(true);
             // Define que o e-mail sera enviado como HTML
             $mail->CharSet = 'utf-8';
             // Charset da mensagem
             // Define a mensagem (Texto e Assunto)
             $mail->Subject = $this->title;
             $mail->Body = $this->message;
             $sended = $mail->Send();
             // Envia o e-mail
             $mail->ClearAllRecipients();
             // Limpa os destinatarios e os anexos
             if ($sended) {
                 return "sucesso_recuperacao";
             } else {
                 return "erro_recuperacao";
             }
         } else {
             return "erro_email";
         }
     }
 }
Пример #6
0
 /**
  * @brief Function set
  *      insere no Banco de dados todos os valores já criptgrofado checando se o texto nao esta vazio.
  * @param void
  * @return mensagem indicador de erro ou sucesso
  */
 public function set()
 {
     $this->name = Dbcommand::post("name_user");
     $this->login = Dbcommand::post("username_user");
     $this->mail_job = Dbcommand::post("mail_job_user");
     $this->password = Dbcommand::post("password1_user");
     if (empty($this->password) || $this->password !== Dbcommand::post('password2_user')) {
         return "erro_senha";
     } else {
         $this->password = Criptography::Bcrypt($this->password);
     }
     if (!ValidationData::username($this->login) || !ValidationData::mail($this->mail_job) || !ValidationData::name($this->name)) {
         return "erro_campo";
     }
     $this->login = Criptography::BASE64($this->login, 1);
     $result = Dbcommand::select('tb_administradores', array('ADM_LOGIN' => $this->login));
     if (Dbcommand::count_rows($result) > 0) {
         return "campos_cadastrados";
     } else {
         $mail = new Mail();
         // Envia notificacao para o usuario informando que a conta foi ativada
         $mail->name = Dbcommand::post("username_user");
         $mail->mail_job = $this->mail_job;
         $mail->setSave();
         $this->name = Criptography::BASE64($this->name, 1);
         $this->mail_job = Criptography::BASE64($this->mail_job, 1);
         $this->date_in = Criptography::BASE64(date("Y-m-d H:i:s"), 1);
         Dbcommand::insert('tb_administradores', array('ADM_DATA', 'ADM_NOME', 'ADM_SENHA', 'ADM_LOGIN', 'ADM_EMAIL', 'ADM_STATUS'), array($this->date_in, $this->name, $this->password, $this->login, $this->mail_job, $this->status));
         return "sucesso_cadastro";
     }
 }