Inizio abilitazione modulo proxy

This commit is contained in:
cmaffio
2016-03-09 15:02:46 +01:00
parent 1bacc3232e
commit a5ed0d219d
30 changed files with 576 additions and 1153 deletions

7
TODO Normal file
View File

@@ -0,0 +1,7 @@
# Moduli da implementare
- Proxy
- Firewall
- DHCP
- Routing

1
chk.php Normal file
View File

@@ -0,0 +1 @@
<?php phpinfo () ?>

View File

@@ -1,10 +1,8 @@
<?php
include_once ("config.php");
$UTENTE = login();
?>
<?php include_once ("top.php"); ?>
view_top();
<?php
if (isset ($_POST['id'])) {
$modifica = 2;
$id = $_POST['id'];
@@ -169,4 +167,4 @@ $(document).ready(function()
</form>
<?php } ?>
<?php include_once ("footer.php"); ?>
<?php view_footer(); ?>

View File

@@ -3,7 +3,8 @@ include_once ("config.php");
$UTENTE = login();
isadmin();
include_once ("top.php"); ?>
view_top();
?>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr><td class="spaziov" colspan=7><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
@@ -60,4 +61,4 @@ while ($dato = mysql_fetch_array ( $res )) {
<?php }
} ?>
</table>
<?php include_once ("footer.php"); ?>
<?php view_footer (); ?>

View File

@@ -7,5 +7,5 @@ $db_data_pwd = "Lx7w3e8dNPfwwc3z";
require_once ("function.php");
$DB_ID = db_data_connect ();
carica_conf();
$CONF = carica_conf();
?>

View File

