ok
Direktori : /home/pequenacapitolio/www/administrador/ |
Current File : /home/pequenacapitolio/www/administrador/perfil_admin.php |
<?php include '../conexao.php'; // ############# UPDATE ENDERECO ################### if (isset($_GET["act"]) && $_GET["act"] == "endereco") { $rua = $_POST["rua"]; $bairro = $_POST["bairro"]; $numero = $_POST["numero"]; $cep = $_POST["cep"]; $dados_conj = array( 'rua' => $rua, 'bairro' => $bairro, 'numero' => $numero, 'cep' => $cep, ); $conn->prepare("UPDATE perfil SET rua = :rua, bairro = :bairro, numero = :numero, cep = :cep WHERE idperfil = 1")->execute($dados_conj); $redirect = "/administrador/perfil_admin.php"; //$redirect = "http://www.tchaudor.com.br/administrador/perfil_admin.php"; header("location:$redirect"); } // ############# UPDATE TELEFONES ################### if (isset($_GET["act"]) && $_GET["act"] == "infos") { $nome = $_POST["nome_empresa"]; $email1 = $_POST["email1"]; $email2 = $_POST["email2"]; $telefone1 = $_POST["telefone1"]; $telefone2 = $_POST["telefone2"]; $whatsapp = $_POST["whatsapp"]; // ################## UPLOAD DE ARQUIVOS (NÃO ME PERGUNTE COMO FUNCIONA, APENAS FUNCIONA) ############### $currentDir = getcwd(); $uploadDirectory = "/uploads/imagens/"; $errors = []; // Store all foreseen and unforseen errors here $fileExtensions = ['jpeg','jpg','png']; // Get all the file extensions $fileName = $_FILES['myfile']['name']; $fileSize = $_FILES['myfile']['size']; $fileTmpName = $_FILES['myfile']['tmp_name']; $fileType = $_FILES['myfile']['type']; $fileExtension = strtolower(end(explode('.',$fileName))); $uploadPath = $currentDir . $uploadDirectory . basename($fileName); if (isset($_POST['submit'])) { if (! in_array($fileExtension,$fileExtensions)) { $errors[] = "Esta extensão de arquivo não é permitida. Por favor, faça o upload de um arquivo JPEG ou PNG"; } if ($fileSize > 2000000) { $errors[] = "Este arquivo tem mais de 2MB. Desculpe, tem que ser menor ou igual a 2MB"; } if (empty($errors)) { $didUpload = move_uploaded_file($fileTmpName, $uploadPath); if ($didUpload) { echo "O Arquivo " . basename($fileName) . " foi enviado"; } else { echo "Um erro ocorreu em algum lugar. Tente novamente ou entre em contato com o administrador"; } } else { foreach ($errors as $error) { echo $error . "Estes são os erros" . "\n"; } } } $dados_conj = array( 'nome' => $nome, 'email1' => $email1, 'email2' => $email2, 'telefone1' => $telefone1, 'telefone2' => $telefone2, 'whatsapp' => $whatsapp, 'foto' => $_FILES["myfile"]["name"], ); if ($_FILES["myfile"]["name"] != "") { $dados_conj = array( 'nome' => $nome, 'email1' => $email1, 'email2' => $email2, 'telefone1' => $telefone1, 'telefone2' => $telefone2, 'whatsapp' => $whatsapp, 'foto' => $_FILES["myfile"]["name"], ); $conn->prepare("UPDATE perfil SET email1 = :email1, email2 = :email2, telefone1 = :telefone1, telefone2 = :telefone2, whatsapp = :whatsapp, nome_empresa = :nome, foto = :foto WHERE idperfil = 1")->execute($dados_conj); }else{ $dados_conj = array( 'nome' => $nome, 'email1' => $email1, 'email2' => $email2, 'telefone1' => $telefone1, 'telefone2' => $telefone2, 'whatsapp' => $whatsapp, ); $conn->prepare("UPDATE perfil SET email1 = :email1, email2 = :email2, telefone1 = :telefone1, telefone2 = :telefone2, whatsapp = :whatsapp, nome_empresa = :nome WHERE idperfil = 1")->execute($dados_conj); } $redirect = "/administrador/perfil_admin.php"; //$redirect = "http://www.tchaudor.com.br/administrador/perfil_admin.php"; header("location:$redirect"); } // ############# UPDATE EMAIL VALIDA ################### if (isset($_GET["act"]) && $_GET["act"] == "emailvalida") { $email_valida = $_POST["email_valida"]; $senha_valida = $_POST["senha_valida"]; $dados_conj = array( 'email_valida' => $email_valida, 'senha_valida' => $senha_valida, ); $conn->prepare("UPDATE perfil SET email_valida = :email_valida, senha_valida = :senha_valida WHERE idperfil = 1")->execute($dados_conj); $redirect = "/administrador/perfil_admin.php"; //$redirect = "http://www.tchaudor.com.br/administrador/perfil_admin.php"; header("location:$redirect"); } // ############# UPDATE REDES SOCIAIS ################### if (isset($_GET["act"]) && $_GET["act"] == "redessociais") { $facebook = $_POST["facebook"]; $instagram = $_POST["instagram"]; $linkedin = $_POST["linkedin"]; $youtube = $_POST["youtube"]; $twitter = $_POST["twitter"]; $dados_conj = array( 'facebook' => $facebook, 'instagram' => $instagram, 'linkedin' => $linkedin, 'youtube' => $youtube, 'twitter' => $twitter, ); $conn->prepare("UPDATE perfil SET facebook = :facebook, instagram = :instagram, linkedin = :linkedin, youtube = :youtube, twitter = :twitter WHERE idperfil = 1")->execute($dados_conj); $redirect = "/administrador/perfil_admin.php"; //$redirect = "http://www.tchaudor.com.br/administrador/perfil_admin.php"; header("location:$redirect"); } // ############# UPDATE OBSERVAÇÔES ################### if (isset($_GET["act"]) && $_GET["act"] == "obs") { $obs = $_POST["editor1"]; $dados_conj = array( 'obs' => $obs, ); $conn->prepare("UPDATE perfil SET observacao = :obs WHERE idperfil = 1")->execute($dados_conj); $redirect = "/administrador/perfil_admin.php"; //$redirect = "http://www.tchaudor.com.br/administrador/perfil_admin.php"; header("location:$redirect"); } ?> <!DOCTYPE html> <html> <head> <?php include 'include_head.php'; ?> </head> <body class="hold-transition skin-blue sidebar-mini"> <!-- Site wrapper --> <div class="wrapper"> <?php include 'estrutura_menu.php'; ?> <!-- =============================================== --> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <div class="col-md-12" style="background: #fff;border-bottom: 1px solid #bbbbbb"> <div class="col-md-12" style="text-align: left;padding-left: 0px"> <p style="color: #040404;font-weight: 700;font-size: 32px;margin-top: 1%;margin-bottom: 0px">Perfil Empresarial</p> </div> <div class="col-md-8" style="height: 34px;padding-left: 0px"> <p style="color: #3a3a3a;font-size: 14px;">Tela Inicial/Perfil Empresarial</p> </div> <div class="col-md-4" style="text-align: right;margin-bottom: 1%"> <!-- <a href="categorias_pagina_admin.php" class="btn btn-primary btn-flat" style="margin-right: 4%">Gerenciar Categorias</a> <a href="#" data-toggle="modal" data-target="#modal-inserir" class="btn btn-primary btn-flat">Inserir Página</a> --> </div> </div> <div class="col-md-12" style="height: 22px"> </div> <?php $sqlperfil = $conn->query("SELECT * FROM perfil WHERE idperfil = 1"); $perfil = $sqlperfil->fetch(PDO::FETCH_OBJ); ?> <section class="content"> <div class="row"> <div class="col-md-3" style="padding-right: 0;"> <!-- Profile Image --> <div class="box box-primary"> <div class="box-body box-profile"> <img class="profile-user-img img-responsive img-circle" src="uploads/imagens/<?php echo $perfil->foto ?>" alt="User profile picture" style="width: 88px; height: 88px; object-fit: cover;"> <h3 class="profile-username text-center"><?php echo $perfil->nome_empresa ?></h3> <ul class="list-group list-group-unbordered"> <li class="list-group-item"> <b>Email 1 </b> <a class=""><?php echo $perfil->email1 ?></a> </li> <li class="list-group-item"> <b>Email 2 </b> <a class=""><?php echo $perfil->email2 ?></a> </li> <li class="list-group-item"> <b>Tel 1 </b> <a class="pull-right"><?php echo $perfil->telefone1 ?></a> </li> <li class="list-group-item"> <b>Tel 2 </b> <a class="pull-right"><?php echo $perfil->telefone2 ?></a> </li> <li class="list-group-item"> <b>Whatsapp </b> <a class="pull-right"><?php echo $perfil->whatsapp ?></a> </li> </ul> <a data-toggle="modal" data-target="#modal-telefones" class="btn btn-primary btn-block"><b>Editar</b></a> </div> <!-- /.box-body --> </div> <!-- /.box --> <!-- Profile Image --> <div class="box box-primary"> <div class="box-body box-profile"> <h3 class="profile-username">Endereço</h3> <ul class="list-group list-group-unbordered"> <li class="list-group-item"> <b>Rua </b> <a class="pull-right"><?php echo $perfil->rua ?></a> </li> <li class="list-group-item"> <b>Nº </b> <a class="pull-right"><?php echo $perfil->numero ?></a> </li> <li class="list-group-item"> <b>Bairro </b> <a class="pull-right"><?php echo $perfil->bairro ?></a> </li> <li class="list-group-item"> <b>Cep </b> <a class="pull-right"><?php echo $perfil->cep ?></a> </li> </ul> <a data-toggle="modal" data-target="#modal-endereco" class="btn btn-primary btn-block"><b>Editar</b></a> </div> <!-- /.box-body --> </div> <!-- /.box --> </div> <!-- /.col --> <div class="col-md-9"> <div class="nav-tabs-custom"> <div class="tab-content box box-primary"> <div class="active tab-pane" id="activity"> <!-- Post --> <div class="post" style="overflow: hidden;"> <!-- /.user-block --> <div class="col-sm-12 invoice-col" style="padding-left: 0; padding-right: 0; min-height:270px;"> <div class="col-lg-11" style="padding-left: 0; padding-right: 0;"> <h3 class="profile-username">Redes Sociais</h3> </div> <div class="col-lg-1"> <a href="#" data-toggle="modal" data-target="#modal-redes-sociais" title="Editar"><i style="margin-top:5px;" class="fas fa-pencil-alt"></i></a> </div> <div class="col-md-12 tamanho"> <p><i style="font-size:18px;" class="fab fa-facebook-square"></i> <?php echo " " . $perfil->facebook . " " ?></p> </div> <div class="col-md-12 tamanho"> <p><i style="font-size:18px;" class="fab fa-instagram"></i> <?php echo " " . $perfil->instagram . " " ?></p> </div> <div class="col-md-12 tamanho"> <p><i style="font-size:18px;" class="fab fa-linkedin"></i> <?php echo " " . $perfil->linkedin . " " ?></p> </div> <div class="col-md-12 tamanho"> <p><i style="font-size:18px;" class="fab fa-youtube"></i> <?php echo " " . $perfil->youtube . " " ?></p> </div> <div class="col-md-12 tamanho"> <p><i style="font-size:18px;" class="fab fa-twitter"></i> <?php echo " " . $perfil->twitter . " " ?></p> </div> </div> </div> <!-- /.post --> </div> </div> <!-- /.tab-content --> </div> <div class="nav-tabs-custom col-md-6" style="background: transparent; box-shadow: none; padding-left: 0;"> <?php $user = $conn->query("SELECT * FROM usuarios order by idusuarios desc"); ?> <!-- Profile Image --> <div class="box box-primary"> <div class="box-body box-profile"> <h3 class="profile-username">Usuários</h3> <ul class="list-group list-group-unbordered"> <?php while ($usuario = $user->fetch(PDO::FETCH_OBJ)) {?> <li class="list-group-item"> <b><?php echo $usuario->nome ?></b> </li> <?php }?> </ul> <a href="usuarios_admin.php" class="btn btn-primary btn-block"><b>Gerenciar</b></a> </div> <!-- /.box-body --> </div> <!-- /.box --> </div> <div class="nav-tabs-custom col-md-6" style="background: transparent; box-shadow: none; padding-right: 0;"> <!-- Profile Image --> <div class="box box-primary"> <div class="box-body box-profile"> <h3 class="profile-username">Autenticação</h3> <ul class="list-group list-group-unbordered"> <li class="list-group-item"> <b>Email </b> <a style="padding-left: 2%" class=""><?php echo $perfil->email_valida ?></a> </li> <li class="list-group-item"> <b>Senha </b> <a style="padding-left: 2%" class=""><input type="password" style="background:transparent; border:none;" value="<?php echo $perfil->senha_valida ?>"></a> </li> </ul> <a data-toggle="modal" data-target="#modal-email-valida" class="btn btn-primary btn-block"><b>Editar</b></a> </div> <!-- /.box-body --> </div> <!-- /.box --> </div> <!-- /.nav-tabs-custom --> </div> <!-- /.col --> <!-- /.col --> <div class="col-md-12"> <div class="nav-tabs-custom"> <div class="tab-content box box-primary"> <div class="active tab-pane" id="activity"> <!-- Post --> <div class="post" style="overflow: hidden;"> <h3 class="profile-username">Observações</h3> <form action="perfil_admin.php?act=obs" method="POST" enctype="multipart/form-data"> <textarea id="editor1" name="editor1" rows="10" cols="80"><?php echo " " . $perfil->observacao . " " ?></textarea> <button type="submit" class="btn btn-primary" style="margin-top:20px;">Salvar</button> </form> </div> <!-- /.post --> </div> </div> <!-- /.tab-content --> </div> </div> <!-- /.col --> </div> <!-- /.row --> </section> <div class="clearfix"></div> </div> <!-- /.content-wrapper --> <?php include 'estrutura_rodape.php'; ?> <!-- ########## MODAL ENDEREÇO ########## --> <div class="modal fade" id="modal-endereco"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span></button> <h4 class="modal-title">Editar Endereço</h4> </div> <div class="modal-body"> <div class="row"> <form action="perfil_admin.php?act=endereco" method="POST" enctype="multipart/form-data"> <div class="col-xs-12 pad"> <span>Rua:</span> <input type="text" name="rua" class="form-control" value="<?php echo $perfil->rua ?>"> </div> <div class="col-xs-12 pad"> <span>Bairro:</span> <input type="text" name="bairro" class="form-control" value="<?php echo $perfil->bairro ?>"> </div> <div class="col-xs-6 pad"> <span>Número:</span> <input type="text" name="numero" class="form-control" value="<?php echo $perfil->numero ?>"> </div> <div class="col-xs-6 pad"> <span>CEP:</span> <input type="text" name="cep" class="form-control" value="<?php echo $perfil->cep ?>"> </div> <div class="col-xs-12 pad"> <button type="submit" class="btn btn-primary" style="margin-top:20px;">Salvar</button> </div> </form> </div> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <!-- ########## MODAL TELEFONES ########## --> <div class="modal fade" id="modal-telefones"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span></button> <h4 class="modal-title">Editar Informações</h4> </div> <div class="modal-body"> <div class="row"> <form enctype="multipart/form-data" action="perfil_admin.php?act=infos" method="POST"> <div class="col-xs-12 pad"> <p style="font-size: 16px;"><strong>Foto</strong></p> <input type="file" name="myfile" id="fileToUpload" class="form-control"> </div> <div class="col-xs-12 pad"> <span>Nome da Empresa:</span> <input type="text" name="nome_empresa" class="form-control" value="<?php echo $perfil->nome_empresa ?>"> </div> <div class="col-xs-12 pad"> <span>Email 1:</span> <input type="text" name="email1" class="form-control" value="<?php echo $perfil->email1 ?>"> </div> <div class="col-xs-12 pad"> <span>Email 2:</span> <input type="text" name="email2" class="form-control" value="<?php echo $perfil->email2 ?>"> </div> <div class="col-xs-12 pad"> <span>Telefone 1:</span> <input type="text" name="telefone1" class="form-control" value="<?php echo $perfil->telefone1 ?>"> </div> <div class="col-xs-12 pad"> <span>Telefone 2:</span> <input type="text" name="telefone2" class="form-control" value="<?php echo $perfil->telefone2 ?>"> </div> <div class="col-xs-12 pad"> <span>Whatsapp:</span> <input type="text" name="whatsapp" class="form-control" value="<?php echo $perfil->whatsapp ?>"> </div> <div class="col-xs-12 pad"> <button type="submit" value="Upload Image" name="submit" class="btn btn-primary" style="margin-top:20px;">Salvar</button> </div> </form> </div> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <!-- ########## MODAL EMAIL VALIDA ########## --> <div class="modal fade" id="modal-email-valida"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span></button> <h4 class="modal-title">Editar Email de Validação</h4> </div> <div class="modal-body"> <div class="row"> <form action="perfil_admin.php?act=emailvalida" method="POST" enctype="multipart/form-data"> <div class="col-xs-12 pad"> <span>Email:</span> <input type="text" name="email_valida" class="form-control" value="<?php echo $perfil->email_valida ?>"> </div> <div class="col-xs-12 pad"> <span>Senha:</span> <input type="password" name="senha_valida" class="form-control" value="<?php echo $perfil->senha_valida ?>"> </div> <div class="col-xs-12 pad"> <button type="submit" class="btn btn-primary" style="margin-top:20px;">Salvar</button> </div> </form> </div> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <!-- ########## MODAL REDES SOCIAIS ########## --> <div class="modal fade" id="modal-redes-sociais"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span></button> <h4 class="modal-title">Editar Redes Sociais</h4> </div> <div class="modal-body"> <div class="row"> <form action="perfil_admin.php?act=redessociais" method="POST" enctype="multipart/form-data"> <div class="col-xs-12 pad"> <i style="font-size:18px; float: left; line-height:34px; margin-right:10px;" class="fab fa-facebook-square"></i> <input style="width:90%;" type="text" name="facebook" class="form-control" value="<?php echo $perfil->facebook ?>"> </div> <div class="col-xs-12 pad"> <i style="font-size:18px; float: left; line-height:34px; margin-right:10px;" class="fab fa-instagram"></i> <input style="width:90%;" type="text" name="instagram" class="form-control" value="<?php echo $perfil->instagram ?>"> </div> <div class="col-xs-12 pad"> <i style="font-size:18px; float: left; line-height:34px; margin-right:10px;" class="fab fa-linkedin"></i> <input style="width:90%;" type="text" name="linkedin" class="form-control" value="<?php echo $perfil->linkedin ?>"> </div> <div class="col-xs-12 pad"> <i style="font-size:18px; float: left; line-height:34px; margin-right:10px;" class="fab fa-youtube"></i> <input style="width:90%;" type="text" name="youtube" class="form-control" value="<?php echo $perfil->youtube ?>"> </div> <div class="col-xs-12 pad"> <i style="font-size:18px; float: left; line-height:34px; margin-right:10px;" class="fab fa-twitter"></i> <input style="width:90%;" type="text" name="twitter" class="form-control" value="<?php echo $perfil->twitter ?>"> </div> <div class="col-xs-12 pad"> <button type="submit" class="btn btn-primary" style="margin-top:20px;">Salvar</button> </div> </form> </div> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <!-- Add the sidebar's background. This div must be placed immediately after the control sidebar --> <div class="control-sidebar-bg"></div> </div> <!-- ./wrapper --> <!-- jQuery 3 --> <script src="bower_components/jquery/dist/jquery.min.js"></script> <!-- Bootstrap 3.3.7 --> <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> <!-- SlimScroll --> <script src="bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script> <!-- FastClick --> <script src="bower_components/fastclick/lib/fastclick.js"></script> <!-- CK Editor --> <script src="bower_components/ckeditor/ckeditor.js"></script> <!-- AdminLTE App --> <script src="dist/js/adminlte.min.js"></script> <!-- AdminLTE for demo purposes --> <script src="dist/js/demo.js"></script> <script> $(document).ready(function() { $('.sidebar-menu').tree() }) </script> <script> $(function() { // Replace the <textarea id="editor1"> with a CKEditor // instance, using default configuration. CKEDITOR.replace('editor1') //bootstrap WYSIHTML5 - text editor $('.textarea').wysihtml5() }) </script> <script type="text/javascript"> function reloadPage() { location.reload(true); } </script> </body> </html>