Acesso restrito a membros do fórum nas páginas HTML

3 participantes

Ver o tópico anterior Ver o tópico seguinte Ir para baixo

Tópico resolvido Acesso restrito a membros do fórum nas páginas HTML

Mensagem por Rike100 06.02.22 19:39

Detalhes da questão


Endereço do fórum: https://centrorevo.forumeiros.com
Versão do fórum: ModernBB

Descrição


Existe algum JavaScript que impede a pessoa de acessar HTML ou as coisas do fórum sem está conectado a ele?
Acesso restrito a membros do fórum nas páginas HTML J8GUcUPaCVpdAAAAABJRU5ErkJggg==


Última edição por Rike100 em 06.02.22 21:52, editado 1 vez(es)
Rike100

Rike100
*

Membro desde : 20/06/2020
Mensagens : 47
Pontos : 84

https://www.policiacrn.com

Ir para o topo Ir para baixo

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por Musashi 06.02.22 19:56

Fórum inexistente


O seu fórum encontra-se inativo ou não existe. Para prosseguirmos com este tópico, pedimos que atualize o link com o de um fórum existente. Caso não o faça em 2 dias, o tópico será movido para a lixeira.

Tópico pendente.
Musashi

Musashi
Membro

Membro desde : 17/02/2021
Mensagens : 588
Pontos : 762

https://luciothemes.forumeiros.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por Rike100 06.02.22 21:53

Wusthy escreveu:

Fórum inexistente


O seu fórum encontra-se inativo ou não existe. Para prosseguirmos com este tópico, pedimos que atualize o link com o de um fórum existente. Caso não o faça em 2 dias, o tópico será movido para a lixeira.

Tópico pendente.

Feito: https://centrorevo.forumeiros.com/
Rike100

Rike100
*

Membro desde : 20/06/2020
Mensagens : 47
Pontos : 84

https://www.policiacrn.com

Ir para o topo Ir para baixo

  • 0

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por Musashi 07.02.22 0:15

Boa noite @Rike100

Veja se o seguinte tópico irá salientar sua dúvida: https://ajuda.forumeiros.com/t26644-faq-restringir-imagens-e-links-de-um-forum Muito feliz
Musashi

Musashi
Membro

Membro desde : 17/02/2021
Mensagens : 588
Pontos : 762

https://luciothemes.forumeiros.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por Rike100 07.02.22 17:41

Eu olhei... Mas o que eu quero é restringir literalmente é no HTML.
Rike100

Rike100
*

Membro desde : 20/06/2020
Mensagens : 47
Pontos : 84

https://www.policiacrn.com

Ir para o topo Ir para baixo

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por Musashi 07.02.22 21:10

Boa tarde @Rike100!

Adicione o seguinte Código Javascript em seu HTML:

Código:
<script>
jQuery(function () {if (_userdata.user_id === -1) {
$('body').remove();window.location = "/login";
  alert("Formulário permitido somente para membros!");
  };
});
</script>
Musashi

Musashi
Membro

Membro desde : 17/02/2021
Mensagens : 588
Pontos : 762

https://luciothemes.forumeiros.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por Rike100 10.02.22 21:34

Boa tarde @Musashi

Não funcionou... Meu HTML é esse.