@@ -98,13 +98,24 @@ function login () {
}
}
function carica_conf () {
function carica_conf ($modulo="") {
global $CONF, $DB_ID;
$query = "SELECT variabile, valore FROM conf";
if ($modulo != "") {
$query = "SELECT prefisso FROM moduli WHERE nome = '$modulo'";
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
$tabella = $dato['prefisso']."conf";
} else {
$tabella = "conf";
}
$query = "SELECT variabile, valore FROM $tabella";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
$CONF[$dato[0]] = $dato[1];
$tmp[$dato[0]] = $dato[1];
}
return $tmp;
}
function isadmin () {
@@ -390,7 +401,7 @@ function lista_moduli () {
<?php
}
function diritti () {
function diritti ($minimo) {
global $UTENTE, $DB_ID, $CONF;
preg_match ('/^'.preg_replace('/\//','\/',$CONF['base_url']).'\/([^\/]+)\/.*/', $_SERVER['REQUEST_URI'], $trovato);
@@ -423,7 +434,7 @@ function diritti () {
$risposta = 0;
}
if ($risposta) {
if ($risposta >= $minimo) {
return $risposta;
} else {
header("location: ".$CONF['base_url']."/index.php");
@@ -443,4 +454,14 @@ function get_levels () {
return $livelli;
}
function view_top () {
global $CONF, $UTENTE;
include_once ($_SERVER["CONTEXT_DOCUMENT_ROOT"].$CONF['base_url']."/core/top.php");
}
function view_footer () {
global $CONF, $UTENTE;
include_once ($_SERVER["CONTEXT_DOCUMENT_ROOT"].$CONF['base_url']."/core/footer.php");
}
?>

View File

@@ -1,9 +1,8 @@
<?php
include_once ("config.php");
$UTENTE = login();
//isadmin();
view_top();
?>
<?php include_once ("top.php"); ?>
<META HTTP-EQUIV="Refresh" CONTENT="30" URL="main.php">
@@ -12,4 +11,4 @@ $UTENTE = login();
</table>
<img src="img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("footer.php"); ?>
<?php view_footer(); ?>

View File

@@ -1,11 +1,9 @@
<?php
include_once ("core/config.php");
include_once ("config.php");
$UTENTE = login();
isadmin();
?>
<?php include_once ("top.php"); ?>
view_top();
<?php
if (isset ($_GET['var'])) {
$var = $_GET['var'];
$query = "SELECT * FROM conf WHERE variabile='$var'";
@@ -118,4 +116,4 @@ if (isset ($_GET['var'])) {
<?php
}
?>
<?php include_once ("footer.php"); ?>
<?php view_footer(); ?>

View File

@@ -1,4 +1,4 @@
<?php include_once ("top.php"); ?>
<?php view_top(); ?>
<form name="login" method="post">
<table cellpadding="0" cellspacing="10" border="0" id="login_table">
<tr align="center" valign="middle">
@@ -20,4 +20,4 @@
</tr>
</table>
</form>
<?php include_once ("footer.php"); ?>
<?php view_footer(); ?>

17
firewall/index.php Executable file
View File

@@ -0,0 +1,17 @@
<?php
include_once ("../core/config.php");
$UTENTE = login();
$DIRITTI = diritti();
?>
<?php view_top(); ?>
<?php view_footer(); ?>

View File

@@ -1,82 +0,0 @@
<?php
include_once ("core/config.php");
$UTENTE = login();
//isadmin();
?>
<?php include_once ("top.php");?>
<script type="text/javascript">
<!--
var stile1 = "top=30, left=30, width=600, height=400, status=no, menubar=no, toolbar=no ";
var stile2 = "top=30, left=30, width=920, height=500, status=no, menubar=no, toolbar=no ";
function Popup(apri)
{
window.open(apri, "", stile1);
}
function PopupG(apri)
{
window.open(apri, "", stile2);
}
//-->
</script>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td class="userruletxtc"><b>Attiva</b></td>
<td class="userruletxt"><b>Nome regola</b></td>
<td>&nbsp;</td>
<td class="userruletxtd"><b>Banda garantita</b></td>
<td>&nbsp;</td>
<td class="userruletxtd"><b>Banda massima</b></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<?php
livelli ($UTENTE['id']);
?>
</table>
<img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("footer.php"); ?>
<?php
function livelli ($utente) {
global $DB_ID;
$query = "SELECT * FROM defrule JOIN utenti2defrule ON defrule.id = utenti2defrule.iddefrule WHERE idutente = $utente ORDER BY priorita";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
?>
<tr>
<td width="8" align="center" nowrap>
<?php if ($dato['attivo']) { ?>
<img border=0 src="<?php print $CONF['base_url'] ?>/img/attivo.gif" ALT="Regola attiva" TITLE="Regola attiva"></a>
<?php } else { ?>
<img border=0 src="<?php print $CONF['base_url'] ?>/img/non_attivo.gif" ALT="Regola non attiva" TITLE="Regola non attiva"></a>
<?php } ?>
</td>
<td class="userruletxt" nowrap><?php print $dato['descrizione'] ?></td>
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
<td class="userruletxtd" align="center" nowrap><?php printf ("%0.2f Mb/sec",$dato['rate']) ?></td>
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
<td class="userruletxtd" nowrap><?php printf ("%0.2f Mb/sec",$dato['ceil']) ?></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<?php if ($dato['stato'] != 4) { ?>
<td class="spazioh"><a href="javascript:PopupG('grafico.php?device=<?php print $dato['idinterfacce'] ?>&rif=<?php print $dato['id'] ?>')"><img border="0" src="img/grafico.gif" ALT="Visualizza grafico utilizzo banda" TITLE="Visualizza grafico utilizzo banda"></a></td>
<?php } else { ?>
<td class="spazioh"><img border="0" src="img/errore.png" ALT="Regola non conforme" TITLE="Regola non conforme"></td>
<?php } ?>
</tr>
<?php }
}
?>

View File

@@ -1,23 +0,0 @@
<?php
include_once ("core/config.php");
$UTENTE = login();
isadmin();
?>
<?php include_once ("top.php");?>
<script type="text/javascript">
<!--
var stile = "top=30, left=30, width=920, height=500, status=no, menubar=no, toolbar=no ";
function PopupG(apri)
{
window.open(apri, "", stile);
}
//-->
</script>
<img src="img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("footer.php"); ?>

82
proxy/conntrack.pl Executable file
View File

@@ -0,0 +1,82 @@
#!/usr/bin/perl
$|=1;
use DBI;
my $proxy_IP = '192.168.1.3';
my $proxy_PORT = 3128;
`sysctl -w net.netfilter.nf_conntrack_acct=1`;
my $dbmysql = DBI->connect("DBI:mysql:;host=127.0.0.1", "pannello_proxy", "CuQlM1lfF4VZDCIP") or die ($DBI::errstr);
$sts = $dbmysql->prepare("use pannello_vbc");
$sts->execute ();
#/usr/sbin/conntrack -E -p tcp --dport 3128 -oextended,id,timestamp -eDESTROY
open CT, "/usr/sbin/conntrack -E -eNEW,DESTROY -otimestamp,id -p tcp --dport $proxy_PORT |" or die "non va\n";
while (<CT>) {
my $riga = $_;
# print "$riga";
if ( $riga =~ /^\s*\[(\d+)\.\d+\]\s+\[NEW\] tcp\s+\d+ \d+ \S*\s*src=(\S+) dst=(\S+) sport=\d+ dport=(\d+)\s+\[\w+\] src=\S+ dst=\S+ sport=\d+ dport=\d+ id=(\d+)/ ) {
my $remote_START = $1;
my $remote_IP = $2;
my $local_IP = $3;
my $local_PORT = $4;
my $thread_ID = $5;
my $query = " INSERT INTO
proxy_dati
(ip, thread, data_new)
VALUES
('$remote_IP', $thread_ID, FROM_UNIXTIME($remote_START))
";
# print "$query\n";
$sts = $dbmysql->prepare($query);
$sts->execute ();
# print "$riga";
}
if ( $riga =~ /^\s*\[(\d+)\.\d+\]\s+\[DESTROY\] tcp\s+\d+ src=(\S+) dst=(\S+) sport=\d+ dport=(\d+) packets=\d+ bytes=(\d+) src=\S+ dst=\S+ sport=\d+ dport=\d+ packets=\d+ bytes=(\d+) \[\w+\] id=(\d+)/) {
# next if ($2 != $proxy_IP);
# next if ($3 != $proxy_PORT);
my $remote_DESTROY = $1;
my $remote_IP = $2;
my $local_IP = $3;
my $local_PORT = $4;
my $remote_SEND = $5;
my $remote_RECEIVE = $6;
my $thread_ID = $7;
print "IP: $remote_IP - ID: $thread_ID - Invati: $remote_SEND - Ricevuti: $remote_RECEIVE\n";
my $query = " UPDATE
proxy_dati
SET
data_destroy = FROM_UNIXTIME($remote_DESTROY),
inviati = $remote_SEND,
ricevuti = $remote_RECEIVE,
tempo = TIMESTAMPDIFF(SECOND, data_new, FROM_UNIXTIME($remote_DESTROY)),
vel_inv = $remote_SEND / TIMESTAMPDIFF(SECOND, data_new, FROM_UNIXTIME($remote_DESTROY)),
vel_ric = $remote_RECEIVE / TIMESTAMPDIFF(SECOND, data_new, FROM_UNIXTIME($remote_DESTROY))
WHERE
thread = $thread_ID
AND
ip = '$remote_IP'
AND
data_destroy IS NULL
";
# print "$query\n";
$sts = $dbmysql->prepare($query);
$sts->execute ();
}
}
close CT;

View File

@@ -1,17 +1,34 @@
<?php
include_once ("../core/config.php");
$UTENTE = login();
$DIRITTI = diritti();
$DIRITTI = diritti(1);
view_top(); ?>
?>
<?php include_once ("../core/top.php");?>
<?php print "-- $DIRITTI --" ?>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<?php include_once ("../core/footer.php"); ?>
<?php view_footer(); ?>

View File

@@ -1,115 +0,0 @@
<?php
include_once ("core/config.php");
$UTENTE = login();
isadmin();
?>
<?php include_once ("top.php");?>
<script type="text/javascript">
<!--
var stile = "top=30, left=30, width=1000, height=500, status=no, menubar=no, toolbar=no ";
function PopupG(apri)
{
window.open(apri, "", stile);
}
//-->
</script>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td class="spaziov" colspan=3><img src="img/spazio.gif"></td>
<td><a href="modcluster.php"><img src="img/ip.png" border="0" ALT="Aggiungi IP" TITLE="Aggiungi IP"></a></td>
<td class="spaziov" colspan=9><img src="img/spazio.gif"></td>
</tr>
<tr><td class="spaziov" colspan=14><img src="img/spazio.gif"></td></tr>
<tr>
<td class="spazioh" colspan=3><img src="img/spazio.gif"></td>
<td class="col3campo2">IP</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="col3valore2">Posizione</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="col3valore2">Device</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="col3valore2">Stato</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="col3valore2">Utilizzo</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
</tr>
<?php
$query = "
SELECT indirizzi.id,
indirizzi.ip,
indirizzi.netmask,
firewallA.nome AS home,
firewallB.nome AS attuale,
interfacce.device,
indirizzi.attivo,
indirizzi.errore,
indirizzi.commento
FROM indirizzi
JOIN firewall AS firewallA
ON firewallA.id = indirizzi.idfirewall
JOIN firewall AS firewallB
ON firewallB.id = indirizzi.attuale
JOIN interfacce
ON interfacce.id = indirizzi.idinterfaccia
WHERE
indirizzi.vf = 0
ORDER BY
indirizzi.attivo desc,
indirizzi.errore desc,
interfacce.device,
indirizzi.id
";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
if ($dato['attivo']) {
if ($dato['home'] == $dato['attuale']) {
$posizione = $dato['home'];
} else {
$posizione = $dato['attuale']." (".$dato['home'].")";
}
$device = $dato['device'];
$icona = $icone[$dato['errore']];
$commento = $dato['commento'];
} else {
$posizione = "---";
$device = "---";
$icona = "img/spazio.gif";
$commento = "---";
}
?>
<tr>
<td class="col3btn">
<?php if ($dato['attivo']) { ?>
<img border=0 src="img/attivo.gif" ALT="Utente attivo" TITLE="Indirizzo attivo">
<?php } else { ?>
<img border=0 src="img/non_attivo.gif" ALT="Utente non attivo" TITLE="Indirizzo non attivo">
<?php } ?>
</td>
<td class="col3btn"><a href="modcluster.php?id=<?php print $dato['id']?>"><img src="img/modify.gif" width="20" height="20" border="0" ALT="Proprieta'" TITLE="Proprieta'"></a></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="descrizione"><?php print $dato['ip']."/".$dato['netmask'] ?></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="descrizione"><?php print $posizione ?></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="descrizione"><?php print $device ?></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="descrizione"><img src="<?php print $icona ?>"></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="descrizione"><?php print $commento ?></td>
</tr>
<?php
} ?>
</table>
<img src="img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("footer.php"); ?>

View File

@@ -1,119 +0,0 @@
<?php
include_once ("core/config.php");
$UTENTE = login();
//isadmin();
?>
<?php include_once ("top.php");?>
<script type="text/javascript">
<!--
var stile1 = "top=30, left=30, width=600, height=400, status=no, menubar=no, toolbar=no ";
var stile2 = "top=30, left=30, width=920, height=500, status=no, menubar=no, toolbar=no ";
function Popup(apri)
{
window.open(apri, "", stile1);
}
function PopupG(apri)
{
window.open(apri, "", stile2);
}
//-->
</script>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td width="5%"><img src="img/spazio.gif"></td>
<td width="5%"><input type="button" value="Inserisci" onclick="location.href = 'moddefrule.php?idparent=0&device=<?php print $_GET['id'] ?>';"></button></td>
<td width="5%"><img src="img/spazio.gif"></td>
<td><img src="img/spazio.gif"></td>
</tr>
<tr><td class="spaziov" colspan=5><img src="img/spazio.gif"></td></tr>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<?php
livelli ($_GET['id'], 0, 0, 10);
?>
</table>
<img src="img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("footer.php"); ?>
<?php
function livelli ($device, $parent, $livello, $maxliv) {
global $DB_ID;
$query = "SELECT * FROM defrule WHERE stato <> 3 AND idparent = '$parent' AND idinterfacce = $device ORDER BY priorita";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
$queryint = "SELECT count(id) AS figli FROM defrule WHERE stato<>3 AND idparent = ".$dato['id'];
$queryrule = "SELECT COUNT(id) AS numrule FROM rule WHERE iddefrule = ".$dato['id'];
$resint = mysql_query( $queryint, $DB_ID );
$resrule = mysql_query( $queryrule, $DB_ID );
$datofigli = mysql_fetch_array ( $resint );
$datorule = mysql_fetch_array ( $resrule );
$numfigli = $datofigli['figli'];
$numrule = $datorule['numrule'];
?>
<tr>
<td class="spazioh" nowrap>
<?php if ($dato['attivo']) {
if ($dato['priorita'] < 1000) { ?>
<a href="moddefrule.php?id=<?php print $dato['id']?>&device=<?php print $dato['idinterfacce'] ?>&azione=disattiva">
<?php } ?>
<img border=0 src="img/attivo.gif" ALT="Disattiva regola" TITLE="Disattiva regola"></a>
<?php } else {
if ($dato['priorita'] < 1000) { ?>
<a href="moddefrule.php?id=<?php print $dato['id']?>&device=<?php print $dato['idinterfacce'] ?>&azione=attiva">
<?php } ?>
<img border=0 src="img/non_attivo.gif" ALT="Attiva regola" TITLE="Attiva regola"></a>
<?php } ?>
<?php if ($dato['priorita'] < 1000) { ?>
<a href="moddefrule.php?idparent=<?php print $dato['id']?>&device=<?php print $dato['idinterfacce'] ?>"><img border=0 src="img/piu.png" ALT="Crea nuova sotto regola" TITLE="Crea nuova sotto regola"></a>
<?php } else { ?>
<img border="0" src="img/niente.png">
<?php } ?>
<?php if ($numfigli == 0 && $dato['priorita'] < 1000) { ?>
<a href="moddefrule.php?id=<?php print $dato['id']?>&device=<?php print $dato['idinterfacce'] ?>&azione=rm" onClick="return confirm('Sei sicuro di voler eliminare questa regola?');"><img border=0 src="img/meno.png" ALT="Elimina regola" TITLE="Elimina regola"></a>
<?php } else { ?>
<img border=0 src="img/niente.png">
<?php } ?>
<a href="moddefrule.php?id=<?php print $dato['id']?>"><img border=0 src="img/modify.gif" ALT="Proprieta'" TITLE="Proprieta'"></a>
</td>
<td class="defrulenome" nowrap>
<?php for ($i=0; $i<$livello; $i++) { ?>
<img border=0 src="img/spaziocol.gif">
<?php } ?>
<?php printf ("%s",creanome($dato['id'])) ?>
</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="defruletxt" nowrap><?php print $dato['descrizione'] ?></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="defruletxt" nowrap><?php printf ("priorita': %d",$dato['priorita']) ?></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="defruletxt" nowrap><?php printf ("rate: %0.2f Mb/sec",$dato['rate']) ?></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="defruletxt" nowrap><?php printf ("Ceil: %0.2f Mb/sec",$dato['ceil']) ?></td>
<?php if ($dato['priorita'] < 1000) { ?>
<td class="spazioh"><a href="javascript:Popup('rule.php?id=<?php print $dato['id'] ?>')"><img border="0" src="img/edit-regole.gif" ALT="Gestioni regole di filtraggio" TITLE="Gestione regole di filtraggio"></a></td>
<td class="defruletxt" nowrap><?php print $numrule ?></td>
<?php } else { ?>
<td class="spazioh"><img border="0" src="img/niente.png"></td>
<td class="defruletxt" nowrap>&nbsp;</td>
<?php } ?>
<td class="spazioh"><img border="0" src="img/user.png" ALT="Gestione assegnazione utenze" TITLE="Gestione assegnazione utenze"></td>
<?php if ($dato['stato'] != 4) { ?>
<td class="spazioh"><a href="javascript:PopupG('grafico.php?device=<?php print $dato['idinterfacce'] ?>&rif=<?php print $dato['id'] ?>')"><img border="0" src="img/grafico.gif" ALT="Grafico Utilizzo" TITLE="Grafico Utilizzo"></a></td>
<?php } else { ?>
<td class="spazioh"><img border="0" src="img/errore.png" ALT="Regola non conforme" TITLE="Regola non conforme"></td>
<?php } ?>
</tr>
<?php livelli ($device, $dato['id'], $livello+1, 10);
}
}
?>

View File

@@ -1,72 +0,0 @@
<?php
include_once ("core/config.php");
$UTENTE = login();
isadmin();
?>
<?php include_once ("top.php");?>
<script type="text/javascript">
<!--
var stile = "top=30, left=30, width=920, height=500, status=no, menubar=no, toolbar=no ";
function PopupG(apri)
{
window.open(apri, "", stile);
}
//-->
</script>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td class="spaziov" colspan=3><img src="img/spazio.gif"></td>
<td><input type="button" value="Inserisci" onclick="location.href = 'moddevice.php';"></button></td>
<td class="spaziov" colspan=6><img src="img/spazio.gif"></td>
</tr>
<tr><td class="spaziov" colspan=10><img src="img/spazio.gif"></td></tr>
<?php
$query = "SELECT * FROM interfacce WHERE stato <> 3 ORDER BY device";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
$query_defrule = "SELECT COUNT(id) AS conta FROM defrule WHERE idinterfacce = ".$dato['id']." AND stato <> 3 AND priorita < 1000";
$res_defrule = mysql_query( $query_defrule, $DB_ID );
$dato_defrule = mysql_fetch_array ( $res_defrule );
$quanti_defrule = $dato_defrule['conta'];
?>
<tr>
<td rowspan=2 class="col3btn">
<?php if ($dato['attivo']) { ?>
<a href="gestdevice.php?id=<?php print $dato['id'] ?>&azione=disattiva"><img border=0 src="img/attivo.gif" ALT="Disattiva device" TITLE="Disattiva device"></a>
<?php } else { ?>
<a href="gestdevice.php?id=<?php print $dato['id'] ?>&azione=attiva"><img border=0 src="img/non_attivo.gif" ALT="Attiva device" TITLE="Attiva device"></a>
<?php } ?>
</td>
<td rowspan=2 class="col3btn"><a href="moddevice.php?id=<?php print $dato['id']?>"><img src="img/modify.gif" width="20" height="20" border="0" ALT="Proprieta'" TITLE="Proprieta'"></td>
<td rowspan=2 class="col3btn"><a href="gestdevice.php?id=<?php print $dato['id'] ?>&azione=rm" onClick="return confirm('Ci sono <?php print $quanti_defrule ?> regole impostate\nSei sicuro di voler eliminare questa regola?');"><img border=0 src="img/meno.png" ALT="Elimina device" TITLE="Elimina device"></a></td>
<td class="col0">Device</td>
<td class="col0"><?php print $dato['device'] ?></td>
<td class="spazioh" colspan="3"><img src="img/spazio.gif"></td>
<td class="col3valore2">Rete: <?php print ($dato['inout']) ?></td>
<td rowspan=2 class="col3btn">
<a href="defrule.php?id=<?php print $dato['id']?>"><img src="img/dettagli.png" width="20" height="20" border="0" ALT="Gestione regole" TITLE="Gestione Regole"></a>
<a href="javascript:PopupG('grafico.php?device=<?php print $dato['id']?>&rif=0')"><img border="0" src="img/grafico.gif" ALT="Grafico Utilizzo" TITLE="Grafico Utilizzo"></a>
</td>
</tr>
<tr>
<td class="col3campo2">Rate: <?php print $dato['rate'] ?> Mb/sec</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="col3campo2">Ceil: <?php print $dato['ceil'] ?> Mb/sec</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="col3campo2">Descrizione:<br><?php print $dato['descrizione']?></td>
<td class="col3campo2">Regole attive </td>
</tr>
<tr><td class="spaziov" colspan=10><img src="img/spazio.gif"></td></tr>
<?php
} ?>
</table>
<img src="img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("footer.php"); ?>

View File

@@ -1,74 +0,0 @@
<?php
include_once ("core/config.php");
$UTENTE = login();
isadmin();
?>
<html>
<head>
<script type="text/javascript">
<!--
function confirmation(testo) {
alert(testo)
document.location.href='device.php'
}
//-->
</script>
<?php
if (isset($_GET['id'])) {
$id = $_GET['id'];
if (isset($_GET['azione'])) {
$azione = $_GET['azione'];
switch ($azione) {
case "attiva":
// attiva device
$query = "UPDATE interfacce SET attivo = 1 WHERE id = $id";
mysql_query( $query, $DB_ID );
azioni ("interfacce", $id, 1);
$query_figli = "SELECT id FROM defrule WHERE idinterfacce = $id AND priorita = 1000 AND idparent = 0";
$res_figli = mysql_query( $query_figli, $DB_ID );
$dato = mysql_fetch_array ( $res_figli );
$query_attiva = "UPDATE defrule SET attivo = 1 WHERE id = ".$dato['id'];
mysql_query( $query_attiva, $DB_ID );
azioni ("defrule", $dato['id'], 1);
$testo = "Device attivato";
break;
case "disattiva":
// disattiva device
$query = "UPDATE interfacce SET attivo = 0 WHERE id = $id";
mysql_query( $query, $DB_ID );
azioni ("interfacce", $id, 3);
// disattiva figli
$query_figli = "SELECT id FROM defrule WHERE idinterfacce = $id AND attivo = 1 AND idparent = 0";
$res_figli = mysql_query( $query_figli, $DB_ID );
while ($dato = mysql_fetch_array ( $res_figli )) {
$risultato = defrule_dis($dato['id']);
}
$testo = "Device e regole ad esso associate disattivate";
break;
case "rm":
// elimina device
$query = "UPDATE interfacce SET stato = 3 WHERE id = $id";
mysql_query( $query, $DB_ID );
azioni ("interfacce", $id, 3);
// elimina figli
$query_figli = "SELECT id FROM defrule WHERE idinterfacce = $id AND attivo = 1 AND idparent = 0";
$res_figli = mysql_query( $query_figli, $DB_ID );
while ($dato = mysql_fetch_array ( $res_figli )) {
$risultato = defrule_dis($dato['id'], 3);
}
$testo = "Il device e tutte le regole ad esso associate sono state eliminati";
break;
default:
$testo = "Regola non implementata";
break;
}
?>
<script type="text/javascript">
confirmation ('<?php print $testo ?>');
</script>
<?php }
} ?>
<script type="text/javascript">
document.location.href='device.php'
</script>

View File

@@ -1,183 +0,0 @@
<?php
include_once ("core/config.php");
$UTENTE = login();
isadmin();
?>
<?php include_once ("top.php"); ?>
<?php
if (isset($_GET['id'])) {
$bottone = "Modifica";
$modifica = 1;
$query = "SELECT * FROM indirizzi WHERE id =".$_GET['id'];
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
} else if (isset ($_POST['id'])) {
$modifica = 2;
$id = $_POST['id'];
$ip = $_POST['ip'];
$netmask = $_POST['netmask'];
if (defined ($_POST['attivo'])) {
$attivo = $_POST['attivo'];
} else {
$attivo = 0;
}
$idfirewall = $_POST['idfirewall'];
$idinterfaccia = $_POST['idinterfaccia'];
$vf = $_POST['vf'];
$commento = $_POST['commento'];
if ($id > 0) {
$testo = "L'indirizzo IP e' stato correttamente aggiornata";
$query = "UPDATE indirizzi SET ip='$ip', netmask = $netmask, attivo = $attivo, idfirewall = $idfirewall, idinterfaccia = $idinterfaccia, commento = '$commento' WHERE `id`=$id";
} else {
$testo = "L'indirizzo IP e' stato correttamento inserito";
$query = "INSERT INTO indirizzi SET ip='$ip', netmask = $netmask, attivo = $attivo, idfirewall = $idfirewall, idinterfaccia = $idinterfaccia, vf = 0, commento = '$commento'";
}
?>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td><img src="img/spazio.gif" width="1" height="10" alt=""><td>
</tr>
<tr>
<td>
<?php if (mysql_query( $query, $DB_ID )) {
print $testo."<br>";
print $query."<br>";
} else {
print "Non e' stato possibile eseguire l'operazione richiesta a causa di un errore: ".mysql_error()."<br>";
print $query."<br>";
} ?>
</td>
</tr>
<tr>
<td><img src="img/spazio.gif" width="1" height="5" alt=""></td>
</tr>
<tr>
<td><input type="button" value="Ok" onclick="location.href = 'cluster.php';"></button></td>
</tr>
<tr>
<td><img src="img/spazio.gif" width="1" height="10" alt=""></td>
</tr>
</table>
<?php
} else {
$bottone = "Aggiungi";
$modifica = 0;
}
?>
<?php if (($modifica == 0 || $modifica == 1) && !isset($_GET['rm'])) { ?>
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript" src="jquery/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#modulo").validate( {
rules: {
descrizione: "required",
device: "required",
rate: {
required: true,
min: <?php print $min_rate ?>,
},
ceil: {
required: true,
min: <?php print $min_ceil ?>,
},
},
messages: {
descrizione: "<br>Inserisci la descrizione!",
device: "<br>Immettereil nome del device",
rate: "<br>Immettere un valore non minore di <?php print $min_rate ?>",
ceil: "<br>Immettere un valore non minore di <?php print $min_ceil ?>",
}
});
});
</script>
<form action="modcluster.php" method="post" id="modulo">
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<?php if ($modifica == 1) { ?>
<input type="hidden" name="id" value="<?php print $dato['id'] ?>">
<?php } else { ?>
<input type="hidden" name="id" value="-1">
<?php } ?>
<tr>
<td width="20"><img src="img/spazio.gif" width="20" height="1" alt=""></td>
<td class="campo" width="20">IP</td>
<td class="valore" width="100"><input type="text" id="ip" name="ip" size="15" maxlength="15" value="<?php print $dato['ip']?>"></td>
<td width="30"><img src="img/spazio.gif" width="30" height="1" alt=""></td>
<td class="campo" width="80">Netmask</td>
<td class="valore" width="100"><input type="text" id="netmask" name="netmask" size="2" maxlength="2" value="<?php print $dato['netmask']?>"></td>
<td width="300"><img src="img/spazio.gif" width="30" height="1" alt=""></td>
<td>Attivo<input name="attivo" type="checkbox" value=1 <?php if ($dato['attivo']) { print "checked=\"checked\""; } ?>></td>
</tr>
<tr><td colspan="8"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td class="col1" colspan="8">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="20"><img src="img/spazio.gif" width="20" height="1" alt=""></td>
<td class="campo" width="150">Firewall di default</td>
<td class="valore" width="50">
<select name='idfirewall'>
<option name='idfirewall' value='0'>Seleziona</option>
<?php
$queryfw = "SELECT id, nome FROM firewall WHERE id > 0 ORDER BY nome";
$resfw = mysql_query( $queryfw, $DB_ID );
while ($datofw = mysql_fetch_array ($resfw)) {
?>
<option name='idfirewall' value='<?php print $datofw['id']?>' <?php if ($dato['idfirewall'] == $datofw['id']) {print "selected";}?>><?php print $datofw['nome'] ?></option>
<?php } ?>
</select>
</td>
<td width="60"><img src="img/spazio.gif" width="60" height="1" alt=""></td>
<td class="campo" width="100">Interfaccia</td>
<td width="50">
<select name='idinterfaccia'>
<option name='idinterfaccia' value='0'>Seleziona</option>
<?php
$queryfw = "SELECT id, device FROM interfacce WHERE attivo = 1 ORDER BY device";
$resfw = mysql_query( $queryfw, $DB_ID );
while ($datofw = mysql_fetch_array ($resfw)) {
?>
<option name='idinterfaccia' value='<?php print $datofw['id']?>' <?php if ($dato['idinterfaccia'] == $datofw['id']) {print "selected";}?>><?php print $datofw['device'] ?></option>
<?php } ?>
</select>
</td>
<td><img src="img/spazio.gif"></td>
</tr>
</table>
</td>
</tr>
<tr><td colspan="8"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td class="col1" colspan="8">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="20"><img src="img/spazio.gif" width="20" height="1" alt=""></td>
<td class="campo" width="150">Descrizione</td>
<td class="valore" width="300"><input class="valore" type="text" name="commento" id="commento" size="60" maxlength="128" value="<?php print $dato['commento'] ?>"></td>
<td><img src="img/spazio.gif"></td>
</tr>
</table>
</td>
</tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr><td align="center" colspan="9">
<input type="submit" value="<?php print $bottone ?>">
&nbsp;&nbsp;&nbsp;
<input type="button" value="Annulla" onclick="location.href = 'device.php';"></button>
</td></tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="10" alt=""></td></tr>
</table>
</form>
<?php } ?>
<?php include_once ("footer.php"); ?>

