TransWar File Browser

Path: C:\

<?php
session_start();
ini_set('max_execution_time',259200); 
ini_set ('memory_limit','1536M');
require_once("API07_MobileRestHandler.php");
date_default_timezone_set('America/Sao_Paulo');
$dtlimite = date("Ymd"); 
if (isset($_POST['dia1'])){$inicio=$_POST['dia1'];}
if (isset($_POST['dia2'])){$final=$_POST['dia2'];}
$grupo='17';$ds_grupo="CRODA";
$ano1=substr($inicio, 6);
$mes1=substr($inicio, 3,-5);
$dia1=substr($inicio, 0,-8);
$data1=$ano1.$mes1.$dia1;
$ano2=substr($final, 6);
$mes2=substr($final, 3,-5);
$dia2=substr($final, 0,-8);
$data2=$ano2.$mes2.$dia2;
$mobileRestHandler = new MobileRestHandler();
$linha = $mobileRestHandler->getMobile($data1, $data2, $grupo, $ds_grupo);
$lin=count($linha);
$nf='n';
for ($q=0; $q <= 150; $q++) {$tot_entrega[$q]=0;$tot_coleta[$q]=0;$tot[$q]=0;} 

$matriz = file_get_contents('upload/matriz.json');
$principal=json_decode($matriz, true);
$oc=count($principal);
$x1=0;for ($x=0;$x<$oc;$x++)
{ if($principal[$x]['cor']=='black')
  { $x1++;$black[$x1]=$principal[$x]['id'];}
}$x1++;$black[$x1]=108;
$x3=0;for ($x=0;$x<$oc;$x++)
{ if($principal[$x]['cor']=='green')
  { $x3++;$green[$x3]=$principal[$x]['id'];}
}

$custo1=$_SESSION['custo1'];
$custo2=$_SESSION['custo2'];
$custo3=$_SESSION['custo3'];
$z=1;
for ($q=1; $q <= $lin; $q++) 
{ $ind=intval($linha[$q][25]);	//pega o ID da ocorrĂȘncia
  $stop=0;for($i=1;$i<$x1;$i++){if($ind==$black[$i]){$stop=1;}}
  if($stop==0)
  { $stop=1;
    if(($custo1==1and$linha[$q][39]==171)or($custo2==1and$linha[$q][39]==170)or($custo3==1and$linha[$q][39]==169)or($linha[$q][7]=='COLETA')or($linha[$q][39]===null))
      {$stop=0;}
  }
  if($stop==0)
  { $linha2[$z]=$linha[$q];$z++;
  }
}
$json = json_encode($linha2); // Isto ira converter a array em json
$_SESSION['json2']     =$json;
$_SESSION['inicio2']   =$inicio;
$_SESSION['final2']    =$final;
if($_SESSION['link']==5){header("Location: API12.php");}else{if($_SESSION['link']==6){header("Location: API12_coleta.php");}else{header("Location: API03.php");}}
?>