Good afternoon, I have an array in PHP that shows the date the last backup of each store was made, and the information is shown as follows:
LOJA01 - Bkp 01 teve o ultimo backup em1: 02-01-2017.
LOJA01 - Bkp 02 teve o ultimo backup em3: 30-12-2016.
LOJA01 - Bkp 03 teve o ultimo backup em3: 31-12-2016.
LOJA03 - Bkp 01 teve o ultimo backup em1: 10-12-2016.
LOJA03 - Bkp 02 teve o ultimo backup em1: 11-12-2016.
LOJA03 - Bkp 03 teve o ultimo backup em1: 09-12-2016.
LOJA05 - Bkp 01 teve o ultimo backup em1: 10-12-2016.
LOJA05 - Bkp 02 teve o ultimo backup em1: 11-12-2016.
LOJA05 - Bkp 03 teve o ultimo backup em1: 09-12-2016.
LOJA06 - Bkp 01 teve o ultimo backup em1: 11-12-2016.
LOJA06 - Bkp 02 teve o ultimo backup em1: 11-12-2016.
LOJA06 - Bkp 03 teve o ultimo backup em1: 09-12-2016.
I would like to know if there is any way with each different store that it skips a line or separate, notice that each store has bkp 01, 02 and 03 ...
The output I'd like would look something like this:
LOJA01 - Bkp 01 teve o ultimo backup em1: 02-01-2017.
LOJA01 - Bkp 02 teve o ultimo backup em3: 30-12-2016.
LOJA01 - Bkp 03 teve o ultimo backup em3: 31-12-2016.
LOJA03 - Bkp 01 teve o ultimo backup em1: 10-12-2016.
LOJA03 - Bkp 02 teve o ultimo backup em1: 11-12-2016.
LOJA03 - Bkp 03 teve o ultimo backup em1: 09-12-2016.
LOJA05 - Bkp 01 teve o ultimo backup em1: 10-12-2016.
LOJA05 - Bkp 02 teve o ultimo backup em1: 11-12-2016.
LOJA05 - Bkp 03 teve o ultimo backup em1: 09-12-2016.
LOJA06 - Bkp 01 teve o ultimo backup em1: 11-12-2016.
LOJA06 - Bkp 02 teve o ultimo backup em1: 11-12-2016.
LOJA06 - Bkp 03 teve o ultimo backup em1: 09-12-2016.
My Array looks like this:
<?php
error_reporting(0);
ini_set(“display_errors”, 0 );
$lista_lojas = array(
"LOJA01 - Bkp 01" => "servers/01/bk001/Mpcfg.ini",
"LOJA01 - Bkp 02" => "servers/01/bk002/Mpcfg.ini",
"LOJA01 - Bkp 03" => "servers/01/bk003/Mpcfg.ini",
"LOJA03 - Bkp 01" => "servers/03/bk001/Mpcfg.ini",
"LOJA03 - Bkp 02" => "servers/03/bk002/Mpcfg.ini",
"LOJA03 - Bkp 03" => "servers/03/bk003/Mpcfg.ini",
"LOJA05 - Bkp 01" => "servers/05/bk001/Mpcfg.ini",
"LOJA05 - Bkp 02" => "servers/05/bk002/Mpcfg.ini",
"LOJA05 - Bkp 03" => "servers/05/bk003/Mpcfg.ini",
"LOJA06 - Bkp 01" => "servers/06/bk001/Mpcfg.ini",
"LOJA06 - Bkp 02" => "servers/06/bk002/Mpcfg.ini",
"LOJA06 - Bkp 03" => "servers/06/bk003/Mpcfg.ini",
);
?>
Page that displays array data:
<?php
date_default_timezone_set('America/Sao_Paulo');
// Inclui o arquivo com os caminhos dos PLUEAN.BIN
include_once('includes/array_servers.php');
foreach($lista_lojas as $l_nome => $l_caminho)
{ ?>
<?php
$today = date('d-m-Y'); //recebe a data atual
$seconds = strtotime($today); //converte para segundos
$diff_date = date("d-m-Y",($seconds - 345600));
$data_antiga = "31-12-1969";
// echo $diff_date;
$data_mod = date ("d-m-Y", filemtime($l_caminho));
//echo $data_obsoleta;
if (($data_mod <= $diff_date) and ($lojaAt == $lojaAt))
{ ?>
<img src="img/down.png" width="15" height="15"/>
<?php echo "$l_nome teve o ultimo backup em1: " . date ("d-m-Y.", filemtime($l_caminho));
echo $lojaAt; echo "<br>" ;
} elseif (($data_mod == $data_antiga) and ($lojaAt == $lojaAt))
{?>
<img src="img/down.png" width="15" height="15"/>
<?php echo "$l_nome teve o ultimo backup em2: " . date ("d-m-Y.", filemtime($l_caminho));
echo $lojaAt; echo "<br>" ;
} elseif (($data_mod >= $diff_date) and ($lojaAt == $lojaAt))
{?>
<img src="img/up.png" width="15" height="15"/>
<?php echo "$l_nome teve o ultimo backup em3: " . date ("d-m-Y.", filemtime($l_caminho));
echo $lojaAt; echo "<br>" ;
} else
?>
<?php } ?>