View File

@@ -1,245 +0,0 @@
<?php
include_once ("core/config.php");
$UTENTE = login();
//isadmin();
?>
<?php include_once ("top.php"); ?>
<?php
if (isset($_GET['id'])) {
$id = $_GET['id'];
$device = $_GET['device'];
if (isset($_GET['azione'])) {
switch ($_GET['azione']) {
case "attiva":
$risultato = defrule_att($id);
break;
case "disattiva":
$risultato = defrule_dis($id);
break;
case "rm":
$query = "UPDATE `defrule` SET stato=3, attivo=0 WHERE `id`=$id";
if (mysql_query( $query, $DB_ID )) {
$query_rule = "DELETE FROM rule WHERE iddefrule = $id";
if (mysql_query( $query_rule, $DB_ID )) {
$risultato = 1;
azioni ("defrule", $id, 3);
}
} else {
$risultato = "Non e' stato possibile eseguire l'operazione richiesta a causa di un errore: ".mysql_error();
}
break;
}
if ($risultato == 1) { ?>
<script type="text/javascript">
document.location.href='defrule.php?id=<?php print $device ?>'
</script>
<?php }
?>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td><img src="img/spazio.gif" width="1" height="10" alt=""><td>
</tr>
<tr>
<td><?php print $risultato ?></td>
</tr>
<tr><td><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr><td><input type="button" value="Ok" onclick="location.href = 'defrule.php?id=<?php print $device ?>';"></button></td></tr>
<tr><td><img src="img/spazio.gif" width="1" height="10" alt=""></td></tr>
</table>
<?php
}
$bottone = "Modifica";
$modifica = 1;
$query = "SELECT * FROM defrule WHERE id =".$_GET['id'];
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
$iddevice = $dato['idinterfacce'];
$parent = creanome ($_GET['id']);
$limitirate = maxrate ($id, $dato['idparent'], $iddevice);
$attivo = $dato['attivo'];
} else if (isset ($_POST['id'])) {
$modifica = 2;
$id = $_POST['id'];
$attivo = $_POST['attivo'];
$device = $_POST['device'];
$iddevice = $device;
$idparent = $_POST['idparent'];
$descrizione = $_POST['descrizione'];
$priorita = $_POST['priorita'];
$rate = $_POST['rate'];
$ceil = $_POST['ceil'];
if ($id > 0) {
$testo = "L'interfaccia e' stata correttamente aggiornata";
$query = "UPDATE `defrule` SET `descrizione`='$descrizione', `priorita`=$priorita, `rate`=$rate, `ceil`=$ceil, `attivo`=$attivo WHERE `id`=$id";
} else {
$testo = "L'interfaccia e' stata correttamente inserita";
$query = "INSERT INTO `defrule` SET idinterfacce=$device, `idparent`=$idparent, `descrizione`='$descrizione', `priorita`=$priorita, `rate`=$rate, `ceil`=$ceil, `stato`=1, `attivo`= 0";
}
?>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td><img src="img/spazio.gif" width="1" height="10" alt=""><td>
</tr>
<tr>
<td>
<?php if (mysql_query( $query, $DB_ID )) {
if ($attivo) {
azioni ("defrule", $id, 2);
}
?>
<?php print $testo ?><br>
<?php } else { ?>
Non e' stato possibile eseguire l'operazione richiesta a causa di un errore: <?php print mysql_error() ?><br>
<?php } ?>
</td>
</tr>
<tr>
<td><img src="img/spazio.gif" width="1" height="5" alt=""></td>
</tr>
<tr>
<td><input type="button" value="Ok" onclick="location.href = 'defrule.php?id=<?php print $device ?>';"></button></td>
</tr>
<tr>
<td><img src="img/spazio.gif" width="1" height="10" alt=""></td>
</tr>
</table>
<?php
} else {
$bottone = "Aggiungi";
$modifica = 0;
$idparent = $_GET['idparent'];
if ($idparent == 0) {
$iddevice = $_GET['device'];
$querydev = "SELECT device FROM interfacce WHERE id = $iddevice";
$resdev = mysql_query( $querydev, $DB_ID );
$datodev = mysql_fetch_array ( $resdev );
$device = $datodev['device'];
$parent = $device."-2";
} else {
$iddevice = $_GET['device'];
$parent = creanome ($idparent);
}
$limitirate = maxrate (-1, $idparent, $iddevice);
$dato['rate'] = $limitirate['rate'];
$dato['ceil'] = $limitirate['ceil'];
$dato['priorita'] = $limitirate['pri'];
}
?>
<?php if (($modifica == 0 || $modifica == 1) && !isset($_GET['azione'])) { ?>
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript" src="jquery/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#modulo").validate( {
rules: {
descrizione: "required",
priorita: {
required: true,
max: 999,
},
rate: {
required: true,
min: 0.001,
max: <?php print $limitirate['rate'] ?>,
},
ceil: {
required: true,
max: <?php print $limitirate['ceil'] ?>,
},
},
messages: {
descrizione: "<br>Inserisci la descrizione!",
device: "<br>Inserire il nome del device!",
rate: "<br>Immettere un valore compreso fra 0.001 e <?php print $limitirate['rate'] ?>",
ceil: "<br>Immettere un valore minore di <?php print $limitirate['ceil'] ?>",
}
});
});
</script>
<form action="moddefrule.php" method="post" id="modulo" name="modulo">
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<?php if ($modifica == 1) { ?>
<input type="hidden" name="id" value="<?php print $dato['id'] ?>">
<?php } else { ?>
<input type="hidden" name="id" value="-1">
<?php } ?>
<input type="hidden" name="idparent" value="<?php print $idparent ?>">
<input type="hidden" name="device" value="<?php print $iddevice ?>">
<tr>
<td><img src="img/spazio.gif" width="80" height="1" alt=""></td>
<td class="campo" width="110">Parent</td>
<td><img src="img/spazio.gif" width="10" height="1" alt=""></td>
<td class="valore" width="200"><?php print $parent?></td>
<td><img src="img/spazio.gif" width="310" height="1" alt=""></td>
<td colspan=4><input type="hidden" name="attivo" value="<?php print $dato['attivo'] ?>"></td>
</tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td class="col1" colspan="9">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td><img src="img/spazio.gif" width="40" height="1" alt=""></td>
<td class="campo" width="200">Descrizione</td>
<td><img src="img/spazio.gif" width="10" height="1" alt=""></td>
<td class="valore" width="150"><input class="valore" type="text" name="descrizione" id="descrizione" size="30" maxlength="128" value="<?php print $dato['descrizione'] ?>"></td>
<td><img src="img/spazio.gif" width="110" height="1" alt=""></td>
<td class="campo" width="150">Priorita'</td>
<td><img src="img/spazio.gif" width="10" height="1" alt=""></td>
<?php if ($dato['priorita'] < 1000) { ?>
<td class="valore" width="180"><input class="valore" type="text" name="priorita" id="priorita" size="5" maxlength="10" value="<?php print $dato['priorita'] ?>"></td>
<?php } else { ?>
<td class="valore" width="180"><?php print $dato['priorita'] ?></td>
<input type="hidden" name="priorita" value="<?php print $dato['priorita'] ?>">
<?php } ?>
<td><img src="img/spazio.gif" width="50" height="1" alt=""></td>
</tr>
<tr><td colspan="9" class="spaziov"><img src="img/spazio.gif" width="1" alt=""></td></tr>
</table>
</td>
</tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td class="col1" colspan="9">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td colspan="9">Limitazioni</td>
</tr>
<tr>
<td><img src="img/spazio.gif" width="40" height="1" alt=""></td>
<td class="campo" width="200">Banda Garantita<br>(Max. <?php print $limitirate['rate'] ?> Mb/sec)</td>
<td><img src="img/spazio.gif" width="10" height="1" alt=""></td>
<td class="valore" width="150"><input class="valore" type="text" name="rate" id="rate" size="5" maxlength="10" value="<?php print $dato['rate'] ?>"> Mb/sec</td>
<td><img src="img/spazio.gif" width="110" height="1" alt=""></td>
<td class="campo" width="150">Banda Massima<br>(Max. <?php print $limitirate['ceil'] ?> Mb/sec)</td>
<td><img src="img/spazio.gif" width="10" height="1" alt=""></td>
<td class="valore" width="180"><input class="valore" type="text" name="ceil" id="ceil" size="5" maxlength="10" value="<?php print $dato['ceil'] ?>"> Mb/sec</td>
<td><img src="img/spazio.gif" width="50" height="1" alt=""></td>
</tr>
<tr><td colspan="9" class="spaziov"><img src="img/spazio.gif" width="1" alt=""></td></tr>
</table>
</td>
</tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr><td align="center" colspan="9">
<input type="submit" value="<?php print $bottone ?>">
&nbsp;&nbsp;&nbsp;
<input type="button" value="Annulla" onclick="location.href = 'defrule.php?id=<?php print $iddevice ?>';"></button>
</td></tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="10" alt=""></td></tr>
</table>
</form>
<?php } ?>
<?php include_once ("footer.php"); ?>

