TransWar File Browser

Path: C:\

<?php
date_default_timezone_set('America/Sao_Paulo');
$hoje = date("d-m-Y");
ini_set('max_execution_time', 6000); //300 seconds = 5 minutes
$erro='Sem Erro';$achou='S';$a=0;
if (isset($_POST['dsgrupo'])){$ds_grupo=$_POST['dsgrupo'];}else{$ds_grupo='';}
?>
<!DOCTYPE html>
<html lang='pt-br'>
<head>
<meta charset='utf-8'/>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Expires" content="0" />
<meta content='width=device-width, initial-scale=1, maximum-scale=1' name='viewport'>
<title>TransWar</title>
<link rel='icon' type='image/png' href='images/favicon.ico'>
<link href="css/estilo.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/redmond/jquery-ui-1.10.1.custom.css" />
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-theme.min.css" rel="stylesheet">
<link href="css/theme.css" rel="stylesheet">
<link href="css/signin.css" rel="stylesheet">
<script src='js/jquery.min.js'></script>
<script src="js/ie-emulation-modes-warning.js"></script>
</head> 
<body role='document'> 
<div class="container">   
<table width="100%"> 
<tr> 
<td align='center'>
<h2><span class="label label-primary">&nbsp;Notas Fiscais Aguardando Liberação :&nbsp;&nbsp;<span style='color: Yellow;'>Grupo <?php echo $ds_grupo;?></span></span></h2>
</td>
</tr>
<tr> 
<td height="30" colspan="2" background="images/top-menubg.gif">&nbsp;&nbsp;<?php echo $hoje; ?></td> 
</tr> 
</table>  
<div class='panel panel-primary'>
  <table class="table table-bordered" width="80%">
    <tbody>
<?php
if (isset($_POST['del']))
	{
require_once("conexao_srvtms.php");
		$arqxlsx = $_POST['arqxlsx'];
		$u = count($_POST['chave']);
		$n = count($_POST['del']);
		for ($d=0; $d<$n; $d++)
			{ $nf=$_POST['del'][$d];
				for ($i=0; $i<$u; $i++) 
					{
					if ($nf==$i) 
						{ $chave=$_POST['chave'][$nf];$nrNF=$_POST['nrNF'][$nf];
							$grava[$d]=$_POST['grava'][$nf];
							$liberarX[$d]=$_POST['liberar'][$nf];
							$coletaX[$d]=$_POST['coleta'][$nf];
							$nrNFX[$d]=$_POST['nrNF'][$nf];
							$fornecedorX[$d]=$_POST['fornecedor'][$nf];
							$destinatarioX[$d]=$_POST['destinatario'][$nf];
							$pedidoX[$d]=$_POST['pedido'][$nf];
							$chaveX[$d]=$_POST['chave'][$nf];
							include "consulta1.php";
							header('Content-Type: text/html; charset=utf-8');
							if ($achou=='S'){$textoX='➔ OK';$a++;$dow[$a]="nf-".$nrNF.".pdf";}else{$textoX='com Chave➔ '.$chave.'➔ Não Encontrado';}
							$texto[$d]='<td align="right" width="20%">PDF da Nota Fiscal </td><td align="left" width="10%">'.$_POST['nrNF'][$nf].'</td><td align="left" width="70%">'.$textoX.'</td>';
							break;
						}
					}
			}
for ($d=0; $d<$n; $d++)
{echo '<tr>'.$texto[$d].'</tr>';}
include 'liberaXLSX.php';
echo"	<tr>";
if ($a>=1){
$arqzip=substr($arqxlsx, 0, -5).'.zip';
$files_to_zip = $dow;$overwrite=false;
if(file_exists($arqzip)) { $overwrite=true; }
$diretorio = getcwd().'/NotasPDF/';
// Instancia a Classe Zip
$zip = new ZipArchive();
// Cria o Arquivo Zip, caso não consiga exibe mensagem de erro e finaliza script
if($zip->open($arqzip,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) 
	{ exit('O Arquivo ZIP não pode ser criado.');}
else
	{ // Insere os arquivos que devem conter no arquivo zip
		foreach($files_to_zip as $file) 
		{$zip->addFile($diretorio.$file,$file);}
	}
	$zip->addFile($diretorio.$arqxlsx,$arqxlsx);
// Fecha arquivo Zip aberto
$zip->close();
echo"	<form method='POST' action=''>
				<td align='center'>
					<button type='submit' class='btn btn-warning'><a href='".$arqzip."' download>Baixar ZIP</a></button>
				</td>
			</form>
";}}
echo" <form method='GET' action='grupo6.php'>
			   <td  colspan='5' align='center' colspan='2'>
			    <button type='submit' class='btn btn-success'>Voltar</button>
			   </td>
			</form>
		</tr>
";
?>
</tbody>
</table>
</div>
</div>
<p class="copyright" align="center">&copy; Copyright 2018 TransWar - Todos os direitos reservados. Versão 1.0</p> 
<br />
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="js/jquery-ui.js" type="text/javascript"></script>
<script src="js/docs.min.js"></script>
<script src="js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>