Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Yiuky

Retorno ao index a partir do código

Recommended Posts

Olá tenho esse código abaixo e a parte em vermelho é um HTML carregado pelo meu Arduíno, e como podem ver, ao clicar no botão LIGAR/DESLIGAR é enviado um retorno pelo <a href> porém eu gostaria de saber como posso apenas coletar esse retorno /L OU /H e carregar a pagina index / (barra vazia)? Ou se posso clicar no LIGAR/DESLIGAR e adicionar algo para que a pagina "atualize" ou vá para a /?

 

// \r\n no final de todos os códigos AT para pular linhas e reconhecer comando
#include "SDHT.h"
#include "WiFiEsp.h" //INCLUSÃO DA BIBLIOTECA
#include <SoftwareSerial.h>

//Pino do Tx no 6, pino Rx no 7
SoftwareSerial esp8266(6, 7);
SDHT dht;

char ssid[] = "2.4_GAMBATESHIMA"; //VARIÁVEL QUE ARMAZENA O NOME DA REDE SEM FIO
char pass[] = "FACA2010";//VARIÁVEL QUE ARMAZENA A SENHA DA REDE SEM FIO
//char ssid[] = "Ali"; //VARIÁVEL QUE ARMAZENA O NOME DA REDE SEM FIO
//char pass[] = "01010101";//VARIÁVEL QUE ARMAZENA A SENHA DA REDE SEM FIO
WiFiEspServer server(81); //CONEXÃO REALIZADA NA PORTA 80
RingBuffer buf(8); //BUFFER PARA AUMENTAR A VELOCIDADE E REDUZIR A ALOCAÇÃO DE MEMÓRIA
#define DEBUG true

  int statusLed = LOW; //VARIÁVEL QUE ARMAZENA O ESTADO ATUAL DO LED (LIGADO / DESLIGADO)
  String temperatura;
  String umidade;
  
  int status = WL_IDLE_STATUS;
  
void lerTempUmi(){
  dht.broadcast(DHT11, A1);
  delay(500);
  temperatura = String (dht.celsius, 0);
  umidade = String (dht.humidity, 0);
   }
  
void setup() 
{
    Serial.begin(9600);
    esp8266.begin(9600);
    WiFi.init(&esp8266);   // initialize ESP module
    pinMode(12, OUTPUT);
    digitalWrite(12, statusLed);

  if (WiFi.status() == WL_NO_SHIELD)  // check for the presence of the shield 
  {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);
  }

  // attempt to connect to WiFi network
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  }

  Serial.println("You're connected to the network");
  printWifiStatus();
  

  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    WiFi.init(&esp8266);
    WiFi.begin(ssid, pass);
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  }
  //sendData("AT+RST\r\n", 2000, DEBUG); // rst
  //sendData("AT+CWMODE=1\r\n",2000, DEBUG); 
  //sendData("AT+CWJAP=\"2.4_GAMBATESHIMA\",\"FACA2010\"\r\n", 5000, DEBUG);

      
  //sendData("AT+CIFSR\r\n", 2000, DEBUG);//You will get the IP Address of the ESP8266 from this command. 
  //sendData("AT+CIPMUX=1\r\n", 2000, DEBUG);
  //sendData("AT+CIPSERVER=1,80\r\n", 2000, DEBUG);

  //sendData("AT+CIPSTART=0,\"TCP\",\"192.168.0.120\",37777\r\n",1000, DEBUG);                          // escolhe entre conexao TCP ou UDP 
  //delay(1000); 

  //sendData("AT+CWDHCP=1,0\r\n",1000, DEBUG);                                                        // configura ESP8266 para receber um IP do roteador conectado
  //delay(1000);

  //sendData("AT+CIPSTA_DEF=\"192.168.2.5\",\"192.168.2.1\",\"255.255.255.0\"\r\n",1000, DEBUG);      // configura novo IP a ser escolhido - IP fixo, IP do roteador, Mascara da Rede (lembrando que o IP a ser escolhido deve estar na mesma faixa do roteador);
  //delay(1000);   

  //sendData("AT+CIFSR\r\n", 1000, DEBUG);                                                              // Mostra o endereco IP
  //delay(3000);
  
  // Configura para multiplas conexoes
  //sendData("AT+CIPMUX=1\r\n", 1000, DEBUG);                                                           // Abre multiplas conexoes
  //delay(2000);

  //sendData("AT+CIPSERVER=1,80\r\n", 1000, DEBUG);
  delay(1000);
  server.begin();
  
}

void loop() 
{
       WiFiEspClient client = server.available(); //ATENDE AS SOLICITAÇÕES DO CLIENTE
      if (client) { //SE CLIENTE TENTAR SE CONECTAR, FAZ
      buf.init(); //INICIALIZA O BUFFER
      boolean currentLineIsBlank = true;
      while (client.connected()){ //ENQU
      if(client.available()){ //SE EXISTIR REQUISIÇÃO DO CLIENTE, FAZ
        char c = client.read(); //LÊ A REQUISIÇÃO DO CLIENTE
        buf.push(c); //BUFFER ARMAZENA A REQUISIÇÃO
         //IDENTIFICA O FIM DA REQUISIÇÃO HTTP E ENVIA UMA RESPOSTA
        if(buf.endsWith("\r\n\r\n") && currentLineIsBlank) {
 //         lerTempUmi();
          WebPage2(client);
          break;
        }else if(buf.endsWith("GET /H")){ //SE O PARÂMETRO DA REQUISIÇÃO VINDO POR GET FOR IGUAL A "H", FAZ 
            digitalWrite(12, HIGH); //ACENDE O LED
            statusLed = HIGH; //VARIÁVEL RECEBE VALOR 0(SIGNIFICA QUE O LED ESTÁ APAGADO)
        }else if (buf.endsWith("GET /L")) { //SE O PARÂMETRO DA REQUISIÇÃO VINDO POR GET FOR IGUAL A "L", FAZ
                  digitalWrite(12, LOW); //APAGA O LED
                  statusLed = LOW; //VARIÁVEL RECEBE VALOR 0(SIGNIFICA QUE O LED ESTÁ APAGADO)
             }
             }
             
             }
             delay(10);
      client.stop();
//sendData("AT+CIPCLOSE=0\r\n", 1000, DEBUG);
              }
if (status != WL_CONNECTED) {
  setup();}
}
void WebPage2(WiFiEspClient client){
  client.print(
    "HTTP/1.1 200 OK\r\n"
    "Content-Type: text/html\r\n"
 //   "Connection: close\r\n"  // the connection will be closed after completion of the response
    "\r\n");
  client.println("");
  client.println(F("<!DOCTYPE HTML>")); //INFORMA AO NAVEGADOR A ESPECIFICAÇÃO DO HTML
  client.println(F("<html><head><meta charset=\"utf-8\">")); //ABRE A TAG "html"
  client.println(F("<link rel='stylesheet' type='text/css' href='http://blogmasterwalkershop.com.br/arquivos/artigos/sub_wifi/webpagecss.css' />\n"
  "<link rel=\"icon\" type=\"image/png\" href=\"webserver\" src=\"https://tse3.mm.bing.net/th?id=OIP.iEsBOeq78HtIighYnuVMRAHaHa&amp;pid=Api&amp;P=0&amp;w=300&amp;h=300.png\">\n"
"  <title>GAMBATESHIMA ARDUINO WORK</title>"));
  
  //AS LINHAS ABAIXO CRIAM A PÁGINA HTML
  client.println(F("<body class=\"htmlNoPages\">\n"
"  <img alt=\"webserver\" src=\"https://tse3.mm.bing.net/th?id=OIP.iEsBOeq78HtIighYnuVMRAHaHa&amp;pid=Api&amp;P=0&amp;w=300&amp;h=300.png\" style=\"width: 150px; height: 150px; margin-top: 50px;\">\n"
"  <p style=\"line-height: 2;\" class=\"gwd-p-pzi3\"><font>WEBSERVER GAMBATESHIMA</font></p><p>ESTADO ATUAL DO LED: \n"));
    if (statusLed == HIGH) {
client.println(F(" <strong><font color=\"green\">LIGADO</font></strong></p>\n"
      "<a href=\"/L\" style=\"margin-bottom:50px;\">DESLIGAR</a>\n"));
    }else {
      if (statusLed == LOW) {
client.println(F(" <strong><font color=\"red\">DESLIGADO</font></strong></p>\n"
      "<a href=\"/H\" style=\"margin-bottom:50px;\">ACENDER</a>\n"));
    }}
          lerTempUmi();
client.println(F( 
"  <hr width=\"250\">\n"
"  <p style=\"line-height: 0;\"><font color=\"red\">TEMPERATURA: </font>"));
client.print(temperatura);
client.println(F(" ºC</p>\n <hr width=\"250\">\n"
"  <p style=\"line-height: 0;\"><font color=\"red\">UMIDADE: </font>"));
client.print(umidade);
client.println(F(" %</p>\n <hr width=\"250\">\n"
"<a href=\"/\">ATUALIZAR</a>\n"

"</body>\n"
"</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

  • Conteúdo Similar

    • Por Jack Oliveira
      Ola estou fazendo um instalador de banco de dados 
       
      em parte funciona  
       
      Mas quando uso o
      <<<HTML
       
      HTML;
       
      Ele fica com estas informações no top
       
      7.4 ao 8.38.0.28512MOnOnOnOffOffOnOffOffOnOnOnOnOnprogress-bar-success
       
      <?php $MeuHtml = <<<HTML <!DOCTYPE html> <html> <head><meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Instalação {$autor}</title> <link rel="icon" href="{$urlApi}api/allinstall/assets/icone.png?v={$versao}" sizes="32x32"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <link rel="stylesheet" href="{$urlApi}api/allinstall/assets/css/app.css?v={$versao}"> <style type="text/css"> .license { background-color: #FFF; height: 400px; width: 100%; margin: 10px; } .form-control{ margin-bottom: 5px; } #primary{background: #FF6403} .paper-card{background: #272c33} .card{background: none;} .sw-theme-circles>ul.step-anchor:before{background-color: #30363d} .sw-theme-circles>ul.step-anchor>li>a{border: 3px solid #30363d} .sw-theme-circles>ul.step-anchor>li>a{background: #f5f5f5; min-width: 50px; height: 50px; text-align: center; -webkit-box-shadow: inset 0 0 0 3px #fff!important; box-shadow: inset 0 0 0 3px #fff!important; text-decoration: none; outline-style: none; z-index: 99; color: #999; background: #fff; line-height: 2; font-weight: bold;} .sw-theme-circles>ul.step-anchor>li{margin-left: 15%;} .card-header{border-bottom: 0} .table-striped tbody tr:nth-of-type(odd){background-color: #30363d;} .table-bordered{border: 1px solid #30363d;} .table-bordered td, .table-bordered th { border: 1px solid #30363d; } </style> </head> <body class="light loaded"> <div id="app"> <main> <div id="primary" class="p-t-b-100 height-full"> <div class="container"> <div class="row"> <div class="col-lg-8 mx-md-auto paper-card"> <div class="text-center"> <img class="img-responsive" src="{$urlApi}api/allinstall/assets/{$imagem}?v={$versao}"> <p><strong><H3>Instalação {$projeto} | V: {$versao}</H3></strong></p> </div> HTML; if (!isset($_GET['step']) || $_GET['step'] == '1') { $MeuHtml .= <<<HTML <div class="card no-b"> <div class="card-header pb-0"> <div class="stepper sw-main sw-theme-circles" id="smartwizard" data-options='{ "theme":"sw-theme-circles", "transitionEffect":"fade" }'> <ul class="nav step-anchor"> <li><a href="#step-1y">1</a></li> <li><a href="#step-2y">2</a></li> <li><a href="#step-3y">3</a></li> <li><a href="#step-4y">4</a></li> </ul> </div> </div> <div class="card-body"> <h6><b>Configurações do Servidor</b></h6><br> <table class="table table-condensed table-bordered table-striped"> <tr> <th>Função / Extensão</th> <th>Config. Necessária</th> <th>Config. Atual</th> <th width="50px">Status</th> </tr> <tr> <td>Versão do PHP</td> <td> HTML; echo $php7. ' ao '.$php8; $MeuHtml .= <<<HTML </td> <td> HTML; echo phpversion(); $MeuHtml .= <<<HTML </td> <td> HTML; if(phpversion() >= $php7 && phpversion() <= $php8) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> HTML; $MeuHtml .= <<<HTML <tr> <td>Memória do PHP</td> <td>128MB</td> <td> HTML; echo $mem = ini_get('memory_limit'); $MeuHtml .= <<<HTML </td> <td> HTML; if($mem >= 128) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>cURL</td> <td>On</td> <td> HTML; if(function_exists('curl_init')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(function_exists('curl_init')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>Allow URL fopen</td> <td>On</td> <td> HTML; if(ini_get('allow_url_fopen')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(ini_get('allow_url_fopen')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>File Get Contents</td> <td>On</td> <td> HTML; if(function_exists('file_get_contents')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(function_exists('file_get_contents')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>Sessão Auto Start</td> <td>Off</td> <td> HTML; if(ini_get('session_auto_start')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(!ini_get('session_auto_start')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>Safe Mode</td> <td>Off</td> <td> HTML; if(ini_get('safe_mode')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(!ini_get('safe_mode')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>Short Open Tags</td> <td>On</td> <td> HTML; if(ini_get('short_open_tag')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(ini_get('short_open_tag')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>Magic Quotes GPC</td> <td>Off</td> <td> HTML; if(ini_get('magic_quotes_gpc')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(!ini_get('magic_quotes_gpc')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>Register Globals</td> <td>Off</td> <td> HTML; if(ini_get('register_globals')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(!ini_get('register_globals')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>PHPMail</td> <td>On</td> <td> HTML; if(function_exists('mail')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(function_exists('mail')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { $i = $i + 1; echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>MySQLi</td> <td>On</td> <td> HTML; if(extension_loaded('mysqli')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(extension_loaded('mysqli')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>ZIP</td> <td>On</td> <td> HTML; if(extension_loaded('zip')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(extension_loaded('zip')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>MBString</td> <td>On</td> <td> HTML; if(extension_loaded('mbstring')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(extension_loaded('mbstring')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> <tr> <td>XML</td> <td>On</td> <td> HTML; if(extension_loaded('libxml')) { echo 'On'; } else { echo 'Off'; } $MeuHtml .= <<<HTML </td> <td> HTML; if(extension_loaded('libxml')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> </table> <hr> <h6><b>Diretórios e Permissões de Arquivos</b></h6><br> <table class="table table-condensed table-bordered table-striped"> <tr> <th>Diretório</th> <th style="width: 40px">Status</th> </tr> <tr> <td>database</td> <td> HTML; if(is_writable('database')) { $i = $i + 1; echo '<button type="button" class="btn btn-success"><i class="icon-check"></i></button>'; } else { echo '<button type="button" class="btn btn-danger"><i class="icon-close"></i></button>'; } $MeuHtml .= <<<HTML </td> </tr> </table> <hr> <h6><b>Pontuação / Compatibilidade</b></h6><br> <div class="progress"> <div class="progress-bar progress-bar-striped progress-bar-animated HTML; echo ProgressBar(substr(VerificaPontuacao($i,'16'),0,4)); $PontPorce = VerificaPontuacao($i,'16'); $pont100 = substr(VerificaPontuacao($i,'16'),0,4); $MeuHtml .= <<<HTML " role="progressbar" aria-valuemax="100" style="width: {$PontPorce}%;"> <strong>{$pont100} / 100</strong> </div> </div> <center> <br> <button class="btn btn-primary" onclick="document.location.href='{$URL}?step=1';">Verificar</button> <button class="btn btn-primary" onclick="document.location.href='{$URL}?step=2';">Próximo</button> </center> </div> </div> HTML; } elseif (isset($_GET['step']) && $_GET['step'] == '2') { $MeuHtml .= <<<HTML <div class="card no-b"> <div class="card-header pb-0"> <div class="stepper sw-main sw-theme-circles" id="smartwizard" data-options='{ "theme":"sw-theme-circles", "transitionEffect":"fade" }'> <ul class="nav step-anchor"> <li><a href="#step-1y">1</a></li> <li class="active"><a href="#step-2y">2</a></li> <li><a href="#step-3y">3</a></li> <li><a href="#step-4y">4</a></li> </ul> </div> </div> <div class="card-body "> <iframe src="{$urlApi}api/allinstall/termos.php{$Frame}" class="license" frameborder="0" scrolling="auto"></iframe> <form action="setup.php"> <input type="hidden" name="step" value="3"> <label><input type="checkbox" required=""> Sim, eu aceito</label> <center> <br> <a href="javascript:history.back()"><button class="btn btn-primary">Voltar</button></a> <button class="btn btn-primary" type="submit">Próximo</button> </center> </form> </div> </div> HTML; } elseif (isset($_GET['step']) && $_GET['step'] == '3') { $MeuHtml .= <<<HTML <div class="card no-b"> <div class="card-header pb-0"> <div class="stepper sw-main sw-theme-circles" id="smartwizard" data-options='{ "theme":"sw-theme-circles", "transitionEffect":"fade" }'> <ul class="nav step-anchor"> <li><a href="#step-1y">1</a></li> <li class="active"><a href="#step-2y">2</a></li> <li class="active"><a href="#step-3y">3</a></li> <li><a href="#step-4y">4</a></li> </ul> </div> </div> <div class="card-body"> <form method="post" action="?InstallDB"> <h6><b>1. MySQL - Configuração do Banco de Dados</b></h6><hr> <div class="form-group row"> <label class="col-sm-3 control-label">MySQL Host:</label> <div class="col-sm-9"> <input class="form-control" name="dbhost" value="localhost" required> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">Usuário MySQL:</label> <div class="col-sm-9"> <input class="form-control" name="dbuser" required> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">Senha MySQL:</label> <div class="col-sm-9"> <input class="form-control" name="dbpass"> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">Nome do Banco MySQL:</label> <div class="col-sm-9"> <input class="form-control" name="dbname" required> </div> </div> <h6><b>2. Configuração Comum</b></h6><hr> <div class="form-group row"> <label class="col-sm-3 control-label">Nome do Site:</label> <div class="col-sm-9"> <input class="form-control" name="nomesite" required> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">URL do Site:</label> <div class="col-sm-9"> <input class="form-control" name="urlsite" value="{$urlsite}" required> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">URL de Instalação:</label> <div class="col-sm-9"> <input class="form-control" name="siteurl" value="{$siteurl}" required> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">Extensão:</label> <div class="col-sm-9"> <select class="form-control" name="extensao" required> <option value=""> Selecionar Extensão </option> <option value="1"> MYSQLI </option> <option value="2"> PDO </option> </select> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">Define TimeZone:</label> <div class="col-sm-9"> <select class="form-control" name="timezone" id="timezone"> HTML; foreach ($timezones as $timezone) : echo '<option value="'.$timezone.'" '.$timezone === $current_timezone ? 'selected' : ''.'> '.$timezone.' </option>'; endforeach; $MeuHtml .= <<<HTML </select> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">E-mail:</label> <div class="col-sm-9"> <input class="form-control" name="email" required> <em>Mesmo e-mail cadastrado em nosso Site.</em> </div> </div> <h6><b>3. Configuração do Administrador</b></h6><hr> <div class="form-group row"> <label class="col-sm-3 control-label">Nome do Usuário:</label> <div class="col-sm-9"> <input class="form-control" name="usuario" required> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">Login:</label> <div class="col-sm-9"> <input class="form-control" name="login" required> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">Senha:</label> <div class="col-sm-9"> <input class="form-control" type="password" name="senha" required> </div> </div> <div class="form-group row"> <label class="col-sm-3 control-label">Senha[confimação]:</label> <div class="col-sm-9"> <input class="form-control" type="password" name="senhaconfirm" required> </div> </div> <center> <a class="btn btn-primary" href="javascript:history.back()">Voltar</a> <button class="btn btn-primary">Próximo</button> </center> </form> </div> </div> HTML; } elseif (isset($_GET['step']) && $_GET['step'] == '4') { $MeuHtml .= <<<HTML <div class="card no-b"> <div class="card-header pb-0"> <div class="stepper sw-main sw-theme-circles" id="smartwizard" data-options='{ "theme":"sw-theme-circles", "transitionEffect":"fade" }'> <ul class="nav step-anchor"> <li><a href="#step-1y">1</a></li> <li class="active"><a href="#step-2y">2</a></li> <li class="active"><a href="#step-3y">3</a></li> <li class="active"><a href="#step-4y">4</a></li> </ul> </div> </div> <div class="card-body"> <div> <h4><b>Instalação realizada com sucesso!</b></h4> <p>Agora você poderá utilizar o seu {$projeto}, em caso de dúvidas entre em contato com o suporte: <b>{$emailautor}</b></p> </div> <center> <form action="{$URL}?step=4" method="post"> <button type="submit" name="realizar_login" class="btn btn-primary">Realizar Login</button> </form> </center> </div> </div> HTML; } if (isset($_POST['realizar_login'])) { // Deletar os arquivos @unlink('setup.php'); @unlink($URL); @unlink('termos.php'); @unlink('database/BD.sql'); @unlink('controller/setup.php'); // Redirecionar para a página de login ou outra página desejada header('Location: login.php?finish'); exit; } $MeuHtml .= <<<HTML <div class="box-footer"> <center> Todos os Direitos Reservados {$autor} </center> </div> </div> </div> </div> </div> </main> </div> <script src="{$urlApi}api/allinstall/assets/js/app.js"></script> </body> </html> HTML; echo $MeuHtml;  
    • Por Jack Oliveira
      Ola pessoal, boa noite a todos
       
      Bom é o seguinte tenho um codigo html onde selecione um modelo de site para poder criar na base selecionada, ele criar ate então, mas ele esta pegando somente o index.html
      Mas quero que ele salva junto ao novo projeto o css, js, img, images, assets e fonts, quando faço os ajuste para que pega tudo isso ele me da erro ao salvar 
      Vou mostra parte do html onde faz a seleção dos modelos
       
      <!-- new page modal--> <div class="modal fade" id="new-page-modal" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <form id="newPageForm" method="POST" action="save.php"> <div class="modal-content"> <div class="modal-header"> <h6 class="modal-title text-primary fw-normal"><i class="la la-lg la-file"></i> Nova página</h6> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"> </button> </div> <div class="modal-body text"> <div class="mb-3 row" data-key="type"> <label class="col-sm-3 col-form-label"> Modelo <abbr title="O conteúdo deste modelo será usado como ponto de partida para o novo modelo"> <i class="la la-lg la-question-circle text-primary"></i> </abbr> </label> <div class="col-sm-9 input"> <div> <select class="form-select" name="startTemplateUrl"> <option value="themes/modelo-branco/branco-template.html">Modelo em branco</option> <option value="themes/modelo1/index.html">Modelo 1 de L2</option> <option value="themes/modelo2/index.html">Modelo 3 de L2</option> <option value="themes/modelo3/index.html">Modelo 3 de L2 </option> </select> </div> </div> </div> <div class="mb-3 row" data-key="href"> <label class="col-sm-3 col-form-label">Nome da página</label> <div class="col-sm-9 input"> <div> <input name="title" type="text" value="Minha página" class="form-control" placeholder="Minha página" required> </div> </div> </div> <div class="mb-3 row" data-key="href"> <label class="col-sm-3 col-form-label">Nome do arquivo</label> <div class="col-sm-9 input"> <div> <input name="file" type="text" value="my-page.html" class="form-control" placeholder="index.html" required> </div> </div> </div> <div class="mb-3 row" data-key="href"> <label class="col-sm-3 col-form-label">Salvar na pasta</label> <div class="col-sm-9 input"> <div> <input name="folder" type="text" value="my-pages" class="form-control" placeholder="/" required> </div> </div> </div> </div> <div class="modal-footer"> <button class="btn btn-secondary btn-lg" type="reset" data-bs-dismiss="modal"><i class="la la-times"></i> Cancelar</button> <button class="btn btn-primary btn-lg" type="submit"><i class="la la-check"></i> Criar página</button> </div> </div> </form> </div> </div> A ideia aqui é salvar tudo que tiver depois do themes/demo1/
      quando ele salva so salva 
      my-pasta/index.html
      e quando for salva ele salva dentro de um pasta Projetos/MeuSite1
      Projetos/MeuSite2  e assim vai
      Este é o save.php
       
      <?php define('MAX_FILE_LIMIT', 1024 * 1024 * 2);//Tamanho máximo de arquivo HTML de 2 megabytes define('ALLOW_PHP', false);//verifique se o html salvo contém tag php e não salve se não for permitido define('ALLOWED_OEMBED_DOMAINS', [ 'https://www.youtube.com/', 'https://www.vimeo.com/', 'https://www.twitter.com/' ]);//carregar URLs apenas de sites permitidos para oembed function sanitizeFileName($file, $allowedExtension = 'html') { $basename = basename($file); $disallow = ['.htaccess', 'passwd']; if (in_array($basename, $disallow)) { showError('Nome de arquivo não permitido!'); return ''; } //sanitize, remova o ponto duplo .. e remova os parâmetros get, se houver $file = preg_replace('@\?.*$@' , '', preg_replace('@\.{2,}@' , '', preg_replace('@[^\/\\a-zA-Z0-9\-\._]@', '', $file))); if ($file) { $file = __DIR__ . DIRECTORY_SEPARATOR . $file; } else { return ''; } //permitir apenas extensão .html if ($allowedExtension) { $file = preg_replace('/\.[^.]+$/', '', $file) . ".$allowedExtension"; } return $file; } function showError($error) { header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500); die($error); } function validOembedUrl($url) { foreach (ALLOWED_OEMBED_DOMAINS as $domain) { if (strpos($url, $domain) === 0) { return true; } } return false; } $html = ''; $file = ''; $action = ''; if (isset($_POST['startTemplateUrl']) && !empty($_POST['startTemplateUrl'])) { $startTemplateUrl = sanitizeFileName($_POST['startTemplateUrl']); $html = ''; if ($startTemplateUrl) { $html = file_get_contents($startTemplateUrl); } } else if (isset($_POST['html'])){ $html = substr($_POST['html'], 0, MAX_FILE_LIMIT); if (!ALLOW_PHP) { //if (strpos($html, '<?php') !== false) { if (preg_match('@<\?php|<\? |<\?=|<\s*script\s*language\s*=\s*"\s*php\s*"\s*>@', $html)) { showError('PHP não permitido!'); } } } if (isset($_POST['file'])) { $file = sanitizeFileName($_POST['file']); } if (isset($_GET['action'])) { $action = htmlspecialchars(strip_tags($_GET['action'])); } if ($action) { //ações do gerenciador de arquivos, excluir e renomear switch ($action) { case 'rename': $newfile = sanitizeFileName($_POST['newfile']); if ($file && $newfile) { if (rename($file, $newfile)) { echo "Arquivo '$file' renomeado para '$newfile'"; } else { showError("Erro ao renomear arquivo '$file' renomeado para '$newfile'"); } } break; case 'delete': if ($file) { if (unlink($file)) { echo "Arquivo '$file' excluído"; } else { showError("Erro ao excluir arquivo '$file'"); } } break; case 'saveReusable': //bloco ou seção $type = $_POST['type'] ?? false; $name = $_POST['name'] ?? false; $html = $_POST['html'] ?? false; if ($type && $name && $html) { $file = sanitizeFileName("$type/$name"); if ($file) { $dir = dirname($file); if (!is_dir($dir)) { echo "$dir pasta não existe\n"; if (mkdir($dir, 0777, true)) { echo "$dir pasta foi criada\n"; } else { showError("Erro ao criar pasta '$dir'\n"); } } if (file_put_contents($file, $html)) { echo "Arquivo salvo '$file'"; } else { showError("Erro ao salvar arquivo '$file'\nAs possíveis causas são falta de permissão de gravação ou caminho de arquivo incorreto!"); } } else { showError('Nome de arquivo inválido!'); } } else { showError("Faltam dados de elementos reutilizáveis!\n"); } break; case 'oembedProxy': $url = $_GET['url'] ?? ''; if (validOembedUrl($url)) { header('Content-Type: application/json'); echo file_get_contents($url); } else { showError('URL inválida!'); } break; default: showError("Ação inválida '$action'!"); } } else { //salvar pagina if ($html) { if ($file) { $dir = dirname($file); if (!is_dir($dir)) { echo "$dir pasta não existe\n"; if (mkdir($dir, 0777, true)) { echo "$dir pasta foi criada\n"; } else { showError("Erro ao criar pasta '$dir'\n"); } } if (file_put_contents($file, $html)) { echo "Arquivo salvo '$file'"; } else { showError("Erro ao salvar arquivo '$file'\nAs possíveis causas são falta de permissão de gravação ou caminho de arquivo incorreto!"); } } else { showError('O nome do arquivo está vazio!'); } } else { showError('O conteúdo HTML está vazio!'); } } Espero que possam entender o que preciso aqui....  fico no aguardo!  quando eu tento mudar a forma de salva no php, ele me da erro de que não foi salvo, e volta ao orginal como esta ai acima ele salva, talvez eu esteja escapando alguma coisa que não estou vendo.... 
    • Por juliosonic
      Boa noite..
      Estou desenvolvendo um site de https://www.maithunatantra.com.br/ e estou com um duvida sobre o menu de navegação da versão mobile.
      O menu que tem o dropdown "Terapeutas" e "Terapias" quando clico em cima ele expande como deve ser, mas quando clico denovo para recolher os submenus
      nao acontece nada.. segue o trecho do codigo do menu..
      <div class="collapse navbar-collapse" id="navbarsExample09">             <ul class="navbar-nav ml-auto">               <li class="nav-item  active"><a class="nav-link" href="index.html">Home</a></li>               <li class="nav-item  active"><a class="nav-link" href="about-us.html">Quem Somos</a></li>               <li class="nav-item dropdown1">                     <a class="nav-link dropdown-toggle" data-toggle="dropdown1" href="#">Terapeutas</a>                     <ul class="dropdown-menu">                         <li><a class="dropdown-item" href="terapeuta-julio-cezar.html">Julio Cezar</a></li>                         <li><a class="dropdown-item" href="terapeuta-pamela-priscila.html">Pamela Priscila</a></li>                     </ul>                                    </li>               <li class="nav-item dropdown">                     <a class="nav-link dropdown-toggle" data-toggle="dropdown1" href="#">Terapias</a>                     <ul class="dropdown-menu" aria-labelledby="dropdown01">                         <li><a class="dropdown-item" href="o-que-e-reiki.html">O que é Reiki</a></li>                         <li><a class="dropdown-item" href="beneficios-reiki.html">Benefícios do Reiki</a></li>                         <li><a class="dropdown-item" href="principios-reiki.html">Princípios do Reiki</a></li>                         <li><a class="dropdown-item" href="animais-reiki.html">Reiki em Animais</a></li>                         <li><a class="dropdown-item" href="animais-reiki.html">Estudos Sobre Reiki</a></li>                         <li><a class="dropdown-item" href="terapia-massagem-tantrica.html">Terapia Tântrica</a></li>                     </ul>               </li>               <li class="nav-item  active"><a class="nav-link" href="blog.html">Blog</a></li>                <li class="nav-item"><a class="nav-link" href="contato.html">Contato</a></li>             </ul>         </div>  
      Massagem Tantrica em Curitiba
      Tantra Curitiba
      Massagem Tântrica
      Tantra
      Julio Darshan

      Obrigado
      Att
      Julio Cezar
       
       
       
    • Por Felipe Medeiros
      Bom, criei um tema filho e o que aprendi é que para alterar qualquer coisa do tema filho eu preciso copiar o arquivo do tema pai o colocar dentro da pasta do tema filho.
       
      No meu caso, estou usando o tema "Astra" bem famosinho. O arquivo css que quero modificar não está dentro da pasta do tema pai, está em "wp-content/uploads/uag-plugin/assets/0/uag-css-10.css" sendo que o diretorio do tema pai é "wp-content/themes/Astra"
       
      O problema é o seguinte, preciso modificar a barra de pesquisa da pagina inicial, porem o inspetor de elementos do chrome ta acusando que esse arquivo é o responsavel por estilizar a barra de pesquisa. Será que isso tem a ver com "Cache de objetos", eu sei que o plugin liteSpeed Cache, AMP, Rank Math, todos eles tem essas paradas de criar arquivos css e js para tornar o site mais rapido.
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.