View File

@@ -1,195 +0,0 @@
<?php
include_once ("core/config.php");
$UTENTE = login();
isadmin();
?>
<?php include_once ("top.php"); ?>
<?php
if (isset($_GET['id'])) {
$bottone = "Modifica";
$modifica = 1;
$query = "SELECT * FROM interfacce WHERE id =".$_GET['id'];
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
$query_limiti = "SELECT SUM(rate) AS rate, MAX(ceil) AS ceil FROM defrule WHERE idparent = 0 AND idinterfacce = ".$_GET['id'];
$res_limiti = mysql_query( $query_limiti, $DB_ID );
$dato_limiti = mysql_fetch_array ( $res_limiti );
$min_rate = $dato_limiti['rate'];
$min_ceil = $dato_limiti['ceil'];
} else if (isset ($_POST['id'])) {
$modifica = 2;
$id = $_POST['id'];
$device = $_POST['device'];
$descrizione = $_POST['descrizione'];
$attivo = $_POST['attivo'];
$rate = $_POST['rate'];
$ceil = $_POST['ceil'];
$inout = $_POST['inout'];
if ($id > 0) {
$testo = "L'interfaccia e' stata correttamente aggiornata";
$query = "UPDATE `interfacce` SET `device`='$device', `descrizione`='$descrizione', `rate`=$rate, `ceil`=$ceil, `inout`='$inout', `stato`=2 WHERE `id`=$id";
} else {
$testo = "L'interfaccia e' stata correttamente inserita";
$query = "INSERT INTO `interfacce` SET `device`='$device', `descrizione`='$descrizione', `rate`=$rate, `ceil`=$ceil, `inout`='$inout', `stato`=1, `attivo`=0";
}
?>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td><img src="img/spazio.gif" width="1" height="10" alt=""><td>
</tr>
<tr>
<td>
<?php if (mysql_query( $query, $DB_ID )) {
if ($id > 0) {
if ($attivo) {
azioni ("interfacce", $id, 2);
}
} else {
$iddevice = mysql_insert_id ($DB_ID);
$querydefrule = "INSERT INTO `defrule` SET `idparent`=0, `idinterfacce`=$iddevice, `descrizione`='DEFAULT', `priorita`=1000, `rate`=$rate, `ceil`=$ceil, `stato`=1, `default`=1, `attivo`=0";
mysql_query( $querydefrule, $DB_ID );
}
?>
<?php print $testo ?><br>
<?php } else { ?>
Non e' stato possibile eseguire l'operazione richiesta a causa di un errore: <?php print mysql_error() ?><br>
<?php print $query ?><br>
<?php } ?>
</td>
</tr>
<tr>
<td><img src="img/spazio.gif" width="1" height="5" alt=""></td>
</tr>
<tr>
<td><input type="button" value="Ok" onclick="location.href = 'device.php';"></button></td>
</tr>
<tr>
<td><img src="img/spazio.gif" width="1" height="10" alt=""></td>
</tr>
</table>
<?php
} else {
$bottone = "Aggiungi";
$modifica = 0;
}
?>
<?php if (($modifica == 0 || $modifica == 1) && !isset($_GET['rm'])) { ?>
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript" src="jquery/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#modulo").validate( {
rules: {
descrizione: "required",
device: "required",
rate: {
required: true,
min: <?php print $min_rate ?>,
},
ceil: {
required: true,
min: <?php print $min_ceil ?>,
},
},
messages: {
descrizione: "<br>Inserisci la descrizione!",
device: "<br>Immettereil nome del device",
rate: "<br>Immettere un valore non minore di <?php print $min_rate ?>",
ceil: "<br>Immettere un valore non minore di <?php print $min_ceil ?>",
}
});
});
</script>
<form action="moddevice.php" method="post" id="modulo">
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<?php if ($modifica == 1) { ?>
<input type="hidden" name="id" value="<?php print $dato['id'] ?>">
<?php } else { ?>
<input type="hidden" name="id" value="-1">
<?php } ?>
<tr>
<td><img src="img/spazio.gif" width="80" height="1" alt=""></td>
<td class="campo" width="110">Device</td>
<td><img src="img/spazio.gif" width="10" height="1" alt=""></td>
<td class="valore" width="200"><input type="text" id="device" name="device" size="10" maxlength="20" value="<?php print $dato['device']?>"></td>
<td><img src="img/spazio.gif" width="310" height="1" alt=""></td>
<td colspan=4><input type="hidden" name="attivo" value="<?php print $dato['stato'] ?>"></td>
</tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td class="col1" colspan="9">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td><img src="img/spazio.gif" width="40" height="1" alt=""></td>
<td class="campo" width="200">Descrizione</td>
<td><img src="img/spazio.gif" width="10" height="1" alt=""></td>
<td class="valore" width="150"><input class="valore" type="text" name="descrizione" id="descrizione" size="30" maxlength="128" value="<?php print $dato['descrizione'] ?>"></td>
<td><img src="img/spazio.gif" width="110" height="1" alt=""></td>
<td class="campo" width="150">Posizione</td>
<td><img src="img/spazio.gif" width="10" height="1" alt=""></td>
<?php
if ($dato['inout'] == 'interna') {
$checkin = "selected";
$checkout = "";
} else {
$checkin = "";
$checkout = "selected";
} ?>
<td class="valore" width="180">
<select name='inout'>
<option name='inout' value='interna' <?php print $checkin ?>>Interna</option>
<option name='inout' value='esterna' <?php print $checkout ?>>Esterna</option>
</select>
</td>
<td><img src="img/spazio.gif" width="50" height="1" alt=""></td>
</tr>
<tr><td colspan="9" class="spaziov"><img src="img/spazio.gif" width="1" alt=""></td></tr>
</table>
</td>
</tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td class="col1" colspan="9">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td colspan="9">Limitazioni</td>
</tr>
<tr>
<td><img src="img/spazio.gif" width="40" height="1" alt=""></td>
<td class="campo" width="200">Banda Garantita<br>(Min. <?php print $min_rate?>)</td>
<td><img src="img/spazio.gif" width="10" height="1" alt=""></td>
<td class="valore" width="150"><input class="valore" id="rate" type="text" name="rate" size="5" maxlength="10" value="<?php print $dato['rate'] ?>"> Mb/sec</td>
<td><img src="img/spazio.gif" width="110" height="1" alt=""></td>
<td class="campo" width="150">Banda Massima<br>(Min. <?php print $min_ceil?>)</td>
<td><img src="img/spazio.gif" width="10" height="1" alt=""></td>
<td class="valore" width="180"><input class="valore" id="ceil" type="text" name="ceil" size="5" maxlength="10" value="<?php print $dato['ceil'] ?>"> Mb/sec</td>
<td><img src="img/spazio.gif" width="50" height="1" alt=""></td>
</tr>
<tr><td colspan="9" class="spaziov"><img src="img/spazio.gif" width="1" alt=""></td></tr>
</table>
</td>
</tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr><td align="center" colspan="9">
<input type="submit" value="<?php print $bottone ?>">
&nbsp;&nbsp;&nbsp;
<input type="button" value="Annulla" onclick="location.href = 'device.php';"></button>
</td></tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="10" alt=""></td></tr>
</table>
</form>
<?php } ?>
<?php include_once ("footer.php"); ?>