Código:
<html><head>

  <link rel="icon" href="https://i.servimg.com/u/f39/20/15/55/03/oie_kz10.png">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Polícia CNI: Instrução Inicial</title>
    

  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css">
  <style type="text/css">
    *,
    *::before,
    *::after {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    html,
    body {
      height: 100%;
    }

    body {
      font-size: 17px;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
      font-weight: normal;
      line-height: 1.5;
      color: #212121;
      line-height: 1.5;
      }

    /**
     * Begin tipografia.
     */

    a,
    a:active,
    a:link,
    a:visited,
    a:focus {
      color: #2688dc;
      text-decoration: none;
      border-bottom: solid 1px transparent;
      outline: 0;
    }

    a:hover {
      border-bottom-color: #2688dc;
    }

    a.fa:hover {
      border-bottom-color: transparent;
      color: #1f6db0;
    }
    
    h3 {
      font-size: 20px;
      font-weight: 300;
      margin-bottom: 10px;
      display: block;
      width: 100%;
      padding-bottom: 3px;
      border-bottom: 2px solid #375e7f;
    }
    
    textarea {
      height: 90px;
      box-sizing: border-box;
      resize: vertical;
      outline: none;
    }

    .btn {
      border: solid 1px #e4e4e4;
      background: linear-gradient(180deg, #fff 0%, #efefef 100%);
      padding: .575rem 1.1rem;
      border-radius: .175rem;
      font-weight: 600;
      color: #686a6b;
      cursor: pointer;
      display: block;
      text-align: center;
      margin-bottom: 5px;
      width: 100%;
    }

    .btn:focus {
      border-color: #375e7f;
      box-shadow: inset 0 -5px 40px rgba(120, 120, 120, 0.1), inset 0 1px 2px rgba(27, 31, 35, 0.075), 0 0 0 0.2em rgba(0, 0, 0, 0.1);
      outline: none;
    }

    .btn:hover {
      box-shadow: inset 0 -100px rgba(108, 108, 108, 0.1);
    }

    .btn.btn-primary {
       border-radius: 3px;
       box-shadow: none;
       color: #fff;
       background: #4dbd6be0;
       font-size: 14px;
       transition: linear all 125ms;
       margin-top: 32%;
       }
       .btn.btn-primary:focus {
       border-color: #5bb15f94;
       box-shadow: inset 0 1px 2px rgba(39, 56, 28, 0.075), 0 0 0 0.2em rgba(39, 56, 28, 0.6);
       outline: none;
       }

    .btn.btn-primary:hover {
      background: #338148e0;
      transition: .6s;
    }
    
    .btn.btn-success {
      color: #fff;
      background: #4a934a;
      border: 0;
    }

    .btn.btn-success:focus {
      border-color: #408140;
      box-shadow: inset 0 1px 2px rgba(92, 184, 92, 0.075), 0 0 0 0.2em rgba(55, 110, 55, 0.66);
      outline: none;
    }

    .btn.btn-success:hover, .btn.btn-danger:hover{
        border: 0;
        background: #444;
    }

    .btn.btn-danger {
      border: 0;
      color: #fff;
      background: #e7592e;
      width: auto;
      display: inline-block;
      padding: 5px 7px;
      margin: 5px;
    }

    .btn.btn-danger:focus {
      border-color: #aa2c05;
      box-shadow: inset 0 1px 2px rgba(27, 31, 35, 0.075), 0 0 0 0.2em rgba(197, 53, 9, 0.66);
      outline: none;
    }

    .btn-progress {
      cursor: not-allowed;
      opacity: .657;
    }

    .form-control {
      background-color: #fff;
      border: 1px solid #d4d4d4;
      padding: 6px 8px;
      margin: 5px 0 0;
      display: block;
      width: 100%;
      font-size: 16px;
      color: #555;
      line-height: 20px;
      border-radius: 3px;
      box-shadow: inset 0 1px 2px rgba(27, 31, 35, 0.075);
      outline: none;
    }

    .form-control:focus {
      border-color: #375e7f;
      box-shadow: inset 0 1px 2px rgba(75, 107, 53, 0.075), 0 0 0 0.2em rgba(75, 107, 53, 0.6);
      outline: none;
    }
    
    input[type="text"]:disabled {
      background: #dddddd;
      cursor: not-allowed;
    }
    
    .card {
      background-color: #E54732;
      padding: 5px;
      font-size: 10px;
      color: #fff;
      font-weight: 800;
      border-radius: 5px;
      float: left;
      margin-right: 5px;
    }


    /*
     * End tipografia.
     **/

    .wrapper {
      width: 50%;
      position: absolute;
      top: 5%;
      left: 50%;
      -webkit-transform: translateX(-50%);
      -moz-transform: translateX(-50%);
      -ms-transform: translateX(-50%);
      -o-transform: translateX(-50%);
      transform: translateX(-50%);
    }

    .wrapper hgroup {
      text-align: center;
    }

    .wrapper hgroup i.fa {
      font-size: 4em;
    }

    .wrapper hgroup h1 {
      font-weight: 300;
      margin: 10px 0;
      padding: 0;
      color: #545454;
    }

    .wrapper form {
      border: solid 1px #d4d4d4;
      margin: 0 0 25px;
      padding: 20px;
      color: #555;
      border-radius: 4px;
      background-color: #fff;
    }
    
    .wrapper form .form-group {
      width: 100%;
      float: left;
    }

    .wrapper form .form-group label {
      display: table;
    }

    .wrapper form .form-group .form-group-col {
      float: left;
      margin-right: 2%;
      margin-top: 2%;
    }
    
    .form-group .form-group-col:first-child {
      margin-left: 3%;
    }

    .wrapper footer {
      border: solid 1px #d6d6d6;
      border-radius: 3px;
      padding: 13px;
      text-align: center;
      font-size: 16px;
      color: #555;
      margin-bottom: 2%;
    }
    
    .col-94 {
      width: 94%;
    }
    
    .col-85 {
      width: 85%;
      display: inline-block;
    }
    
    .col-46 {
      width: 46%;
    }
    
    .col-30 {
      width: 30%;
    }

    /**
     * FOR JS Styles:
     */

    #login-form,
    footer {
      box-shadow: 3px 3px 2px 0px rgba(0, 0, 0, 0.16);
    }

    .title h2 {
      font-weight: 300;
      margin-bottom: 5px;
      text-align: center;
    }
    .title h4 {
      font-weight: 300;
      margin-bottom: 15px;
      text-align: center;
    }

    @media screen and (max-width: 900px) {
      .wrapper {
        width: 40%;
      }
    }

    @media screen and (max-width: 600px) {
      .wrapper {
        width: 70%;
      }
    }

    @media screen and (max-width: 500px) {
      .wrapper {
        width: 80%;
      }
    }

    @media screen and (max-width: 400px) {
      .wrapper {
        width: 90%;
      }
    }
  </style>
</head>
<body>
  <main class="wrapper">

    <hgroup>
      <h1><img src="https://i.servimg.com/u/f39/20/15/55/03/oie_kz11.png"/></h1>
    </hgroup>

    <form id="form-content">
      <div class="title">
        <h2>Instrução Inicial</h2>
      </div>
      <h3>Dados da aula</h3>
      <div class="form-group">
        <div class="form-group-col col-30">
          <label for="date">Data da aula:</label>
          <input type="text" id="date" class="form-control" placeholder="DD MMM AAAA" maxlength="11" required="" disabled="">
        </div>
        <div class="form-group-col col-30">
          <label for="instrutor">Nickname instrutor:</label>
          <input type="text" id="instrutor" class="form-control" placeholder="Ex: :.Dre.Duck.:" required="">
        </div>
        <div class="form-group-col col-30">
          <label for="tag">TAG instrutor:</label>
          <input type="text" id="tag" class="form-control" placeholder="Ex: Dck" maxlength="3" required="">
        </div>
      </div>
      <div class="form-group">
        <div class="form-group-col col-94 cloneField">
          <label for="aluno">Aluno(s):</label>
          <a href="javascript:void(0)" class="btn btn-success addMore"><span class="fas fa-plus" aria-hidden="true"></span> Adicionar</a>
          <input type="text" id="aluno" class="form-control alunos" placeholder="Nickname do aluno">
        </div>
      </div>
      
      <br><br><br><br>
      <button type="submit" class="btn btn-primary">Enviar Formulário</button>

    </form>

  </main>
  
  <script>
    var instance = new Date();
  
    var month =["Jan","Fev","Mar", "Abr","Mai","Jun", "Jul","Ago","Set", "Out","Nov","Dez"];
    
    var day = (!! instance.getDate().toString()[1]) ? instance.getDate() : '0' + instance.getDate();
    var month_index = instance.getMonth();
    var year = instance.getFullYear();
    
    var date = [ day, month[month_index], year ].join(" ");
    
    document.getElementById('date').value = date;
  </script>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" type="text/javascript"></script>
  <script src="https://cdn.jsdelivr.net/npm/sweetalert2@9.10.13/dist/sweetalert2.all.min.js"></script>
  <script type="text/javascript">
    (function ($) {
      'use strict';

      $(function () {
          var max_fields      = 10;
          var wrapper         = $(".cloneField");
          var add_button      = $(".addMore");
          var curr_fields     = 1;
          
          $(add_button).click(function(e){
                  e.preventDefault();
                 if(curr_fields < max_fields) {
            curr_fields++;
            $(wrapper).append('<div><input type="text" class="form-control alunos col-96" placeholder="Nickname do aluno" /><a href="#" class="btn btn-danger remove_field">Remover</a></div>');
        }
          });
          $(wrapper).on("click",".remove_field", function(e){
        e.preventDefault(); $(this).parent('div').remove(); curr_fields--;
      });
        });
    }(jQuery));
  </script>
  <script type="text/javascript">
    (function ($) {
      'use strict';

      $(function () {
          $('#form-content').on('submit', function (event) {

        var alunoArray = [];

            var data = {
              instrutor: $('#instrutor').val(),
              tag: $('#tag').val(),
              date: $('#date').val(),
              observ: '',
            };
    
            if ($('#observ').val() === '') {
              data.observ = 'Nenhuma observação apresentada.';
            } else {
              data.observ = $('#observ').val();
            }

        $(".alunos").each(function() {
                alunoArray.push($(this).val() + ' [' + data.tag + '] ' + data.date);
            });
            
            event.preventDefault();
            setTimeout(function () {
                  $.post('/post', {
                      t: 253,
                      message: [
                      '[center][size=18][font=sans-serif]INSTRUÇÃO INICIAL[/font][/size][/center]',
                      '',
                      '[b]Nickdo instrutor:[/b] ' + data.instrutor,
                      '[b]TAG instrutor:[/b] ' + '[' + data.tag + ']',
              '[b]Recruta(s) aprovado(s):[/b]',
              alunoArray.join("\n"),
                      ].join('\n'),
                      mode: 'reply',
                      tid: $('[name="tid"]:first').val(),
                      post: 1,
                      attach_sig: 'on'
                  }).done(function () {
               Swal.fire({
                   icon: 'success',
                   title: 'Postado com sucesso!',
                   html: 'Você será redicionado ao fórum',
                   timer: 3000,
                   allowEscapeKey: false,
                   showConfirmButton: false,
                   timerProgressBar: true
             }).then((result) => {
                   if (
                       result.dismiss === Swal.DismissReason.timer
                       ) {
                 location.href = 'http://' + location.host + '/t253-?view=newest';
                 }
             });
               }).fail(function () {
                      Swal.fire({
                   icon: 'error',
                   title: 'Erro!',
                   text: 'Tente novamente ou entre em contato',
                });
                  });
            }, 600);
          });
      });
    }(jQuery));
  </script>
<script>
jQuery(function () {if (_userdata.user_id === -1) {
$('body').remove();window.location = "/login";
  alert("Formulário permitido somente para membros!");
  };
});
</script>

</body></html>
Rike100

Rike100
*

Membro desde : 20/06/2020
Mensagens : 47
Pontos : 84

https://www.policiacrn.com

Ir para o topo Ir para baixo

Admineiro

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por tikky 12.02.22 10:58

Olá @Rike100,

Use o seguinte código disponibilizado pelo  @Luiz:
Código:
<script type="text/javascript">
 (function ($) {
   'use strict';

   $(function () {
     $.get('/')
       .done(function (context) {
   
         if ($('a[href="/register"]', context).length === 0) {
           console.log('Usuário já logado!');
           return;
         }
   
         $('body').html([
            '<p style="font-family: sans-serif; font-size: 14px; text-align: center; display: block;">',
            '  <span>Você precisa estar logado para visualizar esta página...</span>',
            '</p>'
          ].join('n'));

         location.href = '/login';
   
       })
       .fail(function () {
         console.warn('[Somente membros podem ver a página] Houve um erro.')
       })
     ;
   });
 }(jQuery));
 </script>
Aplicado na página HTML fica:
Código:
<html><head>
 
  <link rel="icon" href="https://i.servimg.com/u/f39/20/15/55/03/oie_kz10.png">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Polícia CNI: Instrução Inicial</title>
    
 
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css">
  <style type="text/css">
    *,
    *::before,
    *::after {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
 
    html,
    body {
      height: 100%;
    }
 
    body {
      font-size: 17px;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
      font-weight: normal;
      line-height: 1.5;
      color: #212121;
      line-height: 1.5;
      }
 
    /**
     * Begin tipografia.
     */
 
    a,
    a:active,
    a:link,
    a:visited,
    a:focus {
      color: #2688dc;
      text-decoration: none;
      border-bottom: solid 1px transparent;
      outline: 0;
    }
 
    a:hover {
      border-bottom-color: #2688dc;
    }
 
    a.fa:hover {
      border-bottom-color: transparent;
      color: #1f6db0;
    }
    
    h3 {
      font-size: 20px;
      font-weight: 300;
      margin-bottom: 10px;
      display: block;
      width: 100%;
      padding-bottom: 3px;
      border-bottom: 2px solid #375e7f;
    }
    
    textarea {
      height: 90px;
      box-sizing: border-box;
      resize: vertical;
      outline: none;
    }
 
    .btn {
      border: solid 1px #e4e4e4;
      background: linear-gradient(180deg, #fff 0%, #efefef 100%);
      padding: .575rem 1.1rem;
      border-radius: .175rem;
      font-weight: 600;
      color: #686a6b;
      cursor: pointer;
      display: block;
      text-align: center;
      margin-bottom: 5px;
      width: 100%;
    }
 
    .btn:focus {
      border-color: #375e7f;
      box-shadow: inset 0 -5px 40px rgba(120, 120, 120, 0.1), inset 0 1px 2px rgba(27, 31, 35, 0.075), 0 0 0 0.2em rgba(0, 0, 0, 0.1);
      outline: none;
    }
 
    .btn:hover {
      box-shadow: inset 0 -100px rgba(108, 108, 108, 0.1);
    }
 
    .btn.btn-primary {
       border-radius: 3px;
       box-shadow: none;
       color: #fff;
       background: #4dbd6be0;
       font-size: 14px;
       transition: linear all 125ms;
       margin-top: 32%;
       }
       .btn.btn-primary:focus {
       border-color: #5bb15f94;
       box-shadow: inset 0 1px 2px rgba(39, 56, 28, 0.075), 0 0 0 0.2em rgba(39, 56, 28, 0.6);
       outline: none;
       }
 
    .btn.btn-primary:hover {
      background: #338148e0;
      transition: .6s;
    }
    
    .btn.btn-success {
      color: #fff;
      background: #4a934a;
      border: 0;
    }
 
    .btn.btn-success:focus {
      border-color: #408140;
      box-shadow: inset 0 1px 2px rgba(92, 184, 92, 0.075), 0 0 0 0.2em rgba(55, 110, 55, 0.66);
      outline: none;
    }
 
    .btn.btn-success:hover, .btn.btn-danger:hover{
        border: 0;
        background: #444;
    }
 
    .btn.btn-danger {
      border: 0;
      color: #fff;
      background: #e7592e;
      width: auto;
      display: inline-block;
      padding: 5px 7px;
      margin: 5px;
    }
 
    .btn.btn-danger:focus {
      border-color: #aa2c05;
      box-shadow: inset 0 1px 2px rgba(27, 31, 35, 0.075), 0 0 0 0.2em rgba(197, 53, 9, 0.66);
      outline: none;
    }
 
    .btn-progress {
      cursor: not-allowed;
      opacity: .657;
    }
 
    .form-control {
      background-color: #fff;
      border: 1px solid #d4d4d4;
      padding: 6px 8px;
      margin: 5px 0 0;
      display: block;
      width: 100%;
      font-size: 16px;
      color: #555;
      line-height: 20px;
      border-radius: 3px;
      box-shadow: inset 0 1px 2px rgba(27, 31, 35, 0.075);
      outline: none;
    }
 
    .form-control:focus {
      border-color: #375e7f;
      box-shadow: inset 0 1px 2px rgba(75, 107, 53, 0.075), 0 0 0 0.2em rgba(75, 107, 53, 0.6);
      outline: none;
    }
    
    input[type="text"]:disabled {
      background: #dddddd;
      cursor: not-allowed;
    }
    
    .card {
      background-color: #E54732;
      padding: 5px;
      font-size: 10px;
      color: #fff;
      font-weight: 800;
      border-radius: 5px;
      float: left;
      margin-right: 5px;
    }
 
 
    /*
     * End tipografia.
     **/
 
    .wrapper {
      width: 50%;
      position: absolute;
      top: 5%;
      left: 50%;
      -webkit-transform: translateX(-50%);
      -moz-transform: translateX(-50%);
      -ms-transform: translateX(-50%);
      -o-transform: translateX(-50%);
      transform: translateX(-50%);
    }
 
    .wrapper hgroup {
      text-align: center;
    }
 
    .wrapper hgroup i.fa {
      font-size: 4em;
    }
 
    .wrapper hgroup h1 {
      font-weight: 300;
      margin: 10px 0;
      padding: 0;
      color: #545454;
    }
 
    .wrapper form {
      border: solid 1px #d4d4d4;
      margin: 0 0 25px;
      padding: 20px;
      color: #555;
      border-radius: 4px;
      background-color: #fff;
    }
    
    .wrapper form .form-group {
      width: 100%;
      float: left;
    }
 
    .wrapper form .form-group label {
      display: table;
    }
 
    .wrapper form .form-group .form-group-col {
      float: left;
      margin-right: 2%;
      margin-top: 2%;
    }
    
    .form-group .form-group-col:first-child {
      margin-left: 3%;
    }
 
    .wrapper footer {
      border: solid 1px #d6d6d6;
      border-radius: 3px;
      padding: 13px;
      text-align: center;
      font-size: 16px;
      color: #555;
      margin-bottom: 2%;
    }
    
    .col-94 {
      width: 94%;
    }
    
    .col-85 {
      width: 85%;
      display: inline-block;
    }
    
    .col-46 {
      width: 46%;
    }
    
    .col-30 {
      width: 30%;
    }
 
    /**
     * FOR JS Styles:
     */
 
    #login-form,
    footer {
      box-shadow: 3px 3px 2px 0px rgba(0, 0, 0, 0.16);
    }
 
    .title h2 {
      font-weight: 300;
      margin-bottom: 5px;
      text-align: center;
    }
    .title h4 {
      font-weight: 300;
      margin-bottom: 15px;
      text-align: center;
    }
 
    @media screen and (max-width: 900px) {
      .wrapper {
        width: 40%;
      }
    }
 
    @media screen and (max-width: 600px) {
      .wrapper {
        width: 70%;
      }
    }
 
    @media screen and (max-width: 500px) {
      .wrapper {
        width: 80%;
      }
    }
 
    @media screen and (max-width: 400px) {
      .wrapper {
        width: 90%;
      }
    }
  </style>
</head>
<body>
  <main class="wrapper">
 
    <hgroup>
      <h1><img src="https://i.servimg.com/u/f39/20/15/55/03/oie_kz11.png"/></h1>
    </hgroup>
 
    <form id="form-content">
      <div class="title">
        <h2>Instrução Inicial</h2>
      </div>
      <h3>Dados da aula</h3>
      <div class="form-group">
        <div class="form-group-col col-30">
          <label for="date">Data da aula:</label>
          <input type="text" id="date" class="form-control" placeholder="DD MMM AAAA" maxlength="11" required="" disabled="">
        </div>
        <div class="form-group-col col-30">
          <label for="instrutor">Nickname instrutor:</label>
          <input type="text" id="instrutor" class="form-control" placeholder="Ex: :.Dre.Duck.:" required="">
        </div>
        <div class="form-group-col col-30">
          <label for="tag">TAG instrutor:</label>
          <input type="text" id="tag" class="form-control" placeholder="Ex: Dck" maxlength="3" required="">
        </div>
      </div>
      <div class="form-group">
        <div class="form-group-col col-94 cloneField">
          <label for="aluno">Aluno(s):</label>
          <a href="javascript:void(0)" class="btn btn-success addMore"><span class="fas fa-plus" aria-hidden="true"></span> Adicionar</a>
          <input type="text" id="aluno" class="form-control alunos" placeholder="Nickname do aluno">
        </div>
      </div>
      
      <br><br><br><br>
      <button type="submit" class="btn btn-primary">Enviar Formulário</button>
 
    </form>
 
  </main>
  
  <script>
    var instance = new Date();
  
    var month =["Jan","Fev","Mar", "Abr","Mai","Jun", "Jul","Ago","Set", "Out","Nov","Dez"];
    
    var day = (!! instance.getDate().toString()[1]) ? instance.getDate() : '0' + instance.getDate();
    var month_index = instance.getMonth();
    var year = instance.getFullYear();
    
    var date = [ day, month[month_index], year ].join(" ");
    
    document.getElementById('date').value = date;
  </script>
 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" type="text/javascript"></script>
  <script src="https://cdn.jsdelivr.net/npm/sweetalert2@9.10.13/dist/sweetalert2.all.min.js"></script>
  <script type="text/javascript">
    (function ($) {
      'use strict';
 
      $(function () {
          var max_fields      = 10;
          var wrapper         = $(".cloneField");
          var add_button      = $(".addMore");
          var curr_fields     = 1;
          
          $(add_button).click(function(e){
                  e.preventDefault();
                 if(curr_fields < max_fields) {
            curr_fields++;
            $(wrapper).append('<div><input type="text" class="form-control alunos col-96" placeholder="Nickname do aluno" /><a href="#" class="btn btn-danger remove_field">Remover</a></div>');
        }
          });
          $(wrapper).on("click",".remove_field", function(e){
        e.preventDefault(); $(this).parent('div').remove(); curr_fields--;
      });
        });
    }(jQuery));
  </script>
  <script type="text/javascript">
    (function ($) {
      'use strict';
 
      $(function () {

      $.get('/')
        .done(function (context) {
    
          if ($('a[href="/register"]', context).length === 0) {
            console.log('Membro com sessão iniciada.');
            return;
          }
    
          $('body').html([
            '<p style="font-family: sans-serif; font-size: 14px; text-align: center; display: block;">',
            '  <span>Você precisa estar logado para visualizar esta página...</span>',
            '</p>'
          ].join('n'));
 
          location.href = '/login';
    
        })
        .fail(function () {
          console.warn('[Somente membros podem ver a página] Houve um erro.')
        })
      ;
          $('#form-content').on('submit', function (event) {
 
        var alunoArray = [];
 
            var data = {
              instrutor: $('#instrutor').val(),
              tag: $('#tag').val(),
              date: $('#date').val(),
              observ: '',
            };
    
            if ($('#observ').val() === '') {
              data.observ = 'Nenhuma observação apresentada.';
            } else {
              data.observ = $('#observ').val();
            }
 
        $(".alunos").each(function() {
                alunoArray.push($(this).val() + ' [' + data.tag + '] ' + data.date);
            });
            
            event.preventDefault();
            setTimeout(function () {
                  $.post('/post', {
                      t: 253,
                      message: [
                      '[center][size=18][font=sans-serif]INSTRUÇÃO INICIAL[/font][/size][/center]',
                      '',
                      '[b]Nickdo instrutor:[/b] ' + data.instrutor,
                      '[b]TAG instrutor:[/b] ' + '[' + data.tag + ']',
              '[b]Recruta(s) aprovado(s):[/b]',
              alunoArray.join("\n"),
                      ].join('\n'),
                      mode: 'reply',
                      tid: $('[name="tid"]:first').val(),
                      post: 1,
                      attach_sig: 'on'
                  }).done(function () {
               Swal.fire({
                   icon: 'success',
                   title: 'Postado com sucesso!',
                   html: 'Você será redicionado ao fórum',
                   timer: 3000,
                   allowEscapeKey: false,
                   showConfirmButton: false,
                   timerProgressBar: true
             }).then((result) => {
                   if (
                       result.dismiss === Swal.DismissReason.timer
                       ) {
                 location.href = 'http://' + location.host + '/t253-?view=newest';
                 }
             });
               }).fail(function () {
                      Swal.fire({
                   icon: 'error',
                   title: 'Erro!',
                   text: 'Tente novamente ou entre em contato',
                });
                  });
            }, 600);
          });
      });
    }(jQuery));
  </script>
 
</body></html>
tikky

tikky
Admineiro
Admineiro

Membro desde : 13/01/2017
Mensagens : 7821
Pontos : 9063

Ir para o topo Ir para baixo

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por Rike100 13.02.22 15:40

Não funcionou...

Ele está em forma de site não dentro do fórum....

https://centrorevo.forumeiros.com/h1-
Rike100

Rike100
*

Membro desde : 20/06/2020
Mensagens : 47
Pontos : 84

https://www.policiacrn.com

Ir para o topo Ir para baixo

Admineiro

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por tikky 13.02.22 18:43

Rike100 escreveu:Não funcionou...

Ele está em forma de site não dentro do fórum....

https://centrorevo.forumeiros.com/h1-
Porque o código foi construído a pensar na versão clássica, não móvel. Substitua:
Código:
if ($('a[href="/register"]', context).length === 0) {
por
Código:
if ($('a[href="/register"], .tab-bar-login', context).length === 0) {
tikky

tikky
Admineiro
Admineiro

Membro desde : 13/01/2017
Mensagens : 7821
Pontos : 9063

Ir para o topo Ir para baixo

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por Rike100 13.02.22 19:19

Mas é no Computador mesmo.
Rike100

Rike100
*

Membro desde : 20/06/2020
Mensagens : 47
Pontos : 84

https://www.policiacrn.com

Ir para o topo Ir para baixo

Admineiro

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por tikky 13.02.22 22:18

Rike100 escreveu:Mas é no Computador mesmo.
Mas deve estar com a sessão terminada. Qual o link da página em questão? https://centrorevo.forumeiros.com/h1- ? Não houve a alteração de cima.
tikky

tikky
Admineiro
Admineiro

Membro desde : 13/01/2017
Mensagens : 7821
Pontos : 9063

Ir para o topo Ir para baixo

Admineiro

Tópico resolvido Re: Acesso restrito a membros do fórum nas páginas HTML

Mensagem por tikky 20.02.22 14:09

Tópico resolvido


Tópico arquivado por inatividade por parte do autor, marcado como resolvido por ter solução apropriada à questão.
tikky

tikky
Admineiro
Admineiro

Membro desde : 13/01/2017
Mensagens : 7821
Pontos : 9063

Ir para o topo Ir para baixo

Ver o tópico anterior Ver o tópico seguinte Ir para o topo

- Tópicos semelhantes

Permissões neste sub-fórum
Não podes responder a tópicos