ok
Direktori : /home/pequenacapitolio/www/administrador/ |
Current File : /home/pequenacapitolio/www/administrador/projeto_detalhe_admin.php |
<?php include '../conexao.php'; function generateRandomString($length = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } // ############# UPDATE informacoes ################### if (isset($_GET["act"]) && $_GET["act"] == "informacoes") { $corpo = $_POST["corpo"]; $cliente = $_POST["cliente"]; $industria = $_POST["industria"]; $sub_b = $_POST["sub_b"]; $tit_t = $_POST["tit_t"]; $editor1 = $_POST["editor1"]; $editor2 = $_POST["editor2"]; $dados_conj = array( 'corpo' => $corpo, 'cliente' => $cliente, 'industria' => $industria, 'sub_b' => $sub_b, 'tit_t' => $tit_t, 'editor1' => $editor1, 'editor2' => $editor2, ); $conn->prepare("UPDATE projetos SET corpo = :corpo, cliente = :cliente, industria = :industria, titulo_bloco = :tit_t, subtitulo_bloco = :sub_b, texto1 = :editor1, texto2 = :editor2 WHERE idprojeto=".$_GET["id"]." ")->execute($dados_conj); $redirect = "/administrador/projeto_detalhe_admin.php?&id=".$_GET["id"].""; header("location:$redirect"); } ?> <!-- ############################################################################## --> <!-- ############################################################################## --> <!-- ############################################################################## --> <!-- ####################### inicio muda fotos ################################### --> <!-- ############################################################################## --> <!-- ############################################################################## --> <!-- ############################################################################## --> <!-- ############################################################################## --> <?php // ############# UPDATE DESTAQUE FOTO ################### if (isset($_GET["act"]) && $_GET["act"] == "foto") { // ################## 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" . $_GET["ft"]; } 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_titulo = array( 'foto' => $_FILES["myfile"]["name"], 'id' => $_GET["id"] ); $conn->prepare("UPDATE projetos SET ". $_GET["ft"] ." = :foto WHERE idprojeto = :id")->execute($dados_titulo); $redirect = "/administrador/projeto_detalhe_admin.php?&id=".$_GET["id"].""; //$redirect = "http://www.tchaudor.com.br/administrador/destaque_admin.php"; header("location:$redirect"); } ?> <!-- ############################################################################## --> <!-- ############################################################################## --> <!-- ####################### fim muda fotos ###################################### --> <!-- ############################################################################## --> <!-- ############################################################################## --> <!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) --> <section class="content-header"> <h1> Editar: <?php $projetosql = $conn->query("SELECT * FROM projetos WHERE idprojeto=".$_GET["id"]." "); $projeto = $projetosql->fetch(PDO::FETCH_OBJ); echo $projeto->cliente; ?> <!-- <small>#007612</small> --> </h1> <!-- <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li> <li><a href="#">Examples</a></li> <li class="active">Invoice</li> </ol> --> </section> <!-- Main content --> <section class="invoice"> <!-- title row --> <!-- <div class="row"> <div class="col-xs-12"> <h2 class="page-header"> <i class="fa fa-globe"></i> AdminLTE, Inc. <small class="pull-right">Date: 2/10/2014</small> </h2> </div> </div> --> <style> .tamanho { padding-left: 0; } .tamanho p { font-size: 16px; } </style> <!-- info row --> <div class="row invoice-info"> <div class="col-sm-12"> <div class="col-sm-12 invoice-col" style="min-height:140px;"> <div class="col-lg-12" style="padding-left: 0; margin-bottom: 20px;"> <div style="display: flex; justify-content: space-between;"> <h3></h3> <a href="#" data-toggle="modal" data-target="#modal-informacoes" class="btn btn-primary btn-flat" style="float:right; margin:20px 0px 20px 20px;;">Atualizar Informações</a> </div> </div> <div class="col-md-4 tamanho"> <!-- <p><strong>Categoria: </strong> <?php if ($projeto->cat_site == 1) { echo "Site. "; } ?> <?php if ($projeto->cat_app == 1) { echo "Aplicativo. "; } ?> <?php if ($projeto->cat_sistema == 1) { echo "Sistema. "; } ?> </p> --> <p><strong>Titulo: </strong><?php echo $projeto->cliente ?></p> <p><strong>Subtitulo: </strong><?php echo $projeto->industria ?></p> <!-- p><strong>Serviços: </strong><?php echo $projeto->servicos ?></p> --> </div> <div class="col-md-8 tamanho"> <!-- <p><strong>Website: </strong><?php echo $projeto->website ?></p> <p><strong>Titulo: </strong><?php echo $projeto->titulo ?></p> --> <p><strong>Corpo: </strong><?php echo $projeto->corpo ?></p> </div> </div> </div> <!-- <script> function habilita(ref, nome){ var onclicker = ref.setAttribute("data-id", nome); var campo = nome; onclick="habilita(this, 'imgrosto')" }</script> --> <div class="col-sm-12"> <div class="col-sm-12 invoice-col" style="min-height:270px;margin-top: 50px;"> <div class="col-sm-12" style="display: flex; justify-content: space-between;padding-left: 0;" > <div class="col-md-2 tamanho"> <div class="col-md-6 tamanho"><p><strong>Superior Esquerda: </strong></p></div> <div class="col-md-5 tamanho" style="margin-top: 5px;"> <a href="#" data-toggle="modal" data-target="#modal-foto1" title="Editar"> <i style="float: right;" class="fas fa-camera"></i> </a> </div> <div class="col-md-12 tamanho"> <img src="uploads/imagens/<?php echo $projeto->imgrosto ?>" style="max-height:100px; border:1px solid #ddd;"> </div> </div> <div class="col-md-2 tamanho"> <div class="col-md-6 tamanho"><p><strong>Inferior Esquerda: </strong></p></div> <div class="col-md-5 tamanho" style="margin-top: 5px;"> <a href="#" data-toggle="modal" data-target="#modal-foto2" title="Editar"> <i style="float: right;" class="fas fa-camera"></i> </a> </div> <div class="col-md-12 tamanho"> <img src="uploads/imagens/<?php echo $projeto->imgbanner ?>" style="max-height:100px; border:1px solid #ddd;"> </div> </div> <div class="col-md-2 tamanho"> <div class="col-md-6 tamanho"><p><strong>Central: </strong></p></div> <div class="col-md-5 tamanho" style="margin-top: 5px;"> <a href="#" data-toggle="modal" data-target="#modal-foto3" title="Editar"> <i style="float: right;" class="fas fa-camera"></i> </a> </div> <div class="col-md-12 tamanho"> <img src="uploads/imagens/<?php echo $projeto->imgbox1 ?>" style="max-height:100px; border:1px solid #ddd;"> </div> </div> <div class="col-md-2 tamanho"> <div class="col-md-6 tamanho"><p><strong>Superior Direita: </strong></p></div> <div class="col-md-5 tamanho" style="margin-top: 5px;"> <a href="#" data-toggle="modal" data-target="#modal-foto4" title="Editar"> <i style="float: right;" class="fas fa-camera"></i> </a> </div> <div class="col-md-12 tamanho"> <img src="uploads/imagens/<?php echo $projeto->imgbox2 ?>" style="max-height:100px; border:1px solid #ddd;"> </div> </div> <div class="col-md-2 tamanho"> <div class="col-md-6 tamanho"><p><strong>Inferior Direita: </strong></p></div> <div class="col-md-5 tamanho" style="margin-top: 5px;"> <a href="#" data-toggle="modal" data-target="#modal-foto5" title="Editar"> <i style="float: right;" class="fas fa-camera"></i> </a> </div> <div class="col-md-12 tamanho"> <img src="uploads/imagens/<?php echo $projeto->imgbox3 ?>" style="max-height:100px; border:1px solid #ddd;"> </div> </div> </div> </div> </div> </div> <!-- /.row --> </section> <!-- /.content --> <div class="clearfix"></div> </div> <!-- /.content-wrapper --> <?php include 'estrutura_rodape.php'; ?> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ########## MODAL ATUALIZAR FOTO ########## --> <div class="modal fade" id="modal-foto1"> <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">Atualizar Foto </h4> </div> <div class="modal-body"> <div class="row"> <form enctype="multipart/form-data" action="projeto_detalhe_admin.php?&ft=imgrosto&id=<?php echo $_GET["id"] ?>&act=foto" method="POST"> <div class="col-xs-12 pad"> <p style="font-size: 16px;"><strong>Foto Destaque</strong></p> <input type="file" name="myfile" id="fileToUpload" class="form-control" required> </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 class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Fechar</button> </div> --> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ########## MODAL ATUALIZAR FOTO ########## --> <div class="modal fade" id="modal-foto2"> <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">Atualizar Foto </h4> </div> <div class="modal-body"> <div class="row"> <form enctype="multipart/form-data" action="projeto_detalhe_admin.php?&ft=imgbanner&id=<?php echo $_GET["id"] ?>&act=foto" method="POST"> <div class="col-xs-12 pad"> <p style="font-size: 16px;"><strong>Foto Destaque</strong></p> <input type="file" name="myfile" id="fileToUpload" class="form-control" required> </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 class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Fechar</button> </div> --> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ########## MODAL ATUALIZAR FOTO ########## --> <div class="modal fade" id="modal-foto3"> <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">Atualizar Foto </h4> </div> <div class="modal-body"> <div class="row"> <form enctype="multipart/form-data" action="projeto_detalhe_admin.php?&ft=imgbox1&id=<?php echo $_GET["id"] ?>&act=foto" method="POST"> <div class="col-xs-12 pad"> <p style="font-size: 16px;"><strong>Foto Destaque</strong></p> <input type="file" name="myfile" id="fileToUpload" class="form-control" required> </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 class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Fechar</button> </div> --> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ########## MODAL ATUALIZAR FOTO ########## --> <div class="modal fade" id="modal-foto4"> <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">Atualizar Foto </h4> </div> <div class="modal-body"> <div class="row"> <form enctype="multipart/form-data" action="projeto_detalhe_admin.php?&ft=imgbox2&id=<?php echo $_GET["id"] ?>&act=foto" method="POST"> <div class="col-xs-12 pad"> <p style="font-size: 16px;"><strong>Foto Destaque</strong></p> <input type="file" name="myfile" id="fileToUpload" class="form-control" required> </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 class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Fechar</button> </div> --> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ########## MODAL ATUALIZAR FOTO ########## --> <div class="modal fade" id="modal-foto5"> <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">Atualizar Foto </h4> </div> <div class="modal-body"> <div class="row"> <form enctype="multipart/form-data" action="projeto_detalhe_admin.php?&ft=imgbox3&id=<?php echo $_GET["id"] ?>&act=foto" method="POST"> <div class="col-xs-12 pad"> <p style="font-size: 16px;"><strong>Foto Destaque</strong></p> <input type="file" name="myfile" id="fileToUpload" class="form-control" required> </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 class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Fechar</button> </div> --> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ################################################################# --> <!-- ##################################################################### ##################################################################### --> <!-- ########## MODAL informacoes ########## --> <div class="modal fade" id="modal-informacoes"> <div class="modal-dialog modal-lg"> <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 informacoes</h4> </div> <div class="modal-body"> <div class="row"> <form action="projeto_detalhe_admin.php?&id=<?php echo $_GET["id"] ?>&act=informacoes" method="POST" enctype="multipart/form-data"> <div class="col-xs-12 pad"> <span>Titulo:</span> <input type="text" name="cliente" class="form-control" value="<?php echo $projeto->cliente ?>"> </div> <div class="col-xs-12 pad"> <span>Subtitulo:</span> <input type="text" name="industria" class="form-control" value="<?php echo $projeto->industria ?>"> </div> <div class="col-xs-12 pad"> <span>Corpo:</span> <input type="text" name="corpo" class="form-control" value="<?php echo $projeto->corpo ?>"> </div> <!-- <div class="col-xs-12 pad"> <span>Subtitulo Bloco Texto:</span> <input type="text" name="sub_b" class="form-control" value="<?php echo $projeto->subtitulo_bloco ?>"> </div> <div class="col-xs-12 pad"> <span>Titulo Bloco Texto:</span> <input type="text" name="tit_t" class="form-control" value="<?php echo $projeto->titulo_bloco ?>"> </div> --> <div class="col-xs-12 pad"> <span>Texto:</span> <textarea id="editor1" name="editor1" rows="10" cols="80"><?php echo $projeto->texto1 ?></textarea> </div> <div class="col-xs-12 pad"> <span>Texto Lado Direito:</span> <textarea id="editor2" name="editor2" rows="10" cols="80"><?php echo $projeto->texto2 ?></textarea> </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() }) $(document).ready(function() { if ($('#site').is(':checked')) { $("#sitehidden").val("1"); }else{ $("#sitehidden").val("0"); } if ($('#app').is(':checked')) { $("#apphidden").val("1"); }else{ $("#apphidden").val("0"); } if ($('#sistema').is(':checked')) { $("#sistemahidden").val("1"); }else{ $("#sistemahidden").val("0"); } }) $("#site").click(function(){ if ($("#sitehidden").val() == "1") { $("#sitehidden").val("0"); }else{ $("#sitehidden").val("1"); } }); $("#app").click(function(){ if ($("#apphidden").val() == "1") { $("#apphidden").val("0"); }else{ $("#apphidden").val("1"); } }); $("#sistema").click(function(){ if ($("#sistemahidden").val() == "1") { $("#sistemahidden").val("0"); }else{ $("#sistemahidden").val("1"); } }); </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> $(function() { // Replace the <textarea id="editor1"> with a CKEditor // instance, using default configuration. CKEDITOR.replace('editor2') //bootstrap WYSIHTML5 - text editor $('.textarea').wysihtml5() }) </script> <script type="text/javascript"> function reloadPage() { location.reload(true); } </script> </body> </html>