BIN
routing/immagini/add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

14
routing/index.php Executable file
View File

@@ -0,0 +1,14 @@
<?php
include_once ("../core/config.php");
$UTENTE = login();
$DIRITTI = diritti(1);
view_top();
$conf_route = carica_conf('Routing');
?>
<?php print_r ($conf_route); ?>
<?php view_footer(); ?>

86
routing/linee.php Executable file
View File

@@ -0,0 +1,86 @@
<?php
include_once ("../core/config.php");
$UTENTE = login();
$DIRITTI = diritti(10);
view_top();
?>
<script type="text/javascript">
<!--
var stile = "top=30, left=30, width=1000, height=500, status=no, menubar=no, toolbar=no ";
function PopupG(apri)
{
window.open(apri, "", stile);
}
//-->
</script>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td class="spaziov" colspan=4><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
<td><a href="modlinea.php"><img src="immagini/addlinea.png" border="0" ALT="Aggiungi linea" TITLE="Aggiungi linea"></a></td>
<td class="spaziov" colspan=9><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
</tr>
<tr><td class="spaziov" colspan=12><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
<?php
$query = " SELECT
route_linee.id,
route_linee.nome,
route_linee.gw,
route_linee.nm,
route_linee.pri,
route_linee.attivo,
route_linee.ncheck
FROM
route_linee
ORDER BY
pri DESC
";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
?>
<tr>
<td rowspan=2 class="col3btn">
<?php if ($dato['attivo']) { ?>
<img border=0 src="<?php print $CONF['base_url'] ?>/img/attivo.gif" ALT="Utente attivo" TITLE="Utente attivo">
<?php } else { ?>
<img border=0 src="<?php print $CONF['base_url'] ?>/img/non_attivo.gif" ALT="Utente non attivo" TITLE="Utente non attivo">
<?php } ?>
</td>
<td rowspan=2 class="col3btn"><a href="modlinea.php?id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/modify.gif" width="20" height="20" border="0" ALT="Proprieta'" TITLE="Proprieta'"></a></td>
<td rowspan=2 class="col3btn"><img border=0 src="immagini/net_card.png" ALT="<?php print $dato['nome'] ?>" TITLE="<?php print $dato['nome'] ?>"></td>
<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
<td class="col3campo2">Linea</td>
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
<td class="col3valore2">Gateway</td>
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
<td class="col3valore2">Priorita'</td>
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
<td class="col3valore2">Stato</td>
<td rowspan=2 class="col3btn">
<a href="permessiutenti.php?id=<?php print $dato['id']?>"><img src="<?php print $CONF['base_url'] ?>/img/dettagli.png" width="20" height="20" border="0" ALT="Gestione regole" TITLE="Gestione Regole"></a>
<a href="javascript:PopupG('logutenti.php?idutente=<?php print $dato['id'] ?>')"><img border="0" src="<?php print $CONF['base_url'] ?>/img/iconSystemLog.gif" ALT="Grafico Utilizzo" TITLE="Grafico Utilizzo"></a>
</td>
</tr>
<tr>
<td class="descrizione"><?php print $dato['nome'] ?></td>
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
<td class="descrizione"><?php print $dato['gw'] ?>/<?php print $dato['nm'] ?></td>
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
<td class="descrizione"><?php print $dato['pri'] ?></td>
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
<td class="descrizione"><?php print $dato['ncheck'] ?></td>
</tr>
<tr><td class="spaziov" colspan=12><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
<?php
} ?>
</table>
<img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="20" alt="">
<?php view_footer(); ?>

