218 lines
8.4 KiB
PHP
Executable File
218 lines
8.4 KiB
PHP
Executable File
<?php
|
|
include_once ("php/config.php");
|
|
$UTENTE = login();
|
|
isadmin();
|
|
?>
|
|
<?php include_once ("top.php"); ?>
|
|
|
|
<META HTTP-EQUIV="Refresh" CONTENT="30" URL="main.php">
|
|
|
|
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
|
<tr><td class="spaziov" colspan="9"><img src="img/spazio.gif"></td></tr>
|
|
<?php
|
|
$query_log = "(select log_server.id, log_server.idazione, log_server.data, log_server.stato, log_server.testo, firewall.nome FROM log_server JOIN firewall ON log_server.fw = firewall.id where fw=0 AND TIMESTAMPDIFF(DAY, log_server.data, NOW()) < 7 order by log_server.id desc limit 5)";
|
|
|
|
$query = "SELECT id, nome, attivo, aggiornamenti, ultimoconn, TIMESTAMPDIFF(MINUTE,ultimoconn, NOW()) AS tempo_conn, TIMESTAMPDIFF(MINUTE,ultimosync, NOW()) AS tempo_sync, errore, msg_err FROM firewall WHERE id > 0";
|
|
$res = mysql_query( $query, $DB_ID );
|
|
while ($dato = mysql_fetch_array ( $res )) {
|
|
$id_fw = $dato['id'];
|
|
$query_log = "$query_log UNION (select log_server.id, log_server.idazione, log_server.data, log_server.stato, log_server.testo, firewall.nome FROM log_server JOIN firewall ON log_server.fw = firewall.id where fw=$id_fw order by log_server.id desc limit 5)";
|
|
|
|
$query_azioni = "SELECT MAX(datains) AS datains, MAX(dataexec) AS dataexec, count(datains)-count(dataexec) AS conta FROM azioni WHERE fw = $id_fw AND ignora = 0 GROUP BY azioni.fw";
|
|
$res_azioni = mysql_query( $query_azioni, $DB_ID );
|
|
if ($dato_azioni = mysql_fetch_array ( $res_azioni )) {
|
|
$dato = array_merge ($dato, $dato_azioni);
|
|
}
|
|
|
|
$stato_testo = "OK";
|
|
$stato_immagine = "img/OK.png";
|
|
$stato_img = "OK";
|
|
$stato_url1 = "";
|
|
$stato_url2 = "";
|
|
|
|
$sync_testo = "Sistema sincronizzato";
|
|
$sync_immagine = "img/applica.png";
|
|
$sync_url1 = "";
|
|
$sync_url2 = "";
|
|
|
|
$rig_testo = "Rigenerazione regole";
|
|
$rig_immagine = "img/rigenera.png";
|
|
$rig_url1 = "<a href=\"gestfw.php?id=$id_fw&azione=rigenera\">";
|
|
$rig_url2 = "</a>";
|
|
|
|
if ($CONF['errore']) {
|
|
$stato_testo = $CONF['errore_msg'];
|
|
$stato_immagine = "img/errore.png";
|
|
$sync_testo = "";
|
|
$sync_immagine = "img/niente.png";
|
|
$rig_testo = "";
|
|
$rig_immagine = "img/niente.png";
|
|
$rig_url1 = "";
|
|
$rig_url2 = "";
|
|
} else if ($dato['tempo_conn'] == NULL) {
|
|
$stato_testo = "Il server non si e' mai collegato";
|
|
$stato_immagine = "img/neverseen.png";
|
|
$sync_testo = "";
|
|
$sync_immagine = "img/niente.png";
|
|
$rig_testo = "";
|
|
$rig_immagine = "img/niente.png";
|
|
$rig_url1 = "";
|
|
$rig_url2 = "";
|
|
} else if ($dato['errore']) {
|
|
$stato_testo = $dato['msg_err'];
|
|
$stato_immagine = "img/errore.png";
|
|
switch ($dato['errore']) {
|
|
case 1:
|
|
// Manca directory conf sul server
|
|
$sync_testo = "";
|
|
$sync_immagine = "img/niente.png";
|
|
$rig_testo = "";
|
|
$rig_immagine = "img/niente.png";
|
|
$rig_url1 = "";
|
|
$rig_url2 = "";
|
|
$stato_url1 = "<a href=\"gestfw.php?id=$id_fw&azione=creadir\">";
|
|
$stato_url2 = "</a>";
|
|
$stato_img = "Forza la creazione della directory";
|
|
break;
|
|
case 2:
|
|
// Mancanza connessione dal server
|
|
$stato_testo = "Il server non si collega da ".$dato['tempo_conn']." minuti";
|
|
$stato_immagine = "img/disconnesso.gif";
|
|
$sync_testo = "";
|
|
$sync_immagine = "img/niente.png";
|
|
$rig_testo = "";
|
|
$rig_immagine = "img/niente.png";
|
|
$rig_url1 = "";
|
|
$rig_url2 = "";
|
|
break;
|
|
|
|
}
|
|
} else if ( $dato['aggiornamenti'] == 1 ) {
|
|
$stato_testo = "Sistema in attesa di sincronizzazione";
|
|
$stato_immagine = "img/warning.gif";
|
|
$sync_testo = "Sistema in attesa di sincronizzazione";
|
|
$sync_immagine = "img/necessitasync.gif";
|
|
$rig_testo = "";
|
|
$rig_immagine = "img/niente.png";
|
|
$rig_url1 = "";
|
|
$rig_url2 = "";
|
|
} else if ( $dato['aggiornamenti'] == 2 ) {
|
|
if ($dato['tempo_sync'] < $CONF['timeout_server'] ) {
|
|
$stato_testo = "Sistema in sincronizzazione";
|
|
$stato_immagine = "img/warning.gif";
|
|
$sync_testo = "Sistema in sincronizzazione";
|
|
$sync_immagine = "img/necessitasync.gif";
|
|
$rig_testo = "";
|
|
$rig_immagine = "img/niente.png";
|
|
$rig_url1 = "";
|
|
$rig_url2 = "";
|
|
} else {
|
|
$stato_testo = "Errore in fase di sincronizzazione";
|
|
$stato_immagine = "img/errore.png";
|
|
$stato_url1 = "<a href=\"gestfw.php?id=$id_fw&azione=applica\">";
|
|
$stato_url2 = "</a>";
|
|
$stato_img = "Forza la sincronizzazione delle regole";
|
|
$sync_testo = "";
|
|
$sync_immagine = "img/niente.png";
|
|
$rig_testo = "";
|
|
$rig_immagine = "img/niente.png";
|
|
$rig_url1 = "";
|
|
$rig_url2 = "";
|
|
}
|
|
} else if ($dato['conta'] > 0) {
|
|
$stato_testo = $dato['conta']." elementi da sincronizzare";
|
|
$stato_immagine = "img/warning.gif";
|
|
$sync_testo = "Il sistema necessita' una sincronizzazione";
|
|
$sync_immagine = "img/richiedisync.gif";
|
|
$sync_url1 = "<a href=\"gestfw.php?id=$id_fw&azione=applica\">";
|
|
$sync_url2 = "</a>";
|
|
}
|
|
|
|
?>
|
|
<tr>
|
|
<td rowspan=3 class="icona">
|
|
<?php if ($dato['attivo']) { ?>
|
|
<a href="gestfw.php?id=<?php print $id_fw ?>&azione=disattiva"><img border=0 src="img/attivo.gif" ALT="Server attivato" TITLE="Server Attivato"></a>
|
|
<?php } else { ?>
|
|
<a href="gestfw.php?id=<?php print $id_fw ?>&azione=attiva"><img border=0 src="img/non_attivo.gif" ALT="Server disattivato" TITLE="Server disattivato"></a>
|
|
<?php } ?>
|
|
</td>
|
|
<td rowspan=3 class="icona"><?php print $stato_url1 ?><img src="<?php print $stato_immagine ?>" border="0" ALT="<?php print $stato_img ?>" TITLE="<?php print $stato_img ?>"><?php print $stato_url2 ?></td>
|
|
<td class="col0"><?php print $dato['nome'] ?></td>
|
|
<td class="spazioh"><img src="img/spazio.gif"></td>
|
|
<td class="spazioh"><img src="img/spazio.gif"></td>
|
|
<td class="col3campo2">Ultima connessione: </td>
|
|
<td class="col3campo2"><?php print $dato['ultimoconn'] ?></td>
|
|
<td rowspan=3 class="icona"><?php print $sync_url1 ?><img border=0 src="<?php print $sync_immagine ?>" ALT="<?php print $sync_testo ?>" TITLE="<?php print $sync_testo ?>"><?php print $sync_url2 ?></td>
|
|
<td rowspan=3 class="icona"><?php print $rig_url1 ?><img border=0 src="<?php print $rig_immagine ?>" ALT="<?php print $rig_testo ?>" TITLE="<?php print $rig_testo ?>"><?php print $rig_url2 ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" class="col3campo2">Stato: <?php print $stato_testo ?></td>
|
|
<td class="spazioh"><img src="img/spazio.gif"></td>
|
|
<td class="col3campo2">Ultimo inserimento: </td>
|
|
<td class="col3campo2"><?php print $dato['datains'] ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" class="spazioh"><img src="img/spazio.gif"></td>
|
|
<td class="col3campo2">Ultima esecuzione: </td>
|
|
<td class="col3campo2"><?php print $dato['dataexec'] ?></td>
|
|
</tr>
|
|
<tr><td class="spaziov" colspan="9"><img src="img/spazio.gif"></td></tr>
|
|
<?php } ?>
|
|
<tr><td class="spaziov" colspan="9"><img src="img/spazio.gif"></td></tr>
|
|
<tr><td colspan="9" align="center">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="icona"><img src="img/spazio.gif"></td>
|
|
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
|
|
<td class="valoretxt" width="150">Server</td>
|
|
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
|
|
<td class="valoretxt" width="150">Testo</td>
|
|
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
|
|
<td class="valoretxt" width="150">Data</td>
|
|
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
|
|
</tr>
|
|
<?php
|
|
$query_log = "$query_log order by id desc";
|
|
$res = mysql_query( $query_log, $DB_ID );
|
|
while ($dato = mysql_fetch_array ( $res )) {
|
|
$idazione = $dato['idazione'];
|
|
$data = $dato['data'];
|
|
$stato = $dato['stato'];
|
|
$testo = $dato['testo'];
|
|
$nome = $dato['nome'];
|
|
switch ($stato) {
|
|
case 0:
|
|
$icona = "img/OK.png";
|
|
break;
|
|
case 1:
|
|
$icona = "img/disconnesso.gif";
|
|
break;
|
|
case 2:
|
|
$icona = "img/errore.png";
|
|
break;
|
|
|
|
|
|
default:
|
|
$icona = "img/errore.png";
|
|
break;
|
|
}
|
|
?>
|
|
<tr>
|
|
<td class="icona"><img src="<?php print $icona ?>"></td>
|
|
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
|
|
<td class="defruletxt" width="150"><?php print $nome ?></td>
|
|
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
|
|
<td class="defruletxt" width="150"><?php print $testo ?></td>
|
|
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
|
|
<td class="defruletxt" width="150"><?php print $data ?></td>
|
|
<td><img src="img/spazio.gif" width="20" height="1" alt=""></td>
|
|
</tr>
|
|
<?php } ?>
|
|
</table>
|
|
</td></tr>
|
|
</table>
|
|
|
|
<img src="img/spazio.gif" width="1" height="20" alt="">
|
|
<?php include_once ("footer.php"); ?>
|