Ejemplo n.º 1
0
 /**
  * @brief Function setContact
  *      seta as informaoes de contato nas suas variaveis do banco de dados.
  * @param id_adm do usuario logado
  * @return mensagem indicador de erro ou sucesso
  */
 public function setContact($id_adm)
 {
     $this->id_adm = $id_adm;
     $this->adress = Dbcommand::post("adress_corporation");
     $this->zip = Dbcommand::post("zip_corporation");
     $this->square = Dbcommand::post("square_corporation");
     $this->city = Dbcommand::post("city_corporation");
     $this->state = Dbcommand::post("state_corporation");
     $this->country = Dbcommand::post("country_corporation");
     $this->phone1 = Dbcommand::post("phone1_corporation");
     $this->phone2 = Dbcommand::post("phone2_corporation");
     $this->mail = Dbcommand::post("mail_corporation");
     if (empty($this->adress) || empty($this->square) || empty($this->city) || empty($this->state) || empty($this->country)) {
         return "erro_campos";
     } elseif (!ValidationData::cep($this->zip) || !ValidationData::mail($this->mail) || !ValidationData::phone($this->phone1) || !ValidationData::phone($this->phone2) || !ValidationData::text($this->square) || !ValidationData::text($this->city) || !ValidationData::text($this->state) || !ValidationData::text($this->country) || !ValidationData::text($this->adress)) {
         return "erro_campo";
     } else {
         $this->adress = Criptography::BASE64($this->adress, 1);
         $this->city = Criptography::BASE64($this->city, 1);
         $this->country = Criptography::BASE64($this->country, 1);
         $this->mail = Criptography::BASE64($this->mail, 1);
         $this->square = Criptography::BASE64($this->square, 1);
         $this->phone1 = Criptography::BASE64($this->phone1, 1);
         $this->phone2 = Criptography::BASE64($this->phone2, 1);
         $this->state = Criptography::BASE64($this->state, 1);
         $this->zip = Criptography::BASE64($this->zip, 1);
         $this->log = Criptography::BASE64(date("Y-m-d H:i:s"), 1);
         Dbcommand::update('tb_empresa', array('EMP_ID_ADM' => $this->id_adm, 'EMP_DATA' => $this->log, 'EMP_END' => $this->adress, 'EMP_CEP' => $this->zip, 'EMP_BAIRRO' => $this->square, 'EMP_CIDADE' => $this->city, 'EMP_ESTADO' => $this->state, 'EMP_PAIS' => $this->country, 'EMP_TEL1' => $this->phone1, 'EMP_TEL2' => $this->phone2, 'EMP_EMAIL' => $this->mail), array('EMP_ID' => $this->id));
         return "sucesso_alterar_dados";
     }
 }
Ejemplo n.º 2
0
 /**
  * @brief Function setIndex
  *      envia o email do usuario na index do site
  * @param void
  * @return mensagem indicador de erro ou sucesso
  */
 public function setIndex()
 {
     if (@$_POST) {
         $this->name = Dbcommand::post('name');
         $this->mail_job = Dbcommand::post('mail');
         $this->phone = Dbcommand::post('phone');
         $this->title = Dbcommand::post('title');
         $this->message = Dbcommand::post('message');
         if (empty($this->name) || empty($this->mail_job) || empty($this->message) || empty($this->title)) {
             echo "<script> window.alert('Campo vazio!!') </script>\n\t              <script> window.location = 'index.php'; </script>";
             die;
         }
         if (!ValidationData::name($this->name) || !ValidationData::mail($this->mail_job) || !ValidationData::text($this->message) || !ValidationData::text($this->title)) {
             echo "<script> window.alert('Campo em formato inv&aacute;lido!!') </script>\n                \t<script> window.location = 'index.php'; </script>";
             die;
         } else {
             $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->from, $this->name);
             // Sera pra propria
             $mail->AddCC($this->mail_job, "C&oacute;pia | " . $this->fromName);
             // Copia pro Usuario
             $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;
             $mail->AltBody = trim(strip_tags($this->message));
             // A mesma mensagem em texto puro
             $sended = $mail->Send();
             // Envia o e-mail
             $mail->ClearAllRecipients();
             // Limpa os destinatarios e os anexos
             $this->name = Criptography::BASE64($this->name, 1);
             $this->mail_job = Criptography::BASE64($this->mail_job, 1);
             $this->phone = Criptography::BASE64($this->phone, 1);
             $this->title = Criptography::BASE64($this->title, 1);
             $this->message = Criptography::BASE64($this->message, 1);
             $this->date_in = Criptography::BASE64(date("Y-m-d H:i:s"), 1);
             Dbcommand::insert('tb_emails', array('EM_NOME', 'EM_EMAIL', 'EM_ASSUNTO', 'EM_MENSAGEM', 'EM_DATA', 'EM_TEL', 'EM_STATUS'), array($this->name, $this->mail_job, $this->title, $this->message, $this->date_in, $this->phone, $this->status));
             if ($sended) {
                 echo "<script> window.alert('Mensagem enviada com Sucesso') </script>\n                    \t <script> window.location = 'index.php'; </script>";
             } else {
                 echo "<script> window.alert('Nao foi poss&iacute;vel enviar o e-mail,\n                            mas ele podera ser visto pelo Administrador do Site.') </script>\n                            <script> window.location = 'index.php'; </script>";
             }
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * @brief Function update
  *      seleciona todos os campos do Banco de dados e retorna os valores das colunas ja descriptografado, aceita nome da foto vazio.
  * @param  id_adm do usuario logado
  * @param url da imagem
  * @return mensagem indicador de erro ou sucesso
  */
 public function update($id_adm, $url = '')
 {
     $this->id_adm = $id_adm;
     $this->name = Dbcommand::post("name_photo");
     if ($url != '') {
         $this->url = $url;
     }
     if (!empty($this->name) && !ValidationData::text($this->name)) {
         return "erro_campo";
     } else {
         $this->name = Criptography::BASE64($this->name, 1);
         $this->url = Criptography::BASE64($this->url, 1);
         $this->albumName = Criptography::BASE64($this->albumName, 1);
         $this->log = Criptography::BASE64(date("Y-m-d H:i:s"), 1);
         Dbcommand::update('tb_fotos', array('FOTO_ID_ADM' => $this->id_adm, 'FOTO_LOG' => $this->log, 'FOTO_NOME' => $this->name, 'FOTO_NOME_ALBUM' => $this->albumName, 'FOTO_URL' => $this->url), array('FOTO_ID' => $this->id));
         return "sucesso_alterar_dados";
     }
 }
Ejemplo n.º 4
0
 /**
  * @brief Function update
  *       atualiza os valores no Banco de dados e criptografa caso ainda nao esteja.
  * @param id_adm do usuario logado
  * @param url da imagem
  * @return mensagem indicador de erro ou sucesso
  */
 public function update($id_adm, $url = 1)
 {
     $this->id_adm = $id_adm;
     $this->name = Dbcommand::post("name_link");
     $this->about = Dbcommand::post("about_link");
     $this->url = Dbcommand::post('url_link');
     for ($i = 0; $i < $this->album->size; $i++) {
         $this->album->photo[$i]->update($this->id_adm, $url);
     }
     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->log = Criptography::BASE64(date("Y-m-d H:i:s"), 1);
         Dbcommand::update('tb_links', array('LINK_ID_ADM' => $this->id_adm, 'LINK_LOG' => $this->log, 'LINK_NOME' => $this->name, 'LINK_SOBRE' => $this->about, 'LINK_URL' => $this->url), array('LINK_ID' => $this->id));
         return "sucesso_alterar_dados";
     }
 }