294
routing/modlinea.php Executable file
View File

@@ -0,0 +1,294 @@
<?php
include_once ("../core/config.php");
$UTENTE = login();
$DIRITTI = diritti(10);
view_top();
$netmask = array( 30 => "/30 - 255.255.255.252",
29 => "/29 - 255.255.255.248",
28 => "/28 - 255.255.255.240",
27 => "/27 - 255.255.255.224",
26 => "/26 - 255.255.255.192",
25 => "/25 - 255.255.255.128",
24 => "/24 - 255.255.255.0",
16 => "/16 - 255.255.0.0",
8 => "/8 - 255.0.0.0",
);
if (isset($_GET['id'])) {
$bottone = "Modifica";
$modifica = 1;
$query = "SELECT * FROM route_linee WHERE id = ".$_GET['id'];
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
$query = "SELECT * FROM route_ip WHERE id_route_linee = ".$_GET['id'];
$res = mysql_query( $query, $DB_ID );
$quanti = mysql_num_rows ($res);
} else if (isset ($_POST['id'])) {
$modifica = 2;
$id = $_POST['id'];
$rm = $_POST['rm'];
$utente = $_POST['utente'];
$password1 = $_POST['password1'];
$password2 = $_POST['password2'];
$admin = $_POST['admin'];
$attivo = $_POST['attivo'];
$mail = $_POST['mail'];
if (!$admin) $admin = 0;
if (!$attivo) $attivo = 0;
if (($password1 != "ahg5t!frtb5@u&^!") && ($password1 == $password2)) {
$querypwd = "password = MD5('$password1'),";
} else {
$querypwd = "";
}
if ( $rm == 1) {
$testo = "L'utente e' stato correttamente rimosso";
$query = "DELETE FROM permessi WHERE id_utenti = $id";
$query2 = "DELETE FROM utenti WHERE id = $id";
} elseif ($id > 0) {
$testo = "L'utente e' stato correttamente modificato";
$query = "UPDATE utenti SET $querypwd admin = $admin, attivo=$attivo, modifica = NOW(), mail='$mail' WHERE `id`=$id";
} else {
$testo = "L'utente e' stato correttamente inserito";
$query = "INSERT INTO utenti SET utente = '$utente', $querypwd admin = $admin, attivo=$attivo, modifica = NOW(), creazione = NOW(), mail='$mail'";
}
?>
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr>
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="10" alt=""><td>
</tr>
<tr>
<td>
<?php if (mysql_query( $query, $DB_ID ) && ((!is_null ($query2) && mysql_query( $query2, $DB_ID )) || (is_null ($query2)))) { ?>
<?php print $testo ?><br>
<?php } else { ?>
Non e' stato possibile eseguire l'operazione richiesta a causa di un errore: <?php print mysql_error() ?><br>
<?php print $query ?><br>
<?php } ?>
</td>
</tr>
<tr>
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="5" alt=""></td>
</tr>
<tr>
<td><input type="button" value="Ok" onclick="location.href = '<?php print $CONF['base_url'] ?>/utenti/index.php';"></button></td>
</tr>
<tr>
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="10" alt=""></td>
</tr>
</table>
<?php
} else {
$bottone = "Aggiungi";
$modifica = 0;
}
?>
<?php if (($modifica == 0 || $modifica == 1) && !isset($_GET['rm'])) { ?>
<script type="text/javascript" src="<?php print $CONF['base_url'] ?>/jquery/jquery.js"></script>
<script type="text/javascript" src="<?php print $CONF['base_url'] ?>/jquery/jquery.validate.js"></script>
<script type="text/javascript" src="<?php print $CONF['base_url'] ?>/jquery/jquery.validate.password.js"></script>
<link rel="stylesheet" type="text/css" href="<?php print $CONF['base_url'] ?>/jquery/jquery.validate.password.css" />
<script type="text/javascript">
function DoSubmit(){
document.getElementById("rm").value = '1';
return true;
}
var num=<?php print $quanti ?>;
function accoda(){
if(document.createElement && document.getElementById && document.getElementsByTagName) {
// crea elementi
var oTr=document.createElement("TR");
var oTd1=document.createElement("TD");
var oTd2=document.createElement("TD");
var oTd3=document.createElement("TD");
var oTd4=document.createElement("TD");
var oField1=document.createElement("INPUT");
var oField2=document.createElement("INPUT");
var oField3=document.createElement("INPUT");
var oButt=document.createElement("INPUT");
// setta attributi
oField1.setAttribute("type","text");
oField1.setAttribute("name","nome"+num);
oField2.setAttribute("type","text");
oField2.setAttribute("name","ip"+num);
oField3.setAttribute("type","text");
oField3.setAttribute("name","iface"+num);
oButt.setAttribute("type","checkbox");
oButt.setAttribute("name","check"+num);
// appendi al relativo padre
oTd1.appendChild(oField1);
oTd2.appendChild(oField2);
oTd3.appendChild(oField3);
oTd4.appendChild(oButt);
oTr.appendChild(oTd1);
oTr.appendChild(oTd2);
oTr.appendChild(oTd3);
oTr.appendChild(oTd4);
document.getElementById('tabella').getElementsByTagName('TBODY')[0].appendChild(oTr);
// incrementa variabile globale
num++;
document.forms.modulo.quanti.value=num;
}
}
$(document).ready(function()
{
$("#modulo").validate( {
rules: {
utente: {
required: true,
minlength: 4
},
mail: {
required: true,
email: true,
minlength: 4
},
password1: {
password: "#utente",
minlength: 0
},
password2: {
equalTo: "#password1"
}
},
messages: {
utente: {
required: "Inserire uno nome utente",
minlength: jQuery.format("Inserire almeno {0} caratteri")
},
mail: {
required: "Inserire un indirizzo e-mail valido",
},
password2: {
equalTo: "Le due password devono essere uguali"
}
},
// the errorPlacement has to take the table layout into account
errorPlacement: function(error, element) {
error.prependTo( element.parent().next() );
},
// specifying a submitHandler prevents the default submit, good for the demo
//submitHandler: function() {
// alert("submitted!");
//},
// set this class to error-labels to indicate valid fields
success: function(label) {
// set &nbsp; as text for IE
label.html("&nbsp;").addClass("checked");
}
});
});
</script>
<form action="modlinea.php" method="post" id="modulo">
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<input type="hidden" name="quanti" value="<?php print $quanti ?>">
<?php if ($modifica == 1) { ?>
<input type="hidden" name="id" id="id" value="<?php print $dato['id'] ?>">
<input type="hidden" name="rm" id="rm" value="0">
<?php } else { ?>
<input type="hidden" name="id" d="id" value="-1">
<?php } ?>
<tr>
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
<td class="label"><label id="lnome" for="nome">Nome Linea</label></td>
<td class="field"><input id="nome" name="nome" type="text" value="<?php print $dato['nome']?>" maxlength="50" /></td>
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
<td class="label"><label id="lattivo" for="attivo">Attivo</label></td>
<td><input name="attivo" type="checkbox" value=1 <?php if ($dato['attivo']) { print "checked=\"checked\""; } ?>></td>
<td class="status" colspan="3"></td>
</tr>
<tr><td colspan="9"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
<td class="label"><label id="lgw" for="gw">Gateway</label></td>
<td class="field"><input id="gw" name="gw" type="text" value="<?php print $dato['gw']?>" maxlength="50" /></td>
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
<td class="label"><label id="lnm" for="gw">Netmask</label></td>
<td class="field"><select name='nm' id="nm">
<?php foreach ($netmask as $i => $v) { ?>
<option name='nm' value='<?php print $i ?>' <?php if ($i == $dato['nm']) { print "selected"; } ?>><?php print $v ?></option>
<?php } ?>
</select></td>
<td class="status" colspan="3"></td>
</tr>
<tr><td colspan="9"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
<td class="label"><label id="lch" for="ch">Check IP</label></td>
<td class="field"><input id="ch" name="ch" type="text" value="<?php print $dato['ch']?>" maxlength="50" /></td>
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
<td class="label"><label id="lncheck" for="ncheck"># Check</label></td>
<td class="field"><input id="ncheck" name="ncheck" type="text" value="<?php print $dato['ncheck']?>" maxlength="5" /></td>
<td class="status" colspan="3"></td>
</tr>
<tr><td colspan="9"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
<td class="label"><label id="lpri" for="pri">Priorita'</label></td>
<td class="field"><input id="pri" name="pri" type="text" value="<?php print $dato['pri']?>" maxlength="50" /></td>
<td class="status" colspan="6"></td>
</tr>
<tr><td colspan="9"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td colspan="9" align="center">
<table class="col1" cellpadding="0" cellspacing="0" border="0" width="60%" id="tabella">
<tbody>
<tr>
<td><b>Server</b></td>
<td><b>Interfaccia</b></td>
<td><b>IP</b></td>
<td align="center"><img src="immagini/add.png" alt="" onclick="accoda()"></td>
</tr>
<?php for ($conta = 0; $conta < $quanti; $conta++) {
$scheda = mysql_fetch_array ( $res );
?>
<tr>
<input type="hidden" name="idscheda<?php print $conta?>" value="<?php print $scheda['id'] ?>">
<td><input id="nome<?php print $conta?>" name="nome<?php print $conta?>" type="text" value="<?php print $scheda['nome'] ?>"></td>
<td><input id="ip<?php print $conta?>" name="ip<?php print $conta?>" type="text" value="<?php print $scheda['ip'] ?>"></td>
<td><input id="iface<?php print $conta?>" name="iface<?php print $conta?>" type="text" value="<?php print $scheda['iface'] ?>"></td>
<td align="center"><input type="checkbox" name="check<?php print $conta?>" checked ></td>
</tr>
<?php } ?>
</tbody>
</table>
</td>
</tr>
<tr><td colspan="9"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr><td align="center" colspan="9">
<input type="submit" value="<?php print $bottone ?>">
&nbsp;&nbsp;&nbsp;
<input type="button" value="Annulla" onclick="location.href = '<?php print $CONF['base_url'] ?>/utenti/index.php';"></button>
<?php if ($modifica == 1) { ?>
&nbsp;&nbsp;&nbsp;
<input type="submit" value="Rimuovi" onclick="DoSubmit()">
<?php } ?>
</td></tr>
<tr><td colspan="9"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="10" alt=""></td></tr>
</table>
</form>
<?php } ?>
<?php view_footer(); ?>

