Fix path
3
.htaccess
Normal file
@@ -0,0 +1,3 @@
|
||||
RewriteEngine on
|
||||
RewriteRule ^(.*/)?img/(.*) risorse/immagini/$2 [L]
|
||||
RewriteRule ^(.*/)?css/(.*) risorse/stili/$2 [L]
|
||||
@@ -1,49 +1,30 @@
|
||||
<?php
|
||||
include_once ("config.php");
|
||||
$UTENTE = login();
|
||||
//isadmin();
|
||||
?>
|
||||
<?php include_once ("top.php"); ?>
|
||||
|
||||
<?php
|
||||
if (isset($_GET['id'])) {
|
||||
$bottone = "Modifica";
|
||||
$modifica = 1;
|
||||
$query = "SELECT * FROM utenti WHERE id =".$_GET['id'];
|
||||
$res = mysql_query( $query, $DB_ID );
|
||||
$dato = mysql_fetch_array ( $res );
|
||||
$dato['password'] = "ahg5t!frtb5@u&^!";
|
||||
} else if (isset ($_POST['id'])) {
|
||||
if (isset ($_POST['id'])) {
|
||||
$modifica = 2;
|
||||
$id = $_POST['id'];
|
||||
$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 ($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'";
|
||||
}
|
||||
$testo = "L'utente e' stato correttamente modificato";
|
||||
$query = "UPDATE utenti SET $querypwd modifica = NOW(), mail='$mail' WHERE `id`=$id";
|
||||
?>
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="1" height="10" alt=""><td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="10" alt=""><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -56,39 +37,40 @@ Non e' stato possibile eseguire l'operazione richiesta a causa di un errore: <?p
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="1" height="5" alt=""></td>
|
||||
<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 = 'utenti.php';"></button></td>
|
||||
<td><input type="button" value="Ok" onclick="location.href = '<?php print $CONF['base_url'] ?>/index.php';"></button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="1" height="10" alt=""></td>
|
||||
<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;
|
||||
|
||||
$bottone = "Modifica";
|
||||
$modifica = 1;
|
||||
$query = "SELECT * FROM utenti WHERE utente = '".$UTENTE['utente']."'";
|
||||
$res = mysql_query( $query, $DB_ID );
|
||||
$dato = mysql_fetch_array ( $res );
|
||||
$dato['password'] = "ahg5t!frtb5@u&^!";
|
||||
}
|
||||
?>
|
||||
|
||||
<?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" src="../jquery/jquery.validate.password.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../jquery/jquery.validate.password.css" />
|
||||
<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">
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("#modulo").validate( {
|
||||
rules: {
|
||||
utente: {
|
||||
required: true,
|
||||
minlength: 4
|
||||
},
|
||||
mail: {
|
||||
required: true,
|
||||
email: true,
|
||||
@@ -103,10 +85,6 @@ $(document).ready(function()
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
utente: {
|
||||
required: "Inserire uno nome utente",
|
||||
minlength: jQuery.format("Inserire almeno {0} caratteri")
|
||||
},
|
||||
mail: {
|
||||
required: "Inserire un indirizzo e-mail valido",
|
||||
},
|
||||
@@ -133,42 +111,30 @@ $(document).ready(function()
|
||||
});
|
||||
</script>
|
||||
|
||||
<form action="modutenti.php" method="post" id="modulo">
|
||||
<form action="chkpasswd.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="30" height="1" alt=""></td>
|
||||
<td class="label"><label id="lusername" for="username">Nome Utente</label></td>
|
||||
<td class="field"><input id="utente" name="utente" type="text" value="<?php print $dato['utente']?>" maxlength="50" /></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
|
||||
<td>Nome Utente</td>
|
||||
<td><?php print $dato['utente']?></td>
|
||||
<td class="status" colspan="6"></td>
|
||||
</tr>
|
||||
<tr><td colspan="9"><img src="../img/spazio.gif" width="1" height="5" alt=""></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="../img/spazio.gif" width="30" height="1" alt=""></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
|
||||
<td class="label"><label id="lmail" for="mail">Indirizzo E-Mail</label></td>
|
||||
<td class="field"><input id="mail" name="mail" type="text" value="<?php print $dato['mail']?>" maxlength="50" /></td>
|
||||
<td class="status" colspan="6"></td>
|
||||
</tr>
|
||||
<tr><td colspan="9"><img src="../img/spazio.gif" width="1" height="5" alt=""></td></tr>
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="80" height="1" alt=""></td>
|
||||
<td>Attivo <input name="attivo" type="checkbox" value=1 <?php if ($dato['attivo']) { print "checked=\"checked\""; } ?>></td>
|
||||
<td><img src="../img/spazio.gif" width="20" height="1" alt=""></td>
|
||||
<td>Admin <input name="admin" type="checkbox" value=1 <?php if ($dato['admin']) { print "checked=\"checked\""; } ?>></td>
|
||||
<td colspan="4"><img src="../img/spazio.gif" width="250" height="1" alt=""></td>
|
||||
</tr>
|
||||
<tr><td colspan="9"><img src="../img/spazio.gif" width="1" height="5" alt=""></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 class="col1" colspan="9">
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="40" height="50" alt=""></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="40" height="50" alt=""></td>
|
||||
<td class="label"><label id="lpassword" for="password">Password</label></td>
|
||||
<td><img src="../img/spazio.gif" width="10" height="1" alt=""></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="10" height="1" alt=""></td>
|
||||
<td class="field" width="30"><input id="password1" name="password1" type="password" size="30" maxlength="32" value="<?php print $dato['password'] ?>" /></td>
|
||||
<td class="status" width="400">
|
||||
<div class="password-meter">
|
||||
@@ -180,25 +146,25 @@ $(document).ready(function()
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="../img/spazio.gif" width="40" height="50" alt=""></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="40" height="50" alt=""></td>
|
||||
<td class="label"><label id="lpassword_confirm" for="password_confirm">Password</label></td>
|
||||
<td><img src="../img/spazio.gif" width="10" height="1" alt=""></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="10" height="1" alt=""></td>
|
||||
<td class="field" width="30"><input id="password2" name="password2" type="password" size="30" maxlength="32" value="<?php print $dato['password'] ?>" /></td>
|
||||
<td class="status" width="400"></td>
|
||||
</tr>
|
||||
<tr><td colspan="9" class="spaziov"><img src="../img/spazio.gif" width="1" alt=""></td></tr>
|
||||
<tr><td colspan="9" class="spaziov"><img src="<?php print $CONF['base_url'] ?>/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 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 ?>">
|
||||
|
||||
<input type="button" value="Annulla" onclick="location.href = 'utenti.php';"></button>
|
||||
<input type="button" value="Annulla" onclick="location.href = '<?php print $CONF['base_url'] ?>/index.php';"></button>
|
||||
</td></tr>
|
||||
|
||||
<tr><td colspan="9"><img src="../img/spazio.gif" width="1" height="10" alt=""></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 } ?>
|
||||
|
||||
@@ -6,17 +6,17 @@ isadmin();
|
||||
include_once ("top.php"); ?>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||
<tr><td class="spaziov" colspan=7><img src="../img/spazio.gif"></td></tr>
|
||||
<tr><td class="spaziov" colspan=7><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
<tr>
|
||||
<td width="50"><img src="../img/spazio.gif"></td>
|
||||
<td width="50"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td width="150" class="campo">Campo</td>
|
||||
<td width="20"><img src="../img/spazio.gif"></td>
|
||||
<td width="20"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td width="350" class="campo">Valore</td>
|
||||
<td width="20"><img src="../img/spazio.gif"></td>
|
||||
<td width="20"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td width="350" class="campo">Nota</td>
|
||||
<td><img src="../img/spazio.gif"></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
</tr>
|
||||
<tr><td class="spaziov" colspan=7><img src="../img/spazio.gif"></td></tr>
|
||||
<tr><td class="spaziov" colspan=7><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
|
||||
<?php
|
||||
$query = "SELECT * FROM conf WHERE vis=1 ORDER BY ordine";
|
||||
@@ -48,15 +48,15 @@ while ($dato = mysql_fetch_array ( $res )) {
|
||||
if ($visualizza) {
|
||||
?>
|
||||
<tr>
|
||||
<td width="50"><img src="../img/spazio.gif"></td>
|
||||
<td width="50"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td width="150" class="valoretxt"><a class="menuatt" href="modconf.php?var=<?php print $dato['variabile'] ?>"><?php print $dato['variabile']?></a></td>
|
||||
<td width="20" bgcolor="#f3f3f3"><img src="../img/spazio.gif"></td>
|
||||
<td width="20" bgcolor="#f3f3f3"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td width="350" class="valoretxt"><?php print $riga?></td>
|
||||
<td width="20" bgcolor="#f3f3f3"><img src="../img/spazio.gif"></td>
|
||||
<td width="20" bgcolor="#f3f3f3"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td width="350" class="valoretxt"><?php print $dato['Commento']?></td>
|
||||
<td><img src="../img/spazio.gif"></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
</tr>
|
||||
<tr><td class="spaziov" colspan=7><img src="../img/spazio.gif"></td></tr>
|
||||
<tr><td class="spaziov" colspan=7><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</table>
|
||||
|
||||
@@ -108,11 +108,11 @@ function carica_conf () {
|
||||
}
|
||||
|
||||
function isadmin () {
|
||||
global $UTENTE;
|
||||
global $UTENTE, $CONF;
|
||||
if ($UTENTE['admin']) {
|
||||
return;
|
||||
} else {
|
||||
header("location: main.php");
|
||||
header("location: ".$CONF['base_url']."/index.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ function logga ($testo, $dest="") {
|
||||
// print "-- $sessione --";
|
||||
$query = "INSERT INTO accessi_utenti SET utente = '$destinatario', quando = now(), ip = '$ip', cosa = '$testo', sessione = '$sessione'";
|
||||
$queryuser = "UPDATE utenti SET ultimo = now() WHERE utente = '$destinatario'";
|
||||
// print "-- $queryuser --";
|
||||
// print "-- $query --";
|
||||
$res = mysql_query( $query, $DB_ID );
|
||||
$res = mysql_query( $queryuser, $DB_ID );
|
||||
}
|
||||
@@ -327,4 +327,56 @@ function azioni ($tabella, $idtabella, $stato) {
|
||||
}
|
||||
}
|
||||
|
||||
function lista_moduli () {
|
||||
global $UTENTE, $DB_ID, $CONF;
|
||||
|
||||
$query = " SELECT
|
||||
moduli.nome AS nome,
|
||||
moduli.directory AS directory
|
||||
FROM
|
||||
utenti
|
||||
JOIN
|
||||
permessi ON utenti.id = permessi.id_utenti
|
||||
JOIN
|
||||
moduli ON moduli.id = permessi.id_moduli
|
||||
WHERE
|
||||
utenti.utente = '".$_SESSION['username']."'
|
||||
";
|
||||
|
||||
$menu[] = array("Home", $CONF['base_url']."/core/main.php");
|
||||
|
||||
if ($UTENTE['admin']) {
|
||||
$menu[] = array("Configurazione", $CONF['base_url']."/core/conf.php");
|
||||
$query .= " OR moduli.superadmin = 1";
|
||||
}
|
||||
|
||||
$res = mysql_query( $query, $DB_ID );
|
||||
|
||||
while ($dato = mysql_fetch_array ($res)) {
|
||||
$menu[] = array($dato['nome'], $CONF['base_url']."/".$dato['directory']."/index.php");
|
||||
}
|
||||
|
||||
$menu[] = array("Cambio password", $CONF['base_url']."/core/chkpasswd.php");
|
||||
|
||||
$pezzi = preg_split('/\//', $_SERVER["PHP_SELF"], -2);
|
||||
$self = $pezzi[count($pezzi)-1];
|
||||
?>
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||
<tr bgcolor="#d2f4df">
|
||||
<?php for ($i=0; $i<count($menu);$i++) {
|
||||
if ($self == $menu[$i][1]) {
|
||||
$classe = "menuatt";
|
||||
} else {
|
||||
$classe = "menu";
|
||||
}
|
||||
?>
|
||||
<td class="spaziol"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td nowrap class="<?php echo $classe?>"><a class="<?php echo $classe?>" href="<?php print $menu[$i][1]?>"><?php print $menu[$i][0]?></a></td>
|
||||
<?php } ?>
|
||||
<td class="spaziol"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
include_once ("core/config.php");
|
||||
include_once ("config.php");
|
||||
login();
|
||||
logga ("Uscita");
|
||||
session_name("AllegatiSW");
|
||||
session_start();
|
||||
$_SESSION['auth'] = 0;
|
||||
session_destroy();
|
||||
header('Location: index.php');
|
||||
header('Location: ../index.php');
|
||||
?>
|
||||
@@ -1,17 +1,14 @@
|
||||
<?php
|
||||
include_once ("config.php");
|
||||
$UTENTE = login();
|
||||
isadmin();
|
||||
//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>
|
||||
|
||||
|
||||
|
||||
<tr><td class="spaziov" colspan="9"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
</table>
|
||||
|
||||
<img src="img/spazio.gif" width="1" height="20" alt="">
|
||||
|
||||
53
core/top.php
@@ -4,60 +4,27 @@
|
||||
<title>SpazioFirewall</title>
|
||||
</head>
|
||||
<body>
|
||||
<link rel="stylesheet" type="text/css" href="../css/stile.css" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php print $CONF['base_url'] ?>/css/stile.css" />
|
||||
<table cellpadding="0" cellspacing="0" border="0" align="center" width="1000">
|
||||
<?php if ($_SESSION['auth']) { ?>
|
||||
<?php
|
||||
if ($UTENTE['utente'] != '') { ?>
|
||||
<tr><td>
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr bgcolor="#FFC350">
|
||||
<td nowrap class="ltop">Utente: <?php print $_SESSION['username'] ?></td>
|
||||
<td width="200"> </td>
|
||||
<?php if ($_SESSION['auth']) { ?>
|
||||
<td class="rtop"><a class="rtop" href="logout.php">Logout</a></td>
|
||||
<?php } else {?>
|
||||
<td> </td>
|
||||
<?php } ?>
|
||||
<td class="rtop"><a class="rtop" href="<?php print $CONF['base_url'] ?>/core/logout.php">Logout</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
<tr><td class="spaziov" colspan=2><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
<tr><td align="center">
|
||||
<?php
|
||||
|
||||
if ($UTENTE['admin']) {
|
||||
$menu = array( array("Home", "main.php"),
|
||||
array("Configurazione", "conf.php"),
|
||||
array("Gestione utenti", "utenti.php"),
|
||||
array("Cambio password", "chkpasswd.php"),
|
||||
);
|
||||
} else {
|
||||
$menu = array( array("Cambio password", "chkpasswd.php"),
|
||||
);
|
||||
}
|
||||
|
||||
$pezzi = preg_split('/\//', $_SERVER["PHP_SELF"], -1);
|
||||
$self = $pezzi[count($pezzi)-1];
|
||||
?>
|
||||
<tr><td class="spaziov" colspan=2><img src="../img/spazio.gif"></td></tr>
|
||||
<tr><td align="center">
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||
<tr bgcolor="#d2f4df">
|
||||
<?php for ($i=0; $i<count($menu);$i++) {
|
||||
if ($self == $menu[$i][1]) {
|
||||
$classe = "menuatt";
|
||||
} else {
|
||||
$classe = "menu";
|
||||
}
|
||||
?>
|
||||
<td class="spaziol"><img src="../img/spazio.gif"></td>
|
||||
<td nowrap class="<?php echo $classe?>"><a class="<?php echo $classe?>" href="<?php print $menu[$i][1]?>"><?php print $menu[$i][0]?></a></td>
|
||||
<?php } ?>
|
||||
<td class="spaziol"><img src="../img/spazio.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php } else {?>
|
||||
lista_moduli();
|
||||
} else {?>
|
||||
<tr bgcolor="#FFC350"><td> </td></tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</td></tr>
|
||||
<tr><td class="spaziov" colspan=2><img src="../img/spazio.gif"></td></tr>
|
||||
<tr><td class="spaziov" colspan=2><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
<tr><td align="center">
|
||||
|
||||
|
||||
|
||||
195
grafico.php
@@ -1,195 +0,0 @@
|
||||
<?php
|
||||
include_once ("core/config.php");
|
||||
$UTENTE = login();
|
||||
//isadmin();
|
||||
|
||||
if (isset ($_GET['rif']))
|
||||
$rif = $_GET['rif'];
|
||||
else if (isset ($_POST['rif']))
|
||||
$rif = $_POST['rif'];
|
||||
|
||||
if (isset ($_GET['device']))
|
||||
$device = $_GET['device'];
|
||||
else if (sset ($_POST['device']))
|
||||
$device = $_POST['device'];
|
||||
|
||||
if (isset ($_POST['datainizio']))
|
||||
$datainizio = $_POST['datainizio'];
|
||||
else
|
||||
$datainizio = date("Y-m-d", (time()-24*3600));
|
||||
|
||||
if (isset ($_POST['orainizio']))
|
||||
$orainizio = $_POST['orainizio'];
|
||||
else
|
||||
$orainizio = date("H");
|
||||
|
||||
if (isset ($_POST['mininizio']))
|
||||
$mininizio = $_POST['mininizio'];
|
||||
else
|
||||
$mininizio = date("i")-(date("i")%5);
|
||||
|
||||
if (isset ($_POST['datafine']))
|
||||
$datafine = $_POST['datafine'];
|
||||
else
|
||||
$datafine = date("Y-m-d");
|
||||
|
||||
if (isset ($_POST['orafine']))
|
||||
$orafine = $_POST['orafine'];
|
||||
else
|
||||
$orafine = date("H");
|
||||
|
||||
if (isset ($_POST['minfine']))
|
||||
$minfine = $_POST['minfine'];
|
||||
else
|
||||
$minfine = date("i")-(date("i")%5);
|
||||
|
||||
if (isset ($_POST['dettaglio']))
|
||||
$dettaglio = $_POST['dettaglio'];
|
||||
else
|
||||
$dettaglio = "minuto";
|
||||
|
||||
//$query = "SELECT MIN(data), MAX(data) FROM dati_giorno";
|
||||
$query = "SELECT MIN(data), DATE(NOW()) FROM dati_giorno";
|
||||
$res = mysql_query( $query );
|
||||
list ($mindata, $maxdata) = mysql_fetch_array($res);
|
||||
|
||||
|
||||
$dataini = strtok($mindata," ");
|
||||
$anno = strtok($mindata,"-");
|
||||
$mese = strtok("-");
|
||||
$giorno = strtok("-");
|
||||
$mindatar = "$giorno-$mese-$anno";
|
||||
$dataini = strtok($maxdata," ");
|
||||
$anno = strtok($maxdata,"-");
|
||||
$mese = strtok("-");
|
||||
$giorno = strtok("-");
|
||||
$maxdatar = "$giorno-$mese-$anno";
|
||||
|
||||
if (count ($_POST)) {
|
||||
$body = "";
|
||||
} else {
|
||||
$body = "onLoad=document.forms['grafici'].submit();";
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<?php require_once('calendar/tc_calendar.php'); ?>
|
||||
<link rel="stylesheet" type="text/css" href="stile.css" />
|
||||
<link rel="stylesheet" type="text/css" href="calendar.css" />
|
||||
</head>
|
||||
<body <?php print $body ?>>
|
||||
<form method="post" name="grafici">
|
||||
<input type="hidden" name="rif" value="<?php print $rif ?>">
|
||||
<input type="hidden" name="device" value="<?php print $device ?>">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="900">
|
||||
<tr height="400">
|
||||
<td colspan="9" >
|
||||
<div style= "border: solid 0 #060; border-width:2px; padding:0.5ex">
|
||||
<?php
|
||||
if (count ($_POST)) {
|
||||
$riferimento = $rif;
|
||||
include "graph.php";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
<tr>
|
||||
<tr><td class="spaziov" colspan="9"><img src="img/spazio.gif"></td></tr>
|
||||
<tr>
|
||||
<td rowspan="2" class="spaziov" width="50"><img src="img/spazio.gif"></td>
|
||||
<td width="250" align="center">
|
||||
<b>Data inizio grafico</b>
|
||||
</td>
|
||||
|
||||
<td rowspan="2" class="spaziov" width="50"><img src="img/spazio.gif"></td>
|
||||
<td width="250" align="center">
|
||||
<b>Data termine grafico</b>
|
||||
</td>
|
||||
<td rowspan="2" class="spaziov" width="50"><img src="img/spazio.gif"></td>
|
||||
<td align="center"><b>Dettaglio</b></td>
|
||||
<td rowspan="2" class="spaziov"><img src="img/spazio.gif"></td>
|
||||
<td rowspan="2" ><input type="submit" value="Visualizza"></td>
|
||||
<td rowspan="2" class="spaziov"><img src="img/spazio.gif"></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="250" align="center">
|
||||
<?php
|
||||
$myCalendar = new tc_calendar("datainizio", true, false);
|
||||
$myCalendar->setPath("calendar/");
|
||||
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
|
||||
if (strlen($datainizio!=0)) {
|
||||
$dataini = strtok($datainizio," ");
|
||||
$anno = strtok($dataini,"-");
|
||||
$mese = strtok("-");
|
||||
$giorno = strtok("-");
|
||||
$myCalendar->setDate($giorno,$mese,$anno);
|
||||
} else {
|
||||
$myCalendar->setDate(date('d'), date('m'), date('Y'));
|
||||
}
|
||||
$myCalendar->dateAllow($mindata,$maxdata,false);
|
||||
$myCalendar->startMonday(true);
|
||||
$myCalendar->setAlignment("left", "top");
|
||||
$myCalendar->setDatePair("datainizio", "datafine");
|
||||
$myCalendar->writeScript();
|
||||
?>
|
||||
Ora:
|
||||
<select name='orainizio'>
|
||||
<?php for ($i = 0; $i<24; $i++) { ?>
|
||||
<option name='orainizio' value='<?php print $i ?>' <?php if ($i == $orainizio) print "selected"?>><?php printf ("%02d",$i) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<select name='mininizio'>
|
||||
<?php for ($i = 0; $i<60; $i+=5) { ?>
|
||||
<option name='mininizio' value='<?php print $i ?>' <?php if ($i == $mininizio) print "selected"?>><?php printf ("%02d",$i) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
<td width="250" align="center">
|
||||
<?php
|
||||
$myCalendar = new tc_calendar("datafine", true, false);
|
||||
$myCalendar->setPath("calendar/");
|
||||
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
|
||||
if (strlen($datafine!=0)) {
|
||||
$dataini = strtok($datafine," ");
|
||||
$anno = strtok($dataini,"-");
|
||||
$mese = strtok("-");
|
||||
$giorno = strtok("-");
|
||||
$myCalendar->setDate($giorno,$mese,$anno);
|
||||
} else {
|
||||
$myCalendar->setDate(date('d'), date('m'), date('Y'));
|
||||
}
|
||||
$myCalendar->dateAllow($mindata,$maxdata,false);
|
||||
$myCalendar->startMonday(true);
|
||||
$myCalendar->setAlignment("left", "top");
|
||||
$myCalendar->setDatePair("datainizio", "datafine");
|
||||
$myCalendar->writeScript();
|
||||
?>
|
||||
Ora:
|
||||
<select name='orafine'>
|
||||
<?php for ($i = 0; $i<24; $i++) { ?>
|
||||
<option name='orafine' value='<?php print $i ?>' <?php if ($i == $orafine) print "selected"?>><?php printf ("%02d",$i) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<select name='minfine'>
|
||||
<?php for ($i = 0; $i<60; $i+=5) { ?>
|
||||
<option name='minfine' value='<?php print $i ?>' <?php if ($i == $minfine) print "selected"?>><?php printf ("%02d",$i) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
<td align="center">
|
||||
<select name='dettaglio'>
|
||||
<option name='dettaglio' value='minuto' <?php if ($dettaglio == "minuto") print "selected"?>>Minuto</option>
|
||||
<option name='dettaglio' value='ora' <?php if ($dettaglio == "ora") print "selected"?>>Ora</option>
|
||||
<option name='dettaglio' value='giorno' <?php if ($dettaglio == "giorno") print "selected"?>>Giorno</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</post>
|
||||
</body>
|
||||
</html>
|
||||
270
graph.php
@@ -1,270 +0,0 @@
|
||||
<?php
|
||||
include_once ("core/config.php");
|
||||
$UTENTE = login();
|
||||
//isadmin();
|
||||
|
||||
include_once "jpgraph/jpgraph.php";
|
||||
include_once "jpgraph/jpgraph_line.php";
|
||||
include_once "jpgraph/jpgraph_plotline.php";
|
||||
include_once "jpgraph/jpgraph_bar.php";
|
||||
|
||||
if (isset ($_GET['datainizio'])) $datainizio = $_GET['datainizio'];
|
||||
if (isset ($_GET['orainizio'])) $orainizio = $_GET['orainizio'];
|
||||
if (isset ($_GET['mininizio'])) $mininizio = $_GET['mininizio'];
|
||||
if (isset ($_GET['datafine'])) $datafine = $_GET['datafine'];
|
||||
if (isset ($_GET['orafine'])) $orafine = $_GET['orafine'];
|
||||
if (isset ($_GET['minfine'])) $minfine = $_GET['minfine'];
|
||||
if (isset ($_GET['dettaglio'])) $dettaglio = $_GET['dettaglio'];
|
||||
if (isset ($_GET['rif'])) $riferimento = $_GET['rif'];
|
||||
if (isset ($_GET['device'])) $device = $_GET['device'];
|
||||
|
||||
if ($dettaglio == 'ora') {
|
||||
$mininizio = $minfine = 0;
|
||||
}
|
||||
|
||||
$data_ini = explode ("-", $datainizio);
|
||||
$data_fin = explode ("-", $datafine);
|
||||
$data_ini_TS = mktime (0, 0, 0, $data_ini[1], $data_ini[2], $data_ini[0] );
|
||||
$data_fin_TS = mktime (0, 0, 0, $data_fin[1], $data_fin[2], $data_fin[0] );
|
||||
|
||||
$data_dif = ceil (($data_fin_TS - $data_ini_TS) / 86400 );
|
||||
|
||||
list ($annoinizio, $meseinizio, $giornoinizio) = explode ("-",$datainizio);
|
||||
list ($annofine, $mesefine, $giornofine) = explode ("-",$datafine);
|
||||
|
||||
$l = 900;
|
||||
$h = 400;
|
||||
|
||||
$datainizioquery = $inizio = @mktime ($orainizio, $mininizio, 0, $meseinizio, $giornoinizio, $annoinizio);
|
||||
$datafinequery = $fine = @mktime ($orafine, $minfine, 0, $mesefine, $giornofine, $annofine);
|
||||
$mezzanotte = mktime (0,0,0,$mesefine ,$giornofine, $annofine);
|
||||
|
||||
if ($riferimento == 0) {
|
||||
$query = "SELECT descrizione AS servizio, rate * 1024 AS garantiti, ceil * 1024 AS massimo FROM interfacce WHERE id='$device'";
|
||||
} else {
|
||||
$query = "SELECT descrizione AS servizio, rate * 1024 AS garantiti, ceil * 1024 AS massimo FROM defrule WHERE id='$riferimento' and idinterfacce='$device'";
|
||||
}
|
||||
|
||||
$res = mysql_query( $query );
|
||||
list ($servizio, $garantiti, $limite) = mysql_fetch_array($res);
|
||||
|
||||
switch ($dettaglio) {
|
||||
case "minuto":
|
||||
$query = "SELECT idfirewall, dataunix AS time, rate AS picco, rate AS media, diff AS dati FROM dati_traffico WHERE ((iddefrule='$riferimento' and idinterfacce='$device') and (dataunix between '$datainizioquery' and '$datafinequery')) order by dataunix";
|
||||
$query_max = "SELECT firewall.nome, MAX(dati_traffico.rate) AS massimo, AVG(dati_traffico.rate) AS media, STDDEV(dati_traffico.rate) AS deviazione, SUM(dati_traffico.diff) AS traffico FROM dati_traffico JOIN firewall ON firewall.id=dati_traffico.idfirewall WHERE iddefrule='$riferimento' AND idinterfacce='$device' AND dataunix BETWEEN '$datainizioquery' AND '$datafinequery' GROUP BY idfirewall";
|
||||
$txt_sotto = "Dalle ore ".date ("H:i",$inizio)." del ".date ("d.m.Y",$inizio)." alle ore ".date ("H:i",$fine)." del ".date ("d.m.Y",$fine);
|
||||
$querysum = "SELECT UNIX_TIMESTAMP(FROM_UNIXTIME(dataunix,'%Y-%m-%d %H:%i')) AS time, SUM(rate) AS picco, SUM(rate) AS media, SUM(diff) AS dati FROM dati_traffico WHERE ((iddefrule='$riferimento' and idinterfacce='$device') and (dataunix between '$datainizioquery' and '$datafinequery')) GROUP BY FROM_UNIXTIME(dataunix,'%Y-%m-%d %H:%i') ORDER BY dataunix";
|
||||
break;
|
||||
|
||||
case "ora":
|
||||
$query = "SELECT idfirewall, dataunix AS time, max AS picco, media, traffico AS dati FROM dati_ora WHERE ((iddefrule='$riferimento' and idinterfacce='$device') and (dataunix between '$datainizioquery' and '$datafinequery')) order by dataunix";
|
||||
$query_max = "SELECT firewall.nome, MAX(dati_ora.max) AS massimo, avg(dati_ora.max) AS media, stddev(dati_ora.max) AS deviazione, sum(dati_ora.traffico) AS traffico FROM dati_ora JOIN firewall ON firewall.id=dati_ora.idfirewall WHERE iddefrule='$riferimento' AND idinterfacce='$device' AND dataunix BETWEEN '$datainizioquery' and '$datafinequery' GROUP BY idfirewall";
|
||||
$txt_sotto = "Dalle ore ".date ("H",$inizio).":00 del ".date ("d.m.Y",$inizio)." alle ore ".date ("H",$fine).":00 del ".date ("d.m.Y",$fine);
|
||||
$barre = array();
|
||||
break;
|
||||
|
||||
case "giorno":
|
||||
$query = "SELECT idfirewall, UNIX_TIMESTAMP(data) AS time, max AS picco, media, traffico AS dati FROM dati_giorno WHERE ((iddefrule='$riferimento' and idinterfacce='$device') and (data BETWEEN DATE('$datainizio') and DATE('$datafine'))) order by data";
|
||||
$query_max = "SELECT firewall.nome, MAX(dati_giorno.max) AS massimo, AVG(dati_giorno.max) AS media, STDDEV(dati_giorno.max) AS deviazione, SUM(dati_giorno.traffico) AS traffico FROM dati_giorno JOIN firewall ON firewall.id=dati_giorno.idfirewall WHERE iddefrule='$riferimento' AND idinterfacce='$device' AND (data BETWEEN DATE('$datainizio') AND DATE('$datafine')) GROUP BY idfirewall";
|
||||
$txt_sotto = "Dal giorno ".date ("d.m.Y",$inizio)." al giorno ".date ("d.m.Y",$fine);
|
||||
$barre = array();
|
||||
break;
|
||||
|
||||
case "settimana":
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$testo_leg = "";
|
||||
$res_max = mysql_query( $query_max );
|
||||
while ($dati_max = mysql_fetch_array($res_max)) {
|
||||
if ($dettaglio == "minuto") {
|
||||
$testo_leg .= "(".$dati_max['nome'].") Picco: ".fsize ($dati_max['massimo'])."/s Media: ".fsize($dati_max['media'])."/s Traffico Totale: ".fsize($dati_max['traffico']*1024)."\n";
|
||||
} else {
|
||||
$testo_leg .= "(".$dati_max['nome'].") Picco: ".fsize ($dati_max['massimo'])."/s Traffico Totale: ".fsize($dati_max['traffico']*1024)."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$res = mysql_query( $query );
|
||||
if ($dettaglio == "minuto") {
|
||||
$ressum = mysql_query( $querysum );
|
||||
}
|
||||
$xdata = array(array());
|
||||
$ydata = array(array());
|
||||
$tag = array(array());
|
||||
$alt = array(array());
|
||||
$cambiogiorno = array();
|
||||
|
||||
while ( list ($fw, $tempo, $picco, $media, $dati) = mysql_fetch_array($res)) {
|
||||
switch ($dettaglio) {
|
||||
case "minuto":
|
||||
inslabel ($tempo, $fw, $data_dif);
|
||||
$ydata[$fw][] = $picco / 1024;
|
||||
$mediadata[$fw][] = $media / 1024;
|
||||
break;
|
||||
case "ora":
|
||||
inslabel ($tempo, $fw, $data_dif);
|
||||
$ydata[$fw][] = $picco / 1024;
|
||||
$tag[$fw][] = " ";
|
||||
$alt[$fw][] = "Picco: ".fsize($picco)."/s\nMedia: ".fsize($media)."/s\nTraffico: ".fsize($dati*1024);
|
||||
$ytraffico[$fw][] = $dati;
|
||||
break;
|
||||
case "giorno":
|
||||
$xdata[$fw][] = date ("d.m.Y",$tempo);
|
||||
$ydata[$fw][] = $picco / 1024;
|
||||
$tag[$fw][] = " ";
|
||||
$alt[$fw][] = "Picco: ".fsize($picco)."/s\nMedia: ".fsize($media)."/s\nTraffico: ".fsize($dati*1024);
|
||||
$ytraffico[$fw][] = $dati;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
if ($dettaglio == "minuto") {
|
||||
while ( list ($tempo, $picco, $media, $dati) = mysql_fetch_array($ressum)) {
|
||||
inslabel ($tempo, 0, $data_dif);
|
||||
$ydata[0][] = $picco / 1024;
|
||||
$ytraffico[0][] = $dati;
|
||||
}
|
||||
$testo_leg .= "(System) Picco: ".fsize (max($ydata[0]) * 1024)."/s Media: ".fsize(array_sum($ydata[0]) / count ($ydata[0]) * 1024)."/s Traffico Totale: ".fsize(array_sum($ytraffico[0]) * 1024)."\n";
|
||||
} else {
|
||||
$somma_traffico = 0;
|
||||
foreach ($ytraffico as $k=>$subArray) {
|
||||
$somma_traffico += array_sum ($subArray);
|
||||
}
|
||||
$testo_leg .= "(System) Traffico Totale: ".fsize($somma_traffico * 1024)."\n";
|
||||
}
|
||||
|
||||
// Create the graph
|
||||
$g = new Graph($l,$h);
|
||||
$g->SetMargin(60,20,50,80);
|
||||
$g->title->SetFont(FF_VERDANA);
|
||||
$g->title->Set("Traffico regola \"$servizio\"");
|
||||
$g->subtitle->Set("$testo_leg Banda garantita: ".fsize ($garantiti * 1024)."/s - Banda massima: ".fsize($limite * 1024)."/s\n$txt_sotto");
|
||||
$g->SetShadow();
|
||||
$g->SetScale('textlin');
|
||||
|
||||
$g->xaxis->SetLabelAngle(90);
|
||||
$g->yaxis->title->SetFont(FF_VERDANA);
|
||||
$g->yaxis->SetLabelFormatCallback('udm');
|
||||
|
||||
if ($dettaglio == "minuto") {
|
||||
$query = "SELECT id, nome, colore FROM firewall";
|
||||
} else {
|
||||
$query = "SELECT id, nome, colore FROM firewall WHERE id > 0";
|
||||
|
||||
}
|
||||
$res = mysql_query( $query );
|
||||
while ( list ($fwid, $fwnome, $fwcolore) = mysql_fetch_array($res)) {
|
||||
|
||||
switch ($dettaglio) {
|
||||
case "minuto":
|
||||
$$fwnome = new LinePlot($ydata[$fwid]);
|
||||
$g->Add($$fwnome);
|
||||
$g->xaxis->SetTickLabels($xdata[$fwid]);
|
||||
$$fwnome->SetColor($fwcolore);
|
||||
$$fwnome->SetLegend ($fwnome);
|
||||
break;
|
||||
case "ora":
|
||||
case "giorno":
|
||||
$$fwnome = new BarPlot($ydata[$fwid]);
|
||||
$g->xaxis->SetTickLabels($xdata[$fwid]);
|
||||
$$fwnome->SetCSIMTargets($tag[$fwid],$alt[$fwid]);
|
||||
$barre[] = $$fwnome;
|
||||
break;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
if ($dettaglio == "ora" || $dettaglio == "giorno") {
|
||||
// $gbarre = new GroupBarPlot ($barre);
|
||||
$gbarre = new AccBarPlot ($barre);
|
||||
$g->Add($gbarre);
|
||||
|
||||
$res = mysql_query( $query );
|
||||
while ( list ($fwid, $fwnome, $fwcolore) = mysql_fetch_array($res)) {
|
||||
$color1 = sprintf ("%s1",$fwcolore);
|
||||
$color2 = sprintf ("%s4",$fwcolore);
|
||||
$$fwnome->SetFillGradient($color1,$color2,GRAD_VERT);
|
||||
$$fwnome->SetFillColor($fwcolore);
|
||||
$$fwnome->SetColor($fwcolore);
|
||||
$$fwnome->SetLegend ($fwnome);
|
||||
}
|
||||
}
|
||||
|
||||
if ($limite == $garantiti) {
|
||||
$spessore = 2;
|
||||
} else {
|
||||
$spessore = 1;
|
||||
}
|
||||
|
||||
# Inserisco linea di Massimo
|
||||
if (($massimo / 1024 ) > $limite) {
|
||||
$llim = new PlotLine (HORIZONTAL,$limite, "red",$spessore);
|
||||
$g->Add($llim);
|
||||
}
|
||||
|
||||
# Inserisco linea di Garantito
|
||||
if (($massimo / 1024) > $garantiti) {
|
||||
$lgar = new PlotLine (HORIZONTAL,$garantiti, "green",1);
|
||||
$g->Add($lgar);
|
||||
}
|
||||
|
||||
# Inserisco linea di Media
|
||||
$lmedia = new PlotLine (HORIZONTAL,$med/1024, "yellow",1);
|
||||
$g->Add($lmedia);
|
||||
|
||||
# Inserisco cambi di giorno
|
||||
for ($i = 0; $i<count($cambiogiorno); $i++) {
|
||||
$dayline = new PlotLine(VERTICAL,$cambiogiorno[$i],"black",2);
|
||||
$g->AddLine($dayline);
|
||||
}
|
||||
|
||||
$g->legend->Pos( 0.02,0.02,"right" ,"top");
|
||||
$g->legend->SetColumns(1);
|
||||
$g->legend->SetFrameWeight(2);
|
||||
$g->legend->SetShadow();
|
||||
|
||||
$g->StrokeCSIM('graph.php','giorni');
|
||||
|
||||
function inslabel ($tempo, $fw, $data_dif) {
|
||||
global $xdata, $cambiogiorno;
|
||||
|
||||
if ($data_dif <= 1) {
|
||||
if (date("H:i",$tempo) == "00:00") {
|
||||
$xdata[$fw][] = date ("d.m H:i",$tempo);
|
||||
if (!array_search(count($xdata[$fw]), $cambiogiorno)) {
|
||||
$cambiogiorno[] = count($xdata[$fw]);
|
||||
}
|
||||
} else if (date("i",$tempo) == "00") {
|
||||
$xdata[$fw][] = date ("H:i",$tempo);
|
||||
} else {
|
||||
$xdata[$fw][] = "";
|
||||
}
|
||||
} else if ($data_dif <= 12) {
|
||||
if (date("H:i",$tempo) == "00:00") {
|
||||
$xdata[$fw][] = date ("d.m H:i",$tempo);
|
||||
if (!array_search(count($xdata[$fw]), $cambiogiorno)) {
|
||||
$cambiogiorno[] = count($xdata[$fw]);
|
||||
}
|
||||
} else if ((date("i",$tempo) == "00") && ( ( date("H",$tempo)%(floor(24/floor(24/$data_dif))) ) == 0 )) {
|
||||
$xdata[$fw][] = date ("H:i",$tempo);
|
||||
} else {
|
||||
$xdata[$fw][] = "";
|
||||
}
|
||||
} else {
|
||||
if (date("H:i",$tempo) == "00:00") {
|
||||
$xdata[$fw][] = date ("d.m H:i",$tempo);
|
||||
} else {
|
||||
$xdata[$fw][] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function udm ($valore) {
|
||||
if ($valore)
|
||||
return fsize ($valore*1024);
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
?>
|
||||
240
graph.php.old
@@ -1,240 +0,0 @@
|
||||
<?php
|
||||
include_once ("core/config.php");
|
||||
$UTENTE = login();
|
||||
//isadmin();
|
||||
|
||||
include_once "jpgraph/jpgraph.php";
|
||||
include_once "jpgraph/jpgraph_line.php";
|
||||
include_once "jpgraph/jpgraph_plotline.php";
|
||||
include_once "jpgraph/jpgraph_bar.php";
|
||||
|
||||
if (isset ($_GET['datainizio'])) $datainizio = $_GET['datainizio'];
|
||||
if (isset ($_GET['orainizio'])) $orainizio = $_GET['orainizio'];
|
||||
if (isset ($_GET['mininizio'])) $mininizio = $_GET['mininizio'];
|
||||
if (isset ($_GET['datafine'])) $datafine = $_GET['datafine'];
|
||||
if (isset ($_GET['orafine'])) $orafine = $_GET['orafine'];
|
||||
if (isset ($_GET['minfine'])) $minfine = $_GET['minfine'];
|
||||
if (isset ($_GET['dettaglio'])) $dettaglio = $_GET['dettaglio'];
|
||||
if (isset ($_GET['rif'])) $riferimento = $_GET['rif'];
|
||||
if (isset ($_GET['device'])) $device = $_GET['device'];
|
||||
|
||||
if ($dettaglio == 'ora') {
|
||||
$mininizio = $minfine = 0;
|
||||
}
|
||||
|
||||
$data_ini = new DateTime($datainizio);
|
||||
$data_fin = new DateTime($datafine);
|
||||
$data_dif = $data_fin->diff($data_ini)->days;
|
||||
|
||||
$datainizioquery = "$datainizio $orainizio:$mininizio:0";
|
||||
$datafinequery = "$datafine $orafine:$minfine:0";
|
||||
|
||||
list ($annoinizio, $meseinizio, $giornoinizio) = explode ("-",$datainizio);
|
||||
list ($annofine, $mesefine, $giornofine) = explode ("-",$datafine);
|
||||
|
||||
$l = 900;
|
||||
$h = 400;
|
||||
|
||||
$inizio = @mktime ($orainizio, $mininizio, 0, $meseinizio, $giornoinizio, $annoinizio);
|
||||
$fine = @mktime ($orafine, $minfine, 0, $mesefine, $giornofine, $annofine);
|
||||
$mezzanotte = mktime (0,0,0,$mesefine ,$giornofine, $annofine);
|
||||
|
||||
if ($riferimento == 0) {
|
||||
$query = "SELECT descrizione AS servizio, rate * 1024 AS garantiti, ceil * 1024 AS massimo FROM interfacce WHERE id='$device'";
|
||||
} else {
|
||||
$query = "SELECT descrizione AS servizio, rate * 1024 AS garantiti, ceil * 1024 AS massimo FROM defrule WHERE id='$riferimento' and idinterfacce='$device'";
|
||||
}
|
||||
|
||||
$res = mysql_query( $query );
|
||||
list ($servizio, $garantiti, $limite) = mysql_fetch_array($res);
|
||||
|
||||
switch ($dettaglio) {
|
||||
case "minuto":
|
||||
$query = "SELECT idfirewall, UNIX_TIMESTAMP(data) AS time, rate AS picco, rate AS media, diff AS dati FROM dati_traffico WHERE ((iddefrule='$riferimento' and idinterfacce='$device') and (data between '$datainizioquery' and '$datafinequery')) order by data";
|
||||
$query_max = "SELECT firewall.nome, MAX(dati_traffico.rate) AS massimo, AVG(dati_traffico.rate) AS media, STDDEV(dati_traffico.rate) AS deviazione, SUM(dati_traffico.diff) AS traffico FROM dati_traffico JOIN firewall ON firewall.id=dati_traffico.idfirewall WHERE iddefrule='$riferimento' AND idinterfacce='$device' AND data BETWEEN '$datainizioquery' AND '$datafinequery' GROUP BY idfirewall";
|
||||
$txt_sotto = "Dalle ore ".date ("H:i",$inizio)." del ".date ("d.m.Y",$inizio)." alle ore ".date ("H:i",$fine)." del ".date ("d.m.Y",$fine);
|
||||
break;
|
||||
|
||||
case "ora":
|
||||
$query = "SELECT idfirewall, UNIX_TIMESTAMP(data) AS time, max AS picco, media, traffico AS dati FROM dati_ora WHERE ((iddefrule='$riferimento' and idinterfacce='$device') and (data between '$datainizioquery' and '$datafinequery')) order by data";
|
||||
$query_max = "SELECT firewall.nome, MAX(dati_ora.max) AS massimo, avg(dati_ora.max) AS media, stddev(dati_ora.max) AS deviazione, sum(dati_ora.traffico) AS traffico FROM dati_ora JOIN firewall ON firewall.id=dati_ora.idfirewall WHERE iddefrule='$riferimento' AND idinterfacce='$device' AND data BETWEEN '$datainizioquery' and '$datafinequery' GROUP BY idfirewall";
|
||||
$txt_sotto = "Dalle ore ".date ("H",$inizio).":00 del ".date ("d.m.Y",$inizio)." alle ore ".date ("H",$fine).":00 del ".date ("d.m.Y",$fine);
|
||||
$barre = array();
|
||||
break;
|
||||
|
||||
case "giorno":
|
||||
$query = "SELECT idfirewall, UNIX_TIMESTAMP(data) AS time, max AS picco, media, traffico AS dati FROM dati_giorno WHERE ((iddefrule='$riferimento' and idinterfacce='$device') and (data BETWEEN DATE('$datainizio') and DATE('$datafine'))) order by data";
|
||||
$query_max = "SELECT firewall.nome, MAX(dati_giorno.max) AS massimo, AVG(dati_giorno.max) AS media, STDDEV(dati_giorno.max) AS deviazione, SUM(dati_giorno.traffico) AS traffico FROM dati_giorno JOIN firewall ON firewall.id=dati_giorno.idfirewall WHERE iddefrule='$riferimento' AND idinterfacce='$device' AND data BETWEEN '$datainizioquery' AND '$datafinequery' GROUP BY idfirewall";
|
||||
$txt_sotto = "Dal giorno ".date ("d.m.Y",$inizio)." al giorno ".date ("d.m.Y",$fine);
|
||||
$barre = array();
|
||||
break;
|
||||
|
||||
case "settimana":
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$testo_leg = "";
|
||||
$res_max = mysql_query( $query_max );
|
||||
while ($dati_max = mysql_fetch_array($res_max)) {
|
||||
$testo_leg .= "(".$dati_max['nome'].") Picco: ".fsize ($dati_max['massimo'])."/s Media: ".fsize($dati_max['media'])."/s Traffico Totale: ".fsize($dati_max['traffico']*1024)."\n";
|
||||
}
|
||||
|
||||
$res = mysql_query( $query );
|
||||
$xdata = array(array());
|
||||
$ydata = array(array());
|
||||
$tag = array(array());
|
||||
$alt = array(array());
|
||||
$cambiogiorno = array();
|
||||
|
||||
while ( list ($fw, $tempo, $picco, $media, $dati) = mysql_fetch_array($res)) {
|
||||
switch ($dettaglio) {
|
||||
case "minuto":
|
||||
inslabel ($tempo, $fw, $data_dif);
|
||||
$ydata[$fw][] = $picco / 1024;
|
||||
$mediadata[$fw][] = $media / 1024;
|
||||
break;
|
||||
case "ora":
|
||||
inslabel ($tempo, $fw, $data_dif);
|
||||
$ydata[$fw][] = $picco / 1024;
|
||||
$tag[$fw][] = " ";
|
||||
$alt[$fw][] = "Picco: ".fsize($picco)."/s\nMedia: ".fsize($media)."/s\nTraffico: ".fsize($dati*1024);
|
||||
break;
|
||||
case "giorno":
|
||||
$xdata[$fw][] = date ("d.m.Y",$tempo);
|
||||
$ydata[$fw][] = $picco / 1024;
|
||||
$tag[$fw][] = " ";
|
||||
$alt[$fw][] = "Picco: ".fsize($picco)."/s\nMedia: ".fsize($media)."/s\nTraffico: ".fsize($dati*1024);
|
||||
break;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Create the graph
|
||||
$g = new Graph($l,$h);
|
||||
$g->SetMargin(60,20,50,80);
|
||||
$g->title->SetFont(FF_VERDANA);
|
||||
$g->title->Set("Traffico regola \"$servizio\"");
|
||||
$g->subtitle->Set("$testo_leg Banda garantita: ".fsize ($garantiti * 1024)."/s - Banda massima: ".fsize($limite * 1024)."/s\n$txt_sotto");
|
||||
$g->SetShadow();
|
||||
$g->SetScale('textlin');
|
||||
|
||||
$g->xaxis->SetLabelAngle(90);
|
||||
$g->yaxis->title->SetFont(FF_VERDANA);
|
||||
$g->yaxis->SetLabelFormatCallback('udm');
|
||||
|
||||
$query = "SELECT id, nome, colore FROM firewall WHERE id > 0";
|
||||
$res = mysql_query( $query );
|
||||
while ( list ($fwid, $fwnome, $fwcolore) = mysql_fetch_array($res)) {
|
||||
|
||||
switch ($dettaglio) {
|
||||
case "minuto":
|
||||
$$fwnome = new LinePlot($ydata[$fwid]);
|
||||
$g->Add($$fwnome);
|
||||
$g->xaxis->SetTickLabels($xdata[$fwid]);
|
||||
$$fwnome->SetColor($fwcolore);
|
||||
$$fwnome->SetLegend ($fwnome);
|
||||
break;
|
||||
case "ora":
|
||||
case "giorno":
|
||||
$$fwnome = new BarPlot($ydata[$fwid]);
|
||||
$g->xaxis->SetTickLabels($xdata[$fwid]);
|
||||
$$fwnome->SetCSIMTargets($tag[$fwid],$alt[$fwid]);
|
||||
$barre[] = $$fwnome;
|
||||
break;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
if ($dettaglio == "ora" || $dettaglio == "giorno") {
|
||||
$gbarre = new GroupBarPlot ($barre);
|
||||
$g->Add($gbarre);
|
||||
|
||||
$res = mysql_query( $query );
|
||||
while ( list ($fwid, $fwnome, $fwcolore) = mysql_fetch_array($res)) {
|
||||
$color1 = sprintf ("%s1",$fwcolore);
|
||||
$color2 = sprintf ("%s4",$fwcolore);
|
||||
$$fwnome->SetFillGradient($color1,$color2,GRAD_VERT);
|
||||
$$fwnome->SetFillColor($fwcolore);
|
||||
$$fwnome->SetColor($fwcolore);
|
||||
$$fwnome->SetLegend ($fwnome);
|
||||
}
|
||||
}
|
||||
|
||||
if ($limite == $garantiti) {
|
||||
$spessore = 2;
|
||||
} else {
|
||||
$spessore = 1;
|
||||
}
|
||||
|
||||
# Inserisco linea di Massimo
|
||||
if (($massimo / 1024 ) > $limite) {
|
||||
$llim = new PlotLine (HORIZONTAL,$limite, "red",$spessore);
|
||||
$g->Add($llim);
|
||||
}
|
||||
|
||||
# Inserisco linea di Garantito
|
||||
if (($massimo / 1024) > $garantiti) {
|
||||
$lgar = new PlotLine (HORIZONTAL,$garantiti, "green",1);
|
||||
$g->Add($lgar);
|
||||
}
|
||||
|
||||
# Inserisco linea di Media
|
||||
$lmedia = new PlotLine (HORIZONTAL,$med/1024, "yellow",1);
|
||||
$g->Add($lmedia);
|
||||
|
||||
# Inserisco cambi di giorno
|
||||
for ($i = 0; $i<count($cambiogiorno); $i++) {
|
||||
$dayline = new PlotLine(VERTICAL,$cambiogiorno[$i],"black",2);
|
||||
$g->AddLine($dayline);
|
||||
}
|
||||
|
||||
$g->legend->Pos( 0.02,0.02,"right" ,"top");
|
||||
$g->legend->SetColumns(1);
|
||||
$g->legend->SetFrameWeight(2);
|
||||
$g->legend->SetShadow();
|
||||
|
||||
$g->StrokeCSIM('graph.php','giorni');
|
||||
|
||||
function inslabel ($tempo, $fw, $data_dif) {
|
||||
global $xdata, $cambiogiorno;
|
||||
|
||||
if ($data_dif <= 1) {
|
||||
if (date("H:i",$tempo) == "00:00") {
|
||||
$xdata[$fw][] = date ("d.m H:i",$tempo);
|
||||
if (!array_search(count($xdata[$fw]), $cambiogiorno)) {
|
||||
$cambiogiorno[] = count($xdata[$fw]);
|
||||
}
|
||||
} else if (date("i",$tempo) == "00") {
|
||||
$xdata[$fw][] = date ("H:i",$tempo);
|
||||
} else {
|
||||
$xdata[$fw][] = "";
|
||||
}
|
||||
} else if ($data_dif <= 12) {
|
||||
if (date("H:i",$tempo) == "00:00") {
|
||||
$xdata[$fw][] = date ("d.m H:i",$tempo);
|
||||
if (!array_search(count($xdata[$fw]), $cambiogiorno)) {
|
||||
$cambiogiorno[] = count($xdata[$fw]);
|
||||
}
|
||||
} else if ((date("i",$tempo) == "00") && ( ( date("H",$tempo)%(floor(24/floor(24/$data_dif))) ) == 0 )) {
|
||||
$xdata[$fw][] = date ("H:i",$tempo);
|
||||
} else {
|
||||
$xdata[$fw][] = "";
|
||||
}
|
||||
} else {
|
||||
if (date("H:i",$tempo) == "00:00") {
|
||||
$xdata[$fw][] = date ("d.m H:i",$tempo);
|
||||
} else {
|
||||
$xdata[$fw][] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function udm ($valore) {
|
||||
if ($valore)
|
||||
return fsize ($valore*1024);
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
?>
|
||||
10
mainuser.php
@@ -45,7 +45,7 @@ livelli ($UTENTE['id']);
|
||||
?>
|
||||
|
||||
</table>
|
||||
<img src="img/spazio.gif" width="1" height="20" alt="">
|
||||
<img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="20" alt="">
|
||||
<?php include_once ("footer.php"); ?>
|
||||
|
||||
<?php
|
||||
@@ -58,16 +58,16 @@ function livelli ($utente) {
|
||||
<tr>
|
||||
<td width="8" align="center" nowrap>
|
||||
<?php if ($dato['attivo']) { ?>
|
||||
<img border=0 src="img/attivo.gif" ALT="Regola attiva" TITLE="Regola attiva"></a>
|
||||
<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="img/non_attivo.gif" ALT="Regola non attiva" TITLE="Regola non attiva"></a>
|
||||
<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="img/spazio.gif"></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="img/spazio.gif"></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) { ?>
|
||||
|
||||
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 883 B After Width: | Height: | Size: 883 B |
|
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 768 B After Width: | Height: | Size: 768 B |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 365 B |
|
Before Width: | Height: | Size: 752 B After Width: | Height: | Size: 752 B |
|
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 390 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 403 B |
|
Before Width: | Height: | Size: 609 B After Width: | Height: | Size: 609 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
|
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
|
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
|
Before Width: | Height: | Size: 898 B After Width: | Height: | Size: 898 B |
|
Before Width: | Height: | Size: 956 B After Width: | Height: | Size: 956 B |
|
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
|
Before Width: | Height: | Size: 49 B After Width: | Height: | Size: 49 B |
|
Before Width: | Height: | Size: 890 B After Width: | Height: | Size: 890 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 176 B |
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
include_once ("core/config.php");
|
||||
include_once ("../core/config.php");
|
||||
$UTENTE = login();
|
||||
isadmin();
|
||||
?>
|
||||
<body>
|
||||
<link rel="stylesheet" type="text/css" href="stile.css" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php print $CONF['base_url'] ?>/css/stile.css" />
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr><td class="spaziov" colspan=3><img src="img/spazio.gif"></td></tr>
|
||||
<tr><td class="spaziov" colspan=3><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
<?php
|
||||
|
||||
$idutente = $_GET['idutente'];
|
||||
@@ -29,10 +29,10 @@ while ($dato = mysql_fetch_array ( $res )) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="campo" width="230">Data: <?php print $dato['quando']?></td>
|
||||
<td class="spazioh"><img src="img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="campo"><?php print substr($dato['cosa'],0,90) ?></td>
|
||||
</tr>
|
||||
<tr><td class="spaziov" colspan=3><img src="img/spazio.gif"></td></tr>
|
||||
<tr><td class="spaziov" colspan=3><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
@@ -19,11 +19,11 @@ function PopupG(apri)
|
||||
</script>
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||
<tr>
|
||||
<td class="spaziov" colspan=4><img src="../img/spazio.gif"></td>
|
||||
<td><a href="modutenti.php"><img src="../img/addusers.png" border="0" ALT="Aggiungi utente" TITLE="Aggiungi utente"></a></td>
|
||||
<td class="spaziov" colspan=9><img src="../img/spazio.gif"></td>
|
||||
<td class="spaziov" colspan=4><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td><a href="modutenti.php"><img src="<?php print $CONF['base_url'] ?>/img/addusers.png" border="0" ALT="Aggiungi utente" TITLE="Aggiungi utente"></a></td>
|
||||
<td class="spaziov" colspan=9><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
</tr>
|
||||
<tr><td class="spaziov" colspan=14><img src="../img/spazio.gif"></td></tr>
|
||||
<tr><td class="spaziov" colspan=14><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
<?php
|
||||
$query = "SELECT id, utente, admin, creazione, modifica, ultimo, attivo FROM utenti ORDER BY utente";
|
||||
$res = mysql_query( $query, $DB_ID );
|
||||
@@ -37,50 +37,50 @@ while ($dato = mysql_fetch_array ( $res )) {
|
||||
<tr>
|
||||
<td rowspan=2 class="col3btn">
|
||||
<?php if ($dato['attivo']) { ?>
|
||||
<img border=0 src="../img/attivo.gif" ALT="Utente attivo" TITLE="Utente 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="../img/non_attivo.gif" ALT="Utente non attivo" TITLE="Utente non attivo">
|
||||
<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="modutenti.php?id=<?php print $dato['id']?>"><img src="../img/modify.gif" width="20" height="20" border="0" ALT="Proprieta'" TITLE="Proprieta'"></a></td>
|
||||
<td rowspan=2 class="col3btn"><a href="modutenti.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>
|
||||
<?php if ($dato['admin']) { ?>
|
||||
<td rowspan=2 class="col3btn"><img border=0 src="../img/admin.png" ALT="Admin" TITLE="Admin"></td>
|
||||
<td rowspan=2 class="col3btn"><img border=0 src="<?php print $CONF['base_url'] ?>/img/admin.png" ALT="Admin" TITLE="Admin"></td>
|
||||
<?php } else { ?>
|
||||
<td rowspan=2 class="col3btn"><img border=0 src="../img/utente.png" ALT="Utente" TITLE="Utente"></td>
|
||||
<td rowspan=2 class="col3btn"><img border=0 src="<?php print $CONF['base_url'] ?>/img/utente.png" ALT="Utente" TITLE="Utente"></td>
|
||||
<?php } ?>
|
||||
<td rowspan=2 class="spazioh"><img src="../img/spazio.gif"></td>
|
||||
<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="col3campo2">Utente</td>
|
||||
<td class="spazioh"><img src="../img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="col3valore2">Creazione</td>
|
||||
<td class="spazioh"><img src="../img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="col3valore2">Ultima Modifica</td>
|
||||
<td class="spazioh"><img src="../img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="col3valore2">Ultimo accesso</td>
|
||||
<td class="spazioh"><img src="../img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="col3valore2">Numero accessi</td>
|
||||
<td rowspan=2 class="col3btn">
|
||||
<a href="permessiutenti.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('logutenti.php?idutente=<?php print $dato['id'] ?>')"><img border="0" src="../img/iconSystemLog.gif" ALT="Grafico Utilizzo" TITLE="Grafico Utilizzo"></a>
|
||||
<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['utente'] ?></td>
|
||||
<td class="spazioh"><img src="../img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="descrizione"><?php print $dato['creazione'] ?></td>
|
||||
<td class="spazioh"><img src="../img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="descrizione"><?php print $dato['modifica'] ?></td>
|
||||
<td class="spazioh"><img src="../img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="descrizione"><?php print $dato['ultimo'] ?></td>
|
||||
<td class="spazioh"><img src="../img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="descrizione"><?php print $records ?></td>
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
<tr><td class="spaziov" colspan=14><img src="../img/spazio.gif"></td></tr>
|
||||
<tr><td class="spaziov" colspan=14><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
|
||||
<?php
|
||||
} ?>
|
||||
</table>
|
||||
<img src="../img/spazio.gif" width="1" height="20" alt="">
|
||||
<img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" height="20" alt="">
|
||||
<?php include_once ("../core/footer.php"); ?>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
include_once ("core/config.php");
|
||||
include_once ("../core/config.php");
|
||||
$UTENTE = login();
|
||||
isadmin();
|
||||
?>
|
||||
<body>
|
||||
<link rel="stylesheet" type="text/css" href="stile.css" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php print $CONF['base_url'] ?>/css/stile.css" />
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
||||
<tr><td class="spaziov" colspan=9><img src="img/spazio.gif"></td></tr>
|
||||
<tr><td class="spaziov" colspan=9><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
<?php
|
||||
|
||||
$idutente = $_GET['idutente'];
|
||||
@@ -32,16 +32,16 @@ while ($dato = mysql_fetch_array ( $res )) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="campo">Indirizzo IP: <?php print $dato['ip']?></td>
|
||||
<td class="spazioh"><img src="img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="campo">Accesso: <?php print $dato['inizio']?></td>
|
||||
<td class="spazioh"><img src="img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="campo">Uscita: <?php print $dato['termine']?></td>
|
||||
<td class="spazioh"><img src="img/spazio.gif"></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td class="campo">Numero pagine: <?php print $dato['quanti']?></td>
|
||||
<td class="spazioh"><img src="img/spazio.gif"></td>
|
||||
<td rowspan=2 class="col3btn"><a href="dettlogutenti.php?ses=<?php print $dato['sessione']?>&idutente=<?php print $idutente ?>"><img src="img/dettagli.png" width="20" height="20" border="0" ALT="Dettaglio sessione" TITLE="Dettaglio sessione"></a></td>
|
||||
<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
|
||||
<td rowspan=2 class="col3btn"><a href="dettlogutenti.php?ses=<?php print $dato['sessione']?>&idutente=<?php print $idutente ?>"><img src="<?php print $CONF['base_url'] ?>/img/dettagli.png" width="20" height="20" border="0" ALT="Dettaglio sessione" TITLE="Dettaglio sessione"></a></td>
|
||||
</tr>
|
||||
<tr><td class="spaziov" colspan=9><img src="img/spazio.gif"></td></tr>
|
||||
<tr><td class="spaziov" colspan=9><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td></tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
206
utenti/modutenti.php
Executable file
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
include_once ("../core/config.php");
|
||||
$UTENTE = login();
|
||||
//isadmin();
|
||||
?>
|
||||
<?php include_once ("../core/top.php"); ?>
|
||||
|
||||
<?php
|
||||
if (isset($_GET['id'])) {
|
||||
$bottone = "Modifica";
|
||||
$modifica = 1;
|
||||
$query = "SELECT * FROM utenti WHERE id =".$_GET['id'];
|
||||
$res = mysql_query( $query, $DB_ID );
|
||||
$dato = mysql_fetch_array ( $res );
|
||||
$dato['password'] = "ahg5t!frtb5@u&^!";
|
||||
} else if (isset ($_POST['id'])) {
|
||||
$modifica = 2;
|
||||
$id = $_POST['id'];
|
||||
$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 ($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 )) { ?>
|
||||
<?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 = 'utenti.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">
|
||||
$(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 as text for IE
|
||||
label.html(" ").addClass("checked");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<form action="modutenti.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="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
|
||||
<td class="label"><label id="lusername" for="username">Nome Utente</label></td>
|
||||
<td class="field"><input id="utente" name="utente" type="text" value="<?php print $dato['utente']?>" 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><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="30" height="1" alt=""></td>
|
||||
<td class="label"><label id="lmail" for="mail">Indirizzo E-Mail</label></td>
|
||||
<td class="field"><input id="mail" name="mail" type="text" value="<?php print $dato['mail']?>" 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><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="80" height="1" alt=""></td>
|
||||
<td>Attivo <input name="attivo" type="checkbox" value=1 <?php if ($dato['attivo']) { print "checked=\"checked\""; } ?>></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="20" height="1" alt=""></td>
|
||||
<td>Admin <input name="admin" type="checkbox" value=1 <?php if ($dato['admin']) { print "checked=\"checked\""; } ?>></td>
|
||||
<td colspan="4"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="250" height="1" alt=""></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 class="col1" colspan="9">
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="40" height="50" alt=""></td>
|
||||
<td class="label"><label id="lpassword" for="password">Password</label></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="10" height="1" alt=""></td>
|
||||
<td class="field" width="30"><input id="password1" name="password1" type="password" size="30" maxlength="32" value="<?php print $dato['password'] ?>" /></td>
|
||||
<td class="status" width="400">
|
||||
<div class="password-meter">
|
||||
<div class="password-meter-message"> </div>
|
||||
<div class="password-meter-bg">
|
||||
<div class="password-meter-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="40" height="50" alt=""></td>
|
||||
<td class="label"><label id="lpassword_confirm" for="password_confirm">Password</label></td>
|
||||
<td><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="10" height="1" alt=""></td>
|
||||
<td class="field" width="30"><input id="password2" name="password2" type="password" size="30" maxlength="32" value="<?php print $dato['password'] ?>" /></td>
|
||||
<td class="status" width="400"></td>
|
||||
</tr>
|
||||
<tr><td colspan="9" class="spaziov"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif" width="1" alt=""></td></tr>
|
||||
</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 ?>">
|
||||
|
||||
<input type="button" value="Annulla" onclick="location.href = 'utenti.php';"></button>
|
||||
</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 include_once ("footer.php"); ?>
|
||||