82 lines
2.9 KiB
PHP
82 lines
2.9 KiB
PHP
<?php
|
|
include_once ("core/config.php");
|
|
$UTENTE = login();
|
|
isadmin();
|
|
?>
|
|
<html>
|
|
<head>
|
|
<script type="text/javascript">
|
|
<!--
|
|
function confirmation(testo) {
|
|
alert(testo)
|
|
document.location.href='main.php'
|
|
}
|
|
//-->
|
|
</script>
|
|
|
|
<?php
|
|
if (isset($_GET['id'])) {
|
|
$id = $_GET['id'];
|
|
if (isset($_GET['azione'])) {
|
|
$azione = $_GET['azione'];
|
|
switch ($azione) {
|
|
case "attiva":
|
|
// attiva server
|
|
$query = "UPDATE firewall SET attivo = 1 WHERE id = $id";
|
|
mysql_query( $query, $DB_ID );
|
|
$testo = "Server attivato";
|
|
break;
|
|
case "disattiva":
|
|
// disattiva server
|
|
$query = "UPDATE firewall SET attivo = 0 WHERE id = $id";
|
|
mysql_query( $query, $DB_ID );
|
|
$testo = "Server disattivate";
|
|
break;
|
|
case "creadir":
|
|
$query_azioni = "INSERT INTO azioni SET fw=$id, tabella='CREADIR', idtabella=0, stato=5, datains=NOW()";
|
|
$query_fw = "UPDATE firewall SET aggiornamenti = 1 WHERE id = $id";
|
|
mysql_query( $query_azioni, $DB_ID );
|
|
mysql_query( $query_fw, $DB_ID );
|
|
$testo = "Richiesta creazione PATH configurazioni";
|
|
break;
|
|
case "applica":
|
|
$query_azioni = "INSERT INTO azioni SET fw=$id, tabella='FINE APPLICA', idtabella=0, stato=4, datains=NOW()";
|
|
$query_fw = "UPDATE firewall SET aggiornamenti = 1 WHERE id = $id";
|
|
mysql_query( $query_azioni, $DB_ID );
|
|
mysql_query( $query_fw, $DB_ID );
|
|
$testo = "Regole applicate, in attesa di sincronizzazione";
|
|
break;
|
|
case "rigenera":
|
|
$query_azioni = "UPDATE azioni SET ignora = 1 WHERE fw = $id AND ignora = 0 AND dataexec IS NULL";
|
|
mysql_query( $query_azioni, $DB_ID );
|
|
$query_azioni = "INSERT INTO azioni SET fw=$id, tabella='RESET', idtabella=0, stato=4, datains=NOW()";
|
|
mysql_query( $query_azioni, $DB_ID );
|
|
|
|
$query_device = "SELECT id FROM interfacce WHERE attivo = 1 AND stato != 3";
|
|
$res_device = mysql_query( $query_device, $DB_ID );
|
|
while ($dato_device = mysql_fetch_array ( $res_device )) {
|
|
$device_id = $dato_device['id'];
|
|
$query_azioni = "INSERT INTO azioni SET fw=$id, tabella='interfacce', idtabella=$device_id, stato=1, datains=NOW()";
|
|
mysql_query( $query_azioni, $DB_ID );
|
|
defrule_reset ($device_id, 0, $id);
|
|
}
|
|
$query_azioni = "INSERT INTO azioni SET fw=$id, tabella='FINE APPLICA', idtabella=0, stato=4, datains=NOW()";
|
|
$query_fw = "UPDATE firewall SET aggiornamenti = 1 WHERE id = $id";
|
|
mysql_query( $query_azioni, $DB_ID );
|
|
mysql_query( $query_fw, $DB_ID );
|
|
$testo = "Richiesto reset delle regole";
|
|
break;
|
|
default:
|
|
$testo = "Regola non implementata";
|
|
break;
|
|
}
|
|
?>
|
|
<script type="text/javascript">
|
|
confirmation ('<?php print $testo ?>');
|
|
</script>
|
|
<?php }
|
|
} ?>
|
|
<script type="text/javascript">
|
|
document.location.href='main.php'
|
|
</script>
|