View File

@@ -1,12 +1,10 @@
<?php
include_once ("../core/config.php");
$UTENTE = login();
$DIRITTI = diritti();
//isadmin();
$DIRITTI = diritti(1);
view_top();
?>
<?php include_once ("../core/top.php");?>
<script type="text/javascript">
<!--
@@ -84,4 +82,4 @@ while ($dato = mysql_fetch_array ( $res )) {
} ?>
</table>
<img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("../core/footer.php"); ?>
<?php view_footer(); ?>

View File

@@ -1,11 +1,9 @@
<?php
include_once ("../core/config.php");
$UTENTE = login();
$DIRITTI = diritti();
?>
<?php include_once ("../core/top.php"); ?>
$DIRITTI = diritti(10);
view_top();
<?php
if (isset($_GET['id'])) {
$bottone = "Modifica";
$modifica = 1;
@@ -221,4 +219,4 @@ $(document).ready(function()
</form>
<?php } ?>
<?php include_once ("../core/footer.php"); ?>
<?php view_footer(); ?>

View File

@@ -1,9 +1,9 @@
<?php
include_once ("../core/config.php");
$UTENTE = login();
$DIRITTI = diritti();
$DIRITTI = diritti(1);
view_top();
include_once ("../core/top.php");
$query = " SELECT
id,
nome,
@@ -109,4 +109,4 @@ $(function(){
})
</script>
<?php include_once ("../core/footer.php"); ?>
<?php view_footer(); ?>