TransWar File Browser

Path: C:\

<?php
echo "<meta HTTP-EQUIV='refresh' CONTENT='90;URL=index.php?prog=programa2'>";
if (isset($_GET['som'])) {$som=$_GET['som'];} else {$som="0";}
if ($som=='1'){echo"<embed src='painel/tone.mp3' width='1' height='1'>";}
?>
<!DOCTYPE html>
<html lang="pt-br">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
    <title>Painel</title>
    <link rel="icon" type="image/png" href="favicon.ico">
    <link href="css/bootstrap.css" rel="stylesheet">    
    <link href="css/style.css" rel="stylesheet" type="text/css" />
  </head>
  <style>
    #figura {
      margin: 0 auto; 
      width: 100vh;
      height: 100vh;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-content: center;
      align-items: center
    }
    #teste {
      margin: 0 auto; 
      height: 100vh;
      width: 100vh;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-content: center;
      align-items: center;
      min-width: 0;
      min-height: 0;
    }
    table.blue { table-layout:fixed; }
    table.blue th,td { overflow: hidden;word-wrap: break-word;}
  </style>
<?php
ini_set('max_execution_time',1200); 
date_default_timezone_set('America/Sao_Paulo');
$dateadded = date("d-m-Y");
$dateadd = date("d-m-Y"); 
$hoje=date('G:i');

$semana=date('w');if($semana==1){$cont=2;}else{$cont=1;}
$diainicio=date('Y-m-d', strtotime($dateadded. ' - '.$cont.' days'));
//$hoje=date('G:i', strtotime($hoje. ' - 1 hours'));

require_once("../conexao_srvtms.php");
$diasemana = array('(Domingo)', '(Segunda)', '(Terça)', '(Quarta)', '(Quinta)', '(Sexta)', '(Sabado)');
$img = array('','<img src="imagens/atenção.png" width="20" height="20" class="alerta"','<img src="imagens/ok.png" width="20" height="20" class="ok"','');

$consulta = sqlsrv_query( $conn, "SELECT id_Caderno as caderno
    ,id_Manifesto as manifesto
    ,Motorista as motorista
    ,Placa as placa   
    ,Veiculo as veiculo
    ,Carreta as carreta
    ,rtrim(Tipo) as tipo
    ,convert(varchar(10),dt_Prevista,105) as prevista
    ,hr_Prevista as hr_prevista
    ,Coment as coment
    ,convert(varchar(10),dt_Saida,105) as previsao
    ,Ajudante as ajudante
    ,Final as destino
    ,Clientes as cliente
    ,Liberado as liberado
    ,Check3 as check3 
    ,Check4 as check4 
    ,Check5 as check5 
  FROM tbdCaderno 
  WHERE (rtrim(Tipo)='MANUTENÇÃO' or rtrim(Tipo)='GESTÃO') or (Liberado<>'LIBERAR' and Liberado<>'FINALIZAR' and id_Cliente='497' and convert(varchar(10),dt_Prevista,120)>='$diainicio')
  ORDER BY dt_Prevista, hr_prevista, id_Manifesto ASC", array(), array( "Scrollable" => SQLSRV_CURSOR_KEYSET ));

$num = sqlsrv_num_rows($consulta);$t=0; $z=1;$dataANT='';
if ( $num > 0 )
{ $data[0]='Gestão de Carretas';$data[1]='Manutenção';$x[0]=0;$x[1]=0;
  while ($rows = sqlsrv_fetch_array($consulta, SQLSRV_FETCH_ASSOC)) 
  { if ($rows['caderno']<>1 and $rows['tipo']=='GESTÃO')
    { $id[0][$x[0]] = $rows [ "caderno" ];
      $manifesto[0][$x[0]] = trim($rows ["manifesto"]);
      $motorista[0][$x[0]] = trim($rows["motorista"]);
      $veiculo[0][$x[0]] = trim($rows ["veiculo"]);
      $placa[0][$x[0]] = trim($rows ["placa"]);
      $carreta[0][$x[0]] = trim($rows ["carreta"]);
      $tipo9[0][$x[0]] = trim($rows ["tipo"]);
      $NR = trim($rows["cliente"]);$b1=strlen($NR);
      $b= strpos($NR, ",");
      if ($b===0){$NR=trim(substr($NR,1,$b1));$b= strpos($NR, ",");}
      if ($b>0 and $b!=='' and $b!==null){$cliente[0][$x[0]]=substr($NR, 0, $b);}else{$cliente[0][$x[0]]=$NR;}
      $destino[0][$x[0]] = trim($rows["destino"]);
      $hr_prevista[0][$x[0]] = trim($rows ["hr_prevista"]);
      $previsao[0][$x[0]] = $rows["previsao"];
      $ajudante[0][$x[0]] = trim($rows["ajudante"]);
      $coment[0][$x[0]] = trim($rows ["coment"]);
      $check[0][$x[0]] = $rows ["check3"];
      $img3[0][$x[0]] =$img[$check[0][$x[0]]];
      $pasta[0][$x[0]] = $rows ["check4"];
      $img4[0][$x[0]] =$img[$pasta[0][$x[0]]];
      $sm[0][$x[0]] = $rows ["check5"];
      $img5[0][$x[0]] =$img[$sm[0][$x[0]]];
      $x[0]++;$t++;
    }
    else
    { if ($rows['caderno']<>1 and $rows['tipo']=='MANUTENÇÃO')
      { $id[1][$x[1]] = $rows [ "caderno" ];
        $manifesto[1][$x[1]] = trim($rows ["manifesto"]);
        $motorista[1][$x[1]] = trim($rows["motorista"]);
        $veiculo[1][$x[1]] = trim($rows ["veiculo"]);
        $placa[1][$x[1]] = trim($rows ["placa"]);
        $carreta[1][$x[1]] = trim($rows ["carreta"]);
        $tipo9[1][$x[1]] = trim($rows ["tipo"]);
        $NR = trim($rows["cliente"]);$b1=strlen($NR);
        $b= strpos($NR, ",");
        if ($b===0){$NR=trim(substr($NR,1,$b1));$b= strpos($NR, ",");}
        if ($b>0 and $b!=='' and $b!==null){$cliente[1][$x[1]]=substr($NR, 0, $b);}else{$cliente[1][$x[1]]=$NR;}
        $destino[1][$x[1]] = trim($rows["destino"]);
        $hr_prevista[1][$x[1]] = trim($rows ["hr_prevista"]);
        $previsao[1][$x[1]] = $rows["previsao"];
        $ajudante[1][$x[1]] = trim($rows["ajudante"]);
        $coment[1][$x[1]] = trim($rows ["coment"]);
        $check[1][$x[1]] = $rows ["check3"];
        $img3[1][$x[1]] =$img[$check[1][$x[1]]];
        $pasta[1][$x[1]] = $rows ["check4"];
        $img4[1][$x[1]] =$img[$pasta[1][$x[1]]];
        $sm[1][$x[1]] = $rows ["check5"];
        $img5[1][$x[1]] =$img[$sm[1][$x[1]]];
        $x[1]++;$t++;
      }
      else
      { if ($rows['caderno']<>1)
        {
          if ($dataANT<>$rows['prevista']){$z++; $x[$z]=0; $dataANT=$rows['prevista'];}
          $data[$z]=$rows['prevista'];
          $id[$z][$x[$z]] = $rows [ "caderno" ];
          $manifesto[$z][$x[$z]] = trim($rows ["manifesto"]);
          $motorista[$z][$x[$z]] = trim($rows["motorista"]);
          $veiculo[$z][$x[$z]] = trim($rows ["veiculo"]);
          $placa[$z][$x[$z]] = trim($rows ["placa"]);
          $carreta[$z][$x[$z]] = trim($rows ["carreta"]);
          $tipo9[$z][$x[$z]] = trim($rows ["tipo"]);
          $NR = trim($rows["cliente"]);$b1=strlen($NR);
          $b= strpos($NR, ",");
          if ($b===0){$NR=trim(substr($NR,1,$b1));$b= strpos($NR, ",");}
          if ($b>0 and $b!=='' and $b!==null){$cliente[$z][$x[$z]]=substr($NR, 0, $b);}else{$cliente[$z][$x[$z]]=$NR;}
          $destino[$z][$x[$z]] = trim($rows["destino"]);
          $hr_prevista[$z][$x[$z]] = trim($rows ["hr_prevista"]);
          $previsao[$z][$x[$z]] = $rows ["previsao"];
          $ajudante[$z][$x[$z]] = trim($rows["ajudante"]);
          $coment[$z][$x[$z]] = trim($rows ["coment"]);
          $check[$z][$x[$z]] = $rows ["check3"];
          $img3[$z][$x[$z]] =$img[$check[$z][$x[$z]]];
          $pasta[$z][$x[$z]] = $rows ["check4"];
          $img4[$z][$x[$z]] =$img[$pasta[$z][$x[$z]]];
          $sm[$z][$x[$z]] = $rows ["check5"];
          $img5[$z][$x[$z]] =$img[$sm[$z][$x[$z]]];
          $x[$z]++;$t++;
        }
      }
    }
  }
}
echo'<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="10000" data-pause="false">
        <div class="carousel-inner" role="listbox">';
$pt=0;$controle_ativo = 2;
for ($q=0; $q <= $z; $q++) 
{ $tp=ceil($x[$q]/10);$off=0;$lim=10;$page=1;
  if ($tp==0){$tp=1;} 
  if ($q>=2){$dia=date('w', strtotime($data[$q]));$datasemana=' - '.$diasemana[$dia];}else{$dia=date('w', strtotime($dateadd));$datasemana='';}
  for ($p=1;$p<=$tp;$p++) 
  { if($controle_ativo == 2){ $class="item active";$controle_ativo=1;}else{$class="item";}
    $off=($page-1)*$lim;$max=$off+$lim;$max = ($max > $x[$q] ? $x[$q] : $max);$pt++;
    include 'painel.php';
    $page++;
  }
}
$query3 = sqlsrv_query($conn,"SELECT 
     titulo
    ,subtitulo
    ,corpo
    ,verfundo
    ,ver1
    ,ver2
    ,fundo
    ,anuncio1
    ,anuncio2
   FROM [dtbAuxiliar].[dbo].[tbdPainel]
  WHERE id_Painel=1", array(), array( "Scrollable" => SQLSRV_CURSOR_KEYSET ));
while ($res = sqlsrv_fetch_array($query3, SQLSRV_FETCH_ASSOC))
  {
    $titulo     =trim($res["titulo"]);
    $subtitulo  =trim($res["subtitulo"]);
    $corpo      =trim($res["corpo"]);
    $verfundo   =trim($res["verfundo"]);
    $ver1       =trim($res["ver1"]);
    $ver2       =trim($res["ver2"]);
    $fundo      =trim($res["fundo"]);
    $anuncio1   =trim($res["anuncio1"]);
    $anuncio2   =trim($res["anuncio2"]);
  }
if ($verfundo=='SIM' or $ver1=='SIM' or $ver2=='SIM' or $t==0)
{ if ($t==0){$item = 'item active';}else{$item = 'item';}

if ($verfundo=='SIM')
  {
  echo' <div class="'.$item.'" id="page">
  <div id="teste" style="background: url(\'painel/'.$fundo.'G.jpg\') no-repeat; background-size:cover;">
          <table  align="center">
            <tr>
              <td align="center" ><h2><strong>'.$titulo.'</strong></h2></td>
            </tr>';
    if ($subtitulo!=''){   echo     '<tr >
              <td align="center" width="100%"><h3><strong>'.$subtitulo.'</strong></h3></td>
            </tr>';}
      echo      '<tr>
              <td align="center" width="100%" ><h3><strong>'.$corpo.'</strong></h3></td>
            </tr>
          </table></div>
        </div>';
  }
if ($ver1=='SIM' or $t==0)
  {
  echo' <div class="'.$item.'" id="page" >
          <img id="figura" src="painel/'.$anuncio1.'G.jpg" >
        </div>';$item = 'item';
  }
if ($ver2=='SIM' or $t==0)
  {
  echo' <div class="item" id="page" >
          <img id="figura" src="painel/'.$anuncio2.'G.jpg" >
        </div>';
  }
}  
  echo'</div></div>';
?>
<div id="lista" ></div> 
  <script src="js/jquery-1.11.3.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
</html>