Pulizia vecchio sistema

This commit is contained in:
cmaffio
2015-10-08 17:32:59 +02:00
parent dd934cb895
commit a158016e78
19 changed files with 169 additions and 935 deletions

View File

@@ -1,7 +1,7 @@
<?php
include_once ("core/config.php");
include_once ("config.php");
$UTENTE = login();
isadmin();
//isadmin();
?>
<?php include_once ("top.php"); ?>
@@ -21,6 +21,7 @@ if (isset($_GET['id'])) {
$password2 = $_POST['password2'];
$admin = $_POST['admin'];
$attivo = $_POST['attivo'];
$mail = $_POST['mail'];
if (!$admin) $admin = 0;
@@ -34,15 +35,15 @@ if (isset($_GET['id'])) {
if ($id > 0) {
$testo = "L'utente e' stato correttamente modificato";
$query = "UPDATE utenti SET $querypwd admin = $admin, attivo=$attivo, modifica = NOW() WHERE `id`=$id";
$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()";
$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="img/spazio.gif" width="1" height="10" alt=""><td>
<td><img src="../img/spazio.gif" width="1" height="10" alt=""><td>
</tr>
<tr>
<td>
@@ -55,13 +56,13 @@ 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="../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="img/spazio.gif" width="1" height="10" alt=""></td>
<td><img src="../img/spazio.gif" width="1" height="10" alt=""></td>
</tr>
</table>
<?php
@@ -74,10 +75,10 @@ Non e' stato possibile eseguire l'operazione richiesta a causa di un errore: <?p
<?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="../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">
$(document).ready(function()
@@ -88,6 +89,11 @@ $(document).ready(function()
required: true,
minlength: 4
},
mail: {
required: true,
email: true,
minlength: 4
},
password1: {
password: "#utente",
minlength: 0
@@ -101,6 +107,9 @@ $(document).ready(function()
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"
}
@@ -132,27 +141,34 @@ $(document).ready(function()
<input type="hidden" name="id" value="-1">
<?php } ?>
<tr>
<td><img src="img/spazio.gif" width="30" height="1" alt=""></td>
<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 class="status" colspan="6"></td>
</tr>
<tr><td colspan="9"><img src="img/spazio.gif" width="1" height="5" alt=""></td></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><td colspan="9"><img src="../img/spazio.gif" width="1" height="5" alt=""></td></tr>
<tr>
<td><img src="../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 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 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="../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="../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">
@@ -164,25 +180,25 @@ $(document).ready(function()
</td>
</tr>
<tr>
<td><img src="img/spazio.gif" width="40" height="50" alt=""></td>
<td><img src="../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="../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="../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="../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 = 'utenti.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="../img/spazio.gif" width="1" height="10" alt=""></td></tr>
</table>
</form>
<?php } ?>

View File

@@ -1,22 +1,22 @@
<?php
include_once ("core/config.php");
include_once ("config.php");
$UTENTE = login();
isadmin();
?>
<?php include_once ("top.php"); ?>
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="../img/spazio.gif"></td></tr>
<tr>
<td width="50"><img src="img/spazio.gif"></td>
<td width="50"><img src="../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="../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="../img/spazio.gif"></td>
<td width="350" class="campo">Nota</td>
<td><img src="img/spazio.gif"></td>
<td><img src="../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="../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="../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="../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="../img/spazio.gif"></td>
<td width="350" class="valoretxt"><?php print $dato['Commento']?></td>
<td><img src="img/spazio.gif"></td>
<td><img src="../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="../img/spazio.gif"></td></tr>
<?php }
} ?>
</table>

View File

@@ -1,6 +1,4 @@
<?php
$aggiornamento = "02.03.2012";
$versione = "0.2";
$db_data_server = "127.0.0.1";
$db_data_name = "pannello_vbc";

View File

@@ -69,7 +69,6 @@ function login () {
$fUsername = $_POST['fUsername'];
$fPassword = $_POST['fPassword'];
if(db_login ($fUsername, $fPassword)) {
print "-- ".$_POST['fUsername']." - ".$_POST['fPassword']." --<br>";
$_SESSION = array();
$_SESSION['passwd'] = $fPassword;
$_SESSION['username'] = $fUsername;

18
core/main.php Executable file
View File

@@ -0,0 +1,18 @@
<?php
include_once ("config.php");
$UTENTE = login();
isadmin();
?>
<?php include_once ("top.php"); ?>
<META HTTP-EQUIV="Refresh" CONTENT="30" URL="main.php">
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<tr><td class="spaziov" colspan="9"><img src="../img/spazio.gif"></td></tr>
</table>
<img src="img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("footer.php"); ?>

View File

@@ -4,7 +4,7 @@
<title>SpazioFirewall</title>
</head>
<body>
<link rel="stylesheet" type="text/css" href="stile.css" />
<link rel="stylesheet" type="text/css" href="../css/stile.css" />
<table cellpadding="0" cellspacing="0" border="0" align="center" width="1000">
<?php if ($_SESSION['auth']) { ?>
<tr><td>
@@ -22,29 +22,21 @@
</td></tr>
<?php
$icone = array (
"img/OK.png",
"img/disconnesso.gif",
"img/errore.png",
);
if ($UTENTE['admin']) {
$menu = array( array("Home", "main.php"),
array("Configurazione", "conf.php"),
array("Gestione device", "device.php"),
array("Gestione cluster", "cluster.php"),
array("Gestione utenti", "utenti.php"),
array("Cambio password", "chkpasswd.php"),
);
} else {
$menu = array( array("Monitoraggio banda", "mainuser.php"),
array("Cambio password", "usermodutenti.php"),
$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 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">
@@ -55,20 +47,17 @@ if ($self == $menu[$i][1]) {
$classe = "menu";
}
?>
<td class="spaziol"><img src="img/spazio.gif"></td>
<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>
<td class="spaziol"><img src="../img/spazio.gif"></td>
</tr>
</table>
<?php } else {?>
<tr bgcolor="#FFC350"><td>&nbsp;</td></tr>
<?php } ?>
</td></tr>
<tr><td class="spaziov" colspan=2><img src="img/spazio.gif"></td></tr>
<tr><td class="spaziov" colspan=2><img src="../img/spazio.gif"></td></tr>
<tr><td align="center">

View File

@@ -1,11 +1,6 @@
<?php
include_once ("core/config.php");
$UTENTE=login();
if ($UTENTE['admin']) {
header("Location: main.php");
} else {
header("Location: mainuser.php");
}
header("Location: core/main.php");
?>

217
main.php
View File

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

View File

@@ -1,3 +0,0 @@
Order deny,allow
Deny from all

View File

@@ -1,21 +0,0 @@
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$fUsername = escape_string ($_POST['fUsername']);
$fPassword = escape_string ($_POST['fPassword']);
if(autentica($_POST['fUsername'], $_POST['fPassword'])) {
session_start();
$_SESSION['sessid']['passwd'] = $fPassword;
$_SESSION['sessid']['username'] = $fUsername;
}
else {
$error = 1;
$tMessage = '<span class="error_msg">Errore</span>';
$tUsername = $fUsername;
include ("userlogin.php");
exit;
}
}
?>

View File

@@ -1,13 +0,0 @@
<?php
$aggiornamento = "02.03.2012";
$versione = "0.2";
$db_data_server = "db.mi.esseweb.intra";
$db_data_name = "sw_traffico";
$db_data_user = "sw_firewall";
$db_data_pwd = "3QsZSXAG4RnA2XQW";
require_once ("function.php");
$DB_ID = db_data_connect ();
carica_conf();
?>

View File

@@ -1,330 +0,0 @@
<?php
function escape_string ($string)
{
if(is_array($string)) {
$clean = array();
foreach(array_keys($string) as $row) {
$clean[$row] = escape_string($string[$row]);
}
return $clean;
}
if (get_magic_quotes_gpc ())
{
$string = stripslashes($string);
}
if (!is_numeric($string))
{
$link = db_auth_connect();
$escaped_string = mysql_real_escape_string($string, $link);
}
else
{
$escaped_string = $string;
}
return $escaped_string;
}
function pop3_login($host,$user,$pass,$port=110,$folder="INBOX",$ssl=false)
{
$ssl=($ssl==false)?"/novalidate-cert":"";
$ritorno = (imap_open("{"."$host:$port/pop3$ssl"."}$folder",$user,$pass));
return $ritorno;
}
function db_login($user,$pass) {
global $DB_ID;
$query = "SELECT id FROM utenti WHERE utente ='$user' AND password = MD5('$pass') AND attivo = 1";
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
$ritorno = $dato['id'];
return $ritorno;
}
function db_data_connect () {
global $db_data_server, $db_data_user, $db_data_pwd, $db_data_name;
$db_data_id = mysql_connect($db_data_server, $db_data_user, $db_data_pwd);
mysql_select_db($db_data_name, $db_data_id);
return $db_data_id;
}
function login () {
global $_SESSION, $_POST, $POP3_Server, $DB_ID, $CONF;
session_name("FirewallSW");
session_start();
if ($_SESSION['auth'] && ($_SESSION['time']+$CONF['temposessione']*60 >= time())) {
if(!db_login ($_SESSION['username'], $_SESSION['passwd'])) {
$tMessage = '<span class="error_msg">Dati di autenticazione errati</span>';
$tUsername = $_SESSION['username'];
$_SESSION['auth'] = 0;
session_destroy();
include ("userlogin.php");
exit;
} else {
logga ($_SERVER['REQUEST_URI']);
$_SESSION['time'] = time();
return carica_utente ();
}
} else {
if ($_POST['fUsername']) {
$fUsername = $_POST['fUsername'];
$fPassword = $_POST['fPassword'];
if(db_login ($fUsername, $fPassword)) {
$_SESSION = array();
$_SESSION['passwd'] = $fPassword;
$_SESSION['username'] = $fUsername;
$_SESSION['auth'] = 1;
$_SESSION['time'] = time();
session_regenerate_id(TRUE);
logga ("Accesso");
return carica_utente ();
} else {
$tMessage = 'Errore';
$tUsername = $fUsername;
include ("userlogin.php");
exit;
}
} else {
if ($_SESSION['auth'] && ($_SESSION['time']+$CONF['temposessione']*60 < time())) {
$tMessage = '<span class="error_msg">Sessione scaduta</span>';
$tUsername = $_SESSION['username'];
logga ("Sessione scaduta");
include ("userlogin.php");
exit;
} else {
include ("userlogin.php");
exit;
}
}
}
}
function carica_conf () {
global $CONF, $DB_ID;
$query = "SELECT variabile, valore FROM conf";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ( $res )) {
$CONF[$dato[0]] = $dato[1];
}
}
function isadmin () {
global $UTENTE;
if ($UTENTE['admin']) {
return;
} else {
header("location: main.php");
exit;
}
}
function carica_utente () {
global $_SESSION, $CONF, $DB_ID;
$query = "SELECT * FROM utenti where utente = '".$_SESSION['username']."'";
$res = mysql_query( $query, $DB_ID );
$dati = mysql_fetch_array ( $res );
return $dati;
}
function is_first_access () {
global $_SESSION, $DB_ID, $CONF;
$utente = $_SESSION['username'];
$query = "SELECT * FROM utenti WHERE utente = '$utente'";
$res = mysql_query( $query, $DB_ID );
if (!mysql_fetch_array( $res )) {
$query = "INSERT INTO utenti SET utente='$utente', max_perm='".$CONF['permanenti']."', max_temp='".$CONF['temporanei']."', creato=now(), max_tempo='".$CONF['tempo_temporanei']."', totale=".$CONF['totale'].", idtemplate=".$CONF['template_base'];
mysql_query( $query, $DB_ID );
logga ("Creazione nuova utenza");
mkdir ($CONF['storage'].'/'.$utente);
logga ("Creazione storage utente");
}
}
function logga ($testo, $dest="") {
global $_SESSION, $DB_ID, $CONF;
if ($dest == "") {
$destinatario = $_SESSION['username'];
} else {
$destinatario = $dest;
}
$ip = @$_SERVER["REMOTE_ADDR"];
$sessione = session_id();;
// 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 --";
$res = mysql_query( $query, $DB_ID );
$res = mysql_query( $queryuser, $DB_ID );
}
function logga_allegati ($id, $cosa) {
global $DB_ID, $CONF;
$ip = $_SERVER["REMOTE_ADDR"];
$query = "INSERT INTO accesso_allegati SET idallegato=$id, quando=now(), cosa='$cosa', ip='$ip'";
$res = mysql_query( $query, $DB_ID );
}
function ultimo_coll () {
global $_SESSION, $DB_ID, $CONF;
$query = "SELECT DATE_FORMAT(quando, '%d-%m-%Y %H:%i:%s') as quando FROM accessi_utenti WHERE utente = '".$_SESSION['username']."' AND cosa = 'Uscita' order by quando desc limit 1";
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
if (is_null($dato['quando'])) {
return "Primo accesso";
} else {
return $dato['quando'];
}
}
function codice(){
global $DB_ID;
$N_Caratteri = 30;
$Stringa = "";
For($I=0;$I<$N_Caratteri;$I++){
do{
$N = Ceil(rand(48,122));
}while(!((($N >= 48) && ($N <= 57)) || (($N >= 65) && ($N <= 90)) || (($N >= 97) && ($N <= 122))));
$Stringa = $Stringa.Chr ($N);
}
$query = "SELECT * FROM allegati WHERE codice='$Stringa' AND vecchio=0";
$res = mysql_query( $query, $DB_ID );
if (mysql_fetch_array ( $res )) { $stringa = codice(); }
return $Stringa;
}
function invia_mail ($oggetto, $testo, $dest="") {
global $UTENTE, $CONF;
$headers = 'From: noreply@esseweb.eu' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if ($dest == "") {
$destinatario = $UTENTE['utente'];
} else {
$destinatario = $dest;
}
mail($destinatario, $oggetto, $testo, $headers);
}
function fsize ($stat) {
$stat = (float)$stat;
$idx = 0;
$arr = array("B","kB","MB","GB","TB","PB","EB","ZB","YB");
while(floor($stat/1024)>0){
$stat = round($stat/1024,2);
$idx++;
}
return $stat." ".$arr[$idx];
}
function creanome ($idparent) {
global $DB_ID;
$query = "SELECT interfacce.device, defrule.idparent, defrule.priorita FROM defrule JOIN interfacce ON defrule.idinterfacce = interfacce.id WHERE defrule.id = '$idparent'";
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
if ($dato['idparent'] == 0) {
$ritorno = $dato['device']."-2:".$dato['priorita'];
return $ritorno;
} else {
$ritorno = creanome($dato['idparent']).":".$dato['priorita'];
return $ritorno;
}
}
function defrule_att ($id) {
global $DB_ID;
$query = "UPDATE defrule SET attivo=1, stato=2 WHERE id = $id";
if (mysql_query( $query, $DB_ID )) {
azioni ("defrule", $id, 1);
$query = "SELECT idparent FROM defrule WHERE id = $id";
$res = mysql_query( $query, $DB_ID );
$dato = mysql_fetch_array ( $res );
$parent = $dato['idparent'];
if ($parent) {
$ritorno = defrule_att($parent);
} else {
$ritorno = 1;
}
} else {
return mysql_error();
}
return $ritorno;
}
function defrule_dis ($id, $stato=2) {
global $DB_ID;
$ritorno = 1;
$query = "UPDATE defrule SET attivo=0, stato=$stato WHERE id = $id";
if (mysql_query( $query, $DB_ID )) {
azioni ("defrule", $id, 3);
if ($stato == 3) {
$query_rule = "DELETE FROM rule WHERE iddefrule = $id";
mysql_query( $query_rule, $DB_ID );
}
$query = "SELECT id FROM defrule WHERE idparent = $id AND stato <> 3";
if ($res = mysql_query( $query, $DB_ID )) {
while ($dato = mysql_fetch_array ($res)) {
$ritorno = defrule_dis ($dato['id'], $stato);
}
} else {
return mysql_error();
}
} else {
return mysql_error();
}
return $ritorno;
}
function defrule_reset ($iddevice, $idparent, $fw) {
global $DB_ID;
$query = "SELECT id FROM defrule WHERE idinterfacce = $iddevice AND idparent = $idparent AND attivo = 1 AND stato <> 3";
$res = mysql_query( $query, $DB_ID );
while ($dato = mysql_fetch_array ($res)) {
$id_defrule = $dato['id'];
$query_azioni = "INSERT INTO azioni SET fw=$fw, tabella='defrule', idtabella=$id_defrule, stato=1, datains=NOW()";
mysql_query( $query_azioni, $DB_ID );
defrule_reset ($iddevice, $id_defrule, $fw);
}
}
function maxrate ($idrule, $idparent, $device) {
global $DB_ID;
if ($idparent == 0) {
$querylim = "SELECT rate, ceil FROM interfacce WHERE id = $device";
} else {
$querylim = "SELECT rate, ceil FROM defrule WHERE id = $idparent";
}
$queryatt = "SELECT SUM(rate) AS somma FROM defrule WHERE idinterfacce = $device AND attivo = 1 AND stato <> 3 AND id <> $idrule AND idparent = $idparent";
$querypri = "SELECT MAX(priorita) AS pri FROM defrule WHERE idinterfacce = $device AND stato <> 3 AND id <> $idrule AND idparent = $idparent AND priorita < 1000";
$reslim = mysql_query( $querylim, $DB_ID );
$datolim = mysql_fetch_array ($reslim);
$resatt = mysql_query( $queryatt, $DB_ID );
$datoatt = mysql_fetch_array ($resatt);
$respri = mysql_query( $querypri, $DB_ID );
$datopri = mysql_fetch_array ($respri);
$ritorno['rate'] = $datolim['rate'] - $datoatt['somma'];
$ritorno['ceil'] = $datolim['ceil'];
$ritorno['pri'] = $datopri['pri'] + 10;
return $ritorno;
}
function azioni ($tabella, $idtabella, $stato) {
global $DB_ID;
$query_fw = "SELECT id FROM firewall WHERE attivo = 1";
$res_fw = mysql_query( $query_fw, $DB_ID );
while ($dato_fw = mysql_fetch_array ($res_fw)) {
$id_fw = $dato_fw['id'];
$query_new = "INSERT INTO azioni SET fw = $id_fw, tabella = '$tabella', idtabella = $idtabella, stato = $stato, datains = NOW()";
// print "$query_new<br>";
mysql_query( $query_new, $DB_ID );
}
}
?>

View File

@@ -1,14 +0,0 @@
<?php
include_once ("config.php");
$query = "SELECT * FROM allegati WHERE scadenza < now() AND vecchio=0 AND permanente=0 UNION SELECT allegati.* FROM allegati JOIN accesso_allegati ON allegati.id = accesso_allegati.idallegato WHERE allegati.vecchio=0 AND allegati.autocancella=1 AND accesso_allegati.quando < subtime(now(),'12:0:0.0')";
$res = mysql_query( $query, $DB_ID );
while ($dato = @mysql_fetch_array ( $res )) {
print "Rimosso file ".$dato['nomefile']." di proprieta' dell'utente ".$dato['utente']."\n";
unlink ($dato['storage']);
$query = "UPDATE allegati SET vecchio=1, scadenza=now() WHERE id=".$dato['id'];
$res = mysql_query( $query, $DB_ID );
invia_mail ("Eliminazione allegato ".$dato['nomefile'], "In data ".date("Y-m-d H:i:s")." e' stato eliminato il file ".$dato['nomefile'], $dato['utente']);
logga ("Eliminato allegato ".$dato['codice']." per scadenza", $dato['utente']);
}
?>

View File

@@ -1,23 +0,0 @@
<?php include_once ("top.php"); ?>
<form name="login" method="post">
<table cellpadding="0" cellspacing="10" border="0" id="login_table">
<tr align="center" valign="middle">
<td colspan="2"><h4><?php print "Benvenuto" ?></h4></td>
</tr>
<tr>
<td><?php print "Indirizzo E-Mail:"; ?></td>
<td><input type="text" name="fUsername" value="<?php print $tUsername; ?>" /></td>
</tr>
<tr>
<td><?php print "Password:"; ?></td>
<td><input type="password" name="fPassword" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" value="<?php print "Accedi"; ?>" /></td>
</tr>
<tr>
<td colspan="2" align="center"<?php print $tMessage; ?></td>
</tr>
</table>
</form>
<?php include_once ("footer.php"); ?>

View File

@@ -1,160 +0,0 @@
<?php
include_once ("core/config.php");
$UTENTE = login();
?>
<?php include_once ("top.php"); ?>
<?php
if (isset ($_POST['id'])) {
$modifica = 2;
$id = $_POST['id'];
$password1 = $_POST['password1'];
$password2 = $_POST['password2'];
if (($password1 != "ahg5t!frtb5@u&^!") && ($password1 == $password2)) {
$querypwd = "password = MD5('$password1'),";
} else {
$querypwd = "";
}
$testo = "L'utente e' stato correttamente modificato";
$query = "UPDATE utenti SET $querypwd modifica = NOW() 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>
</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="img/spazio.gif" width="1" height="5" alt=""></td>
</tr>
<tr>
<td><input type="button" value="Ok" onclick="location.href = 'mainuser.php';"></button></td>
</tr>
<tr>
<td><img src="img/spazio.gif" width="1" height="10" alt=""></td>
</tr>
</table>
<?php
} else {
$idutente = $UTENTE['id'];
$bottone = "Modifica";
$modifica = 1;
$query = "SELECT * FROM utenti WHERE id = $idutente";
$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">
$(document).ready(function()
{
$("#modulo").validate( {
rules: {
password1: {
password: "#utente",
minlength: 0
},
password2: {
equalTo: "#password1"
}
},
messages: {
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="usermodutenti.php" method="post" id="modulo">
<table cellpadding="0" cellspacing="0" border="0" width="90%">
<input type="hidden" name="id" value="<?php print $dato['id'] ?>">
<tr>
<td><img src="img/spazio.gif" width="50" height="1" alt=""></td>
<td width="100">Nome Utente</td>
<td width="150"><b><?php print $dato['utente']?></b></td>
<td><img src="img/spazio.gif" width="200" height="1" alt=""></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="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 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">&nbsp;</div>
<div class="password-meter-bg">
<div class="password-meter-bar"></div>
</div>
</div>
</td>
</tr>
<tr>
<td><img src="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 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>
</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 = 'mainuser.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,86 +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=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>
</tr>
<tr><td class="spaziov" colspan=14><img src="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 );
while ($dato = mysql_fetch_array ( $res )) {
$query = "SELECT sessione FROM accessi_utenti WHERE utente = '".$dato['utente']."' GROUP BY sessione";
$resutente = mysql_query( $query, $DB_ID );
$records = mysql_num_rows($resutente);
?>
<tr>
<td rowspan=2 class="col3btn">
<?php if ($dato['attivo']) { ?>
<img border=0 src="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">
<?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>
<?php if ($dato['admin']) { ?>
<td rowspan=2 class="col3btn"><img border=0 src="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>
<?php } ?>
<td rowspan=2 class="spazioh"><img src="img/spazio.gif"></td>
<td class="col3campo2">Utente</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="col3valore2">Creazione</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="col3valore2">Ultima Modifica</td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="col3valore2">Ultimo accesso</td>
<td class="spazioh"><img src="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>
</td>
</tr>
<tr>
<td class="descrizione"><?php print $dato['utente'] ?></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="descrizione"><?php print $dato['creazione'] ?></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="descrizione"><?php print $dato['modifica'] ?></td>
<td class="spazioh"><img src="img/spazio.gif"></td>
<td class="descrizione"><?php print $dato['ultimo'] ?></td>
<td class="spazioh"><img src="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>
<?php
} ?>
</table>
<img src="img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("footer.php"); ?>

86
utenti/index.php Executable file
View File

@@ -0,0 +1,86 @@
<?php
include_once ("../core/config.php");
$UTENTE = login();
isadmin();
?>
<?php include_once ("../core/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=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>
</tr>
<tr><td class="spaziov" colspan=14><img src="../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 );
while ($dato = mysql_fetch_array ( $res )) {
$query = "SELECT sessione FROM accessi_utenti WHERE utente = '".$dato['utente']."' GROUP BY sessione";
$resutente = mysql_query( $query, $DB_ID );
$records = mysql_num_rows($resutente);
?>
<tr>
<td rowspan=2 class="col3btn">
<?php if ($dato['attivo']) { ?>
<img border=0 src="../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">
<?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>
<?php if ($dato['admin']) { ?>
<td rowspan=2 class="col3btn"><img border=0 src="../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>
<?php } ?>
<td rowspan=2 class="spazioh"><img src="../img/spazio.gif"></td>
<td class="col3campo2">Utente</td>
<td class="spazioh"><img src="../img/spazio.gif"></td>
<td class="col3valore2">Creazione</td>
<td class="spazioh"><img src="../img/spazio.gif"></td>
<td class="col3valore2">Ultima Modifica</td>
<td class="spazioh"><img src="../img/spazio.gif"></td>
<td class="col3valore2">Ultimo accesso</td>
<td class="spazioh"><img src="../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>
</td>
</tr>
<tr>
<td class="descrizione"><?php print $dato['utente'] ?></td>
<td class="spazioh"><img src="../img/spazio.gif"></td>
<td class="descrizione"><?php print $dato['creazione'] ?></td>
<td class="spazioh"><img src="../img/spazio.gif"></td>
<td class="descrizione"><?php print $dato['modifica'] ?></td>
<td class="spazioh"><img src="../img/spazio.gif"></td>
<td class="descrizione"><?php print $dato['ultimo'] ?></td>
<td class="spazioh"><img src="../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>
<?php
} ?>
</table>
<img src="../img/spazio.gif" width="1" height="20" alt="">
<?php include_once ("../core/footer.php"); ?>