/** * @brief Function addPhoto * insere no banco uma nova foto, sendo o endereço novo ou o passado como parametro. * @param id_adm do usuario logado * @return mensagem indicador de erro ou sucesso */ public function addPhoto($id_adm) { $name = Photo::getSendName(); /* Guarda diretorio com novo nome e envia a imagem */ if (is_array($name) && array_key_exists('ERRO', $name)) { /* Verificando se eh o nome da imagem ou a mensagem de erro */ return $name['ERRO']; } else { $morephoto = new Photo(); $morephoto->albumName = $this->name; return $morephoto->set($id_adm, Dbcommand::getServer() . $name); } }
/** * @brief Function get * seleciona todos os campos do Banco de dados e retorna os valores das colunas ja descriptografado. * @param void * @return object */ public function get() { $i = 0; $result = Dbcommand::select('tb_servicos', array('ALL'), 'ORDER BY SER_ID DESC'); while ($results = Dbcommand::arrays($result)) { $this->service[$i] = new Service(); $this->service[$i]->setId($results['SER_ID']); $this->service[$i]->setId_adm($results['SER_ID_ADM']); foreach ($results as $key => $value) { $results[$key] = Criptography::BASE64($value, 0); } $this->service[$i]->log = $results['SER_LOG']; $this->service[$i]->date_in = $results['SER_DATA']; $this->service[$i]->name = $results['SER_NOME']; $this->service[$i]->about = str_replace('\\r\\n', ' ', $results['SER_SOBRE']); $this->service[$i]->key = $results['SER_CHAVE']; $i++; } $this->size = $i; return $this; }
/** * @brief Function get * seleciona todos os campos do Banco de dados e retorna os valores das colunas ja descriptografado. * @param void * @return void */ public function get() { $i = 0; $result = Dbcommand::select('tb_emails', array('ALL'), 'ORDER BY EM_ID DESC'); while ($results = Dbcommand::arrays($result)) { $this->mail[$i] = new Mail(); $this->mail[$i]->setId($results['EM_ID']); $this->mail[$i]->status = $results['EM_STATUS']; foreach ($results as $key => $value) { $results[$key] = Criptography::BASE64($value, 0); } $this->mail[$i]->date_in = $results['EM_DATA']; $this->mail[$i]->name = $results['EM_NOME']; $this->mail[$i]->mail_job = $results['EM_EMAIL']; $this->mail[$i]->title = $results['EM_ASSUNTO']; $this->mail[$i]->message = str_replace('\\r\\n', ' ', $results['EM_MENSAGEM']); $this->mail[$i]->phone = $results['EM_TEL']; $i++; } $this->size = $i; return $this; }
/** * @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"; } }
<footer class="footer"> <script src="http://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script> <script src="<?php echo Dbcommand::getServer(); ?> /components/js/responsive.js" type="text/javascript"></script> <script src="<?php echo Dbcommand::getServer(); ?> /components/ckeditor/ckeditor.js" type="text/javascript"></script> <!-- <div class="container"> <p class="pull-right"><a href="#">Voltar ao topo</a></p> <p> <?php echo $company->getName(); ?> | Desenvolvido por <a href="http://www.ejectufrn.com.br" target="_blank">EJECT</a>.</p> <!-- Links Rodape -- <ul class="footer-links"> <li><a href="http://blog.getbootstrap.com">Blog</a></li> <li class="muted">·</li> <li><a href="https://github.com/twitter/bootstrap/issues?state=open">Issues</a></li> <li class="muted">·</li> <li><a href="https://github.com/twitter/bootstrap/wiki">Roadmap e changelog</a></li> </ul> // Links Rodape -- </div--> </footer> <!-- //Fim Rodape --> </body> </html>
} else { /* ============= Editar nome e/ou foto =============== */ $i = (int) Dbcommand::get('up') - 1; /* Guarda o indice que foi passado pelo get do nome e foto a ser editado */ if (@$_POST) { if ($_FILES['photo']['name'] != '') { /* Atualiza apenas o nome e foto nova */ $name = Photo::getSendName(); /* Guarda diretorio com novo nome */ if (is_int($name)) { /* Verificando se eh o nome da imagem ou a mensagem de erro (inteiro) */ header("Location: view.php?up=" . ($i + 1) . "&msg=" . $name); } else { unlink("../" . $banner->photo[$i]->getDir()); /* Deletando arquivo em "../components/img" */ header("Location: view.php?up=" . ($i + 1) . "&msg=" . $banner->photo[$i]->update($user->getId(), Dbcommand::getServer() . $name)); /* Adiciona nova foto com novo endereco */ } } else { /* Atualiza apenas o nome passando a url antiga */ header("Location: view.php?up=" . ($i + 1) . "&msg=" . $banner->photo[$i]->update($user->getId(), $banner->photo[$i]->url)); } } ?> <!-- Banner --> <div class="col-xs-12 col-sm-10"> <div class="jumbotron"> <a href="./"><h1>Banners</h1></a> <br/> <?php echo Message::get();
<a href="<?php echo Dbcommand::getServer(); ?> /contato" class="list-group-item <?php echo Dbcommand::getTitle() == 'contato' ? 'selected' : ''; ?> ">Contato</a> <a href="<?php echo Dbcommand::getServer(); ?> /emails" class="list-group-item <?php echo Dbcommand::getTitle() == 'emails' ? 'selected' : ''; ?> ">Emails</a> <a href="<?php echo Dbcommand::getServer(); ?> /links" class="list-group-item <?php echo Dbcommand::getTitle() == 'links' ? 'selected' : ''; ?> ">Links</a> </div> </div> <!-- // Fim Menu lateral --> <?php } /* </div> </div> </body> </html> */
die('<a href="./" class="btn btn-primary">Voltar</a> <p>Senhas diferem uma da outra. Volte e digite seu email novamente para reiniciar a recuperação de senha.</p>'); } } } if (empty($_GET['utilizador']) || empty($_GET['confirmacao'])) { echo die('<a href="./" class="btn btn-primary">Voltar</a> <p>Não é possível alterar a password: dados em falta</p>'); //header("Location: ./"); } @($user = $_GET['utilizador']); @($hash = $_GET['confirmacao']); $results = Dbcommand::select("tb_recuperacao", array("REC_ADM" => $user, 'REC_CONFIRMACAO' => $hash)); if (Dbcommand::count_rows($results) > 0) { //os dados estão corretos: eliminar o pedido e permitir alterar a password Dbcommand::delete("tb_recuperacao", array('REC_ADM' => $user, 'REC_CONFIRMACAO' => $hash)); ?> <div class="container"> <div class="row"> <div class="col-xs-12 col-sm-10"> <div class="jumbotron"> <a href="./"><h1>Recuperar de Senha</h1></a> <br/> <?php echo Message::get(); ?> <form action="recuperar.php" method="post"> <fieldset> <div>Nova Senha <input type="password" name="password1_rec" class="form-control" required>
<?php include '../header.php'; if ((int) Dbcommand::get('del') > 0 && (int) Dbcommand::get('del') <= $company->links->size) { $i = Dbcommand::get('del') - 1; $company->links->link[$i]->get(); for ($j = 0; $j < $company->links->link[$i]->album->size; $j++) { unlink("../" . $company->links->link[$i]->album->photo[$j]->getDir()); /* Deletando arquivo em "../components/img" */ } header("Location: index.php?msg=" . $company->links->link[$i]->delete()); // Deletando registro } if (@$_POST) { header("Location: index.php?msg=" . $company->links->addLink($user->getId())); } ?> <!-- Links --> <div class="col-xs-12 col-sm-10"> <div class="jumbotron"> <a href="./"><h1>Links</h1></a> <br /> <?php echo Message::get(); ?> <form enctype="multipart/form-data" action="index.php" method="post"> <fieldset> <div> <h4>Nome:</h4> <input type='text' name='name_link' class="form-control" placeholder="Nome" pattern="^[^<>]{0,255}$" required/>
/** * @brief Function verifyAccess * verifica se o tempo de sessão do usuario expirou. * @param void * @return void */ public function verifyAccess() { session_start(); if (!isset($_SESSION['usuario_logado'])) { header("location: " . Dbcommand::getServer() . "/login.php?msg=entrada_usuario"); } else { $this->id = $_SESSION['usuario_logado']; $registro = $_SESSION['registro']; $limite = $_SESSION['limite']; if ($registro) { // verifica se a session registro esta ativa $segundos = time() - $registro; } // fim da verificacao da session registro /* verifica o tempo de inatividade se ele tiver ficado mais do tempo limite sem atividade ele destroi a session se nao ele renova o tempo e ai eh contado mais o tempo limite */ if ($segundos > $limite) { session_destroy(); echo "<script>alert('" . utf8_decode("Sua sessão expirou, favor logar novamente!") . "');\n location.reload()</script>"; die; //destroi pagina para que nao carregue } else { $_SESSION['registro'] = time(); } // fim da verificacao de inatividade } }
/** * @brief Function post * trata os dados passado pelo POST daquele campo retornando uma string anti SQL injection. * @param string * @return string */ public static function post($name) { $name = @$_POST[$name]; $name = Dbcommand::anti_injection($name); return $name; }
<div> <input type='password' id='password1' name='password1_user' class="form-control" placeholder="Senha" required/> </div> <div> <input type='password' id='password2' name='password2_user' class="form-control" placeholder="Confirme a senha" required/> </div> <a href="../" class="btn btn-primary pull-left">Voltar</a> <button type="submit" class="btn btn-primary pull-right" >Cadastrar</button> <button type="reset" class="btn btn-primary pull-right" >Cancelar</button> <br /> </fieldset> </form> </div> </div> </div> </div> <?php // Se cadastrado com sucesso, pergunta se pode redirecionar pro Login if (Dbcommand::get("msg") == 6) { ?> <script> var goLogin = confirm("Cadastrado com Sucesso! \nDeseja Logar-se?"); if (goLogin){ location.href="../"; } </script> </body> </html> <?php }
/** * @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; }
<div class="col-xs-12 col-sm-10"> <div class="jumbotron"> <a href="./"><h1>Emails</h1></a> <br/> <?php echo Message::get(); ?> <p>Você tem <?php echo $user->mails->size; ?> mensagens.</p> <br/> <?php if ((int) Dbcommand::get('up') > 0 && (int) Dbcommand::get('up') <= $user->mails->size) { $i = Dbcommand::get('up') - 1; $user->mails->mail[$i]->setStatus(); $user->mails->get(); ?> <div> <p>Nome: <?php echo $user->mails->mail[$i]->name; ?> </p> </div> <div> <p>Email: <?php echo $user->mails->mail[$i]->mail_job; ?> </p>
/** * @brief Function setStatus * seta o status do usuario. * @param void * @return mensagem indicador de erro ou sucesso */ public function setStatus() { /* if ($this->status == 1) { Dbcommand::update('tb_emails', array('EM_STATUS' => 0), array('EM_ID' => $this->id)); } else { ============ Usar depois pra botao "marcar como lido" ======== */ Dbcommand::update('tb_emails', array('EM_STATUS' => 0), array('EM_ID' => $this->id)); return "sucesso_alterar_dados"; }
<?php $no_need_login = true; $no_visible_elements = true; include "../header.php"; @session_destroy(); if (Dbcommand::post("email")) { $mail = new Mail(); header("Location: index.php?msg=" . $mail->setRecovery()); } ?> <div class="container"> <div class="row"> <div class="col-xs-12 col-sm-10"> <div class="jumbotron"> <a href="../"><h1>Recuperar Senha</h1></a> <br/> <?php echo Message::get(); ?> <form action="#" method="post"> <fieldset> <div>Email profissional: <input type='email' name='email' class="form-control" placeholder="Digite seu email" required/> </div> <br/> <button type="submit" class="btn btn-primary pull-right" >Recuperar Senha</button> <a href="../" class="btn btn-primary">Voltar</a> <br/> </fieldset>
<?php $no_need_login = true; $no_visible_elements = true; include '../header.php'; $banner = new Album('empresa'); /* ============= Deletar imagem =============== */ if ((int) Dbcommand::get('del')) { for ($i = 0; $i < $banner->size; $i++) { unlink(".." . $banner->photo[$i]->getDir()); // Deletando arquivo em "../components/img" header("Location: admin.php?msg=" . $banner->photo[$i]->delete()); // Deletando registro } } /* ============= Adicionar imagem =============== */ if (@$_POST) { $company->setName(); header("Location: admin.php?msg=" . $banner->addPhoto($user->getId())); } ?> <div class="container"> <div class="row"> <div class="col-xs-12 col-sm-10"> <div class="jumbotron"> <a href="../"><h1>Logomarca</h1></a> <br/> <?php echo Message::get(); ?>
/** * @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"; } }
$i = Dbcommand::get('up') - 1; $company->links->link[$i]->get(); if (@$_POST) { if ($_FILES['photo']['name'] != '') { /* Atualiza apenas o nome e foto nova */ $name = Photo::getSendName(); /* Guarda diretorio com novo nome */ if (is_int($name)) { /* Verificando se eh o nome da imagem ou a mensagem de erro (inteiro) */ header("Location: view.php?up=" . ($i + 1) . "&msg=" . $name); } else { for ($j = 0; $j < $company->links->link[$i]->album->size; $j++) { unlink(".." . $company->links->link[$i]->album->photo[$j]->getDir()); /* Deletando arquivo em "../components/img" */ } header("Location: view.php?up=" . ($i + 1) . "&msg=" . $company->links->link[$i]->update($user->getId(), Dbcommand::getServer() . $name)); } } else { /* Atualiza apenas o nome passando a url antiga */ header("Location: view.php?up=" . ($i + 1) . "&msg=" . $company->links->link[$i]->update($user->getId())); } } ?> <!-- Links --> <div class="col-xs-12 col-sm-10"> <div class="jumbotron"> <a href="./"><h1>Links</h1></a> <br/> <?php echo Message::get(); ?>
<?php include '../header.php'; $banner = new Album('banner'); /* ============= Deletar imagem =============== */ if ((int) Dbcommand::get('del') > 0 && (int) Dbcommand::get('del') <= $banner->size) { unlink(".." . $banner->photo[Dbcommand::get('del') - 1]->getDir()); /* Deletando arquivo em "../components/img" */ header("Location: index.php?msg=" . $banner->photo[Dbcommand::get('del') - 1]->delete()); /* Deletando registro do banco */ } /* ============= Adicionar imagem =============== */ if (@$_POST) { header("Location: index.php?msg=" . $banner->addPhoto($user->getId())); } ?> <!-- Banner --> <div class="col-xs-12 col-sm-10"> <div class="jumbotron"> <a href="./"><h1>Banners</h1></a> <br/> <?php echo Message::get(); ?> <form enctype="multipart/form-data" action="index.php" method="post"> <fieldset> <div> <h4>Nome:</h4> <input type='text' name='name_photo' class="form-control" placeholder="Digite o Nome do Banner" pattern="^[^<>]{0,255}$" required/> </div>
<?php include '../header.php'; $clients = new Album('clientes'); /* ============= Deletar imagem =============== */ if ((int) Dbcommand::get('del') > 0 && (int) Dbcommand::get('del') <= $clients->size) { unlink(".." . $clients->photo[Dbcommand::get('del') - 1]->getDir()); /* Deletando arquivo em "../components/img" */ header("Location: ./?msg=" . $clients->photo[Dbcommand::get('del') - 1]->delete()); /* Deletando registro do banco */ } /* ============= Adicionar imagem =============== */ if (@$_POST) { header("Location: ./?msg=" . $clients->addPhoto($user->getId())); } ?> <!-- Portfolio --> <div class="col-xs-12 col-sm-10"> <div class="jumbotron"> <a href="./"><h1>Portfólio</h1></a> <br/> <?php echo Message::get(); ?> <form enctype="multipart/form-data" action="index.php" method="post"> <fieldset> <div> <h4>Nome:</h4> <input type='text' name='name_photo' class="form-control" placeholder="Digite o Nome do Cliente" pattern="^[^<>]{0,255}$" required/> </div>