99 lines
3.3 KiB
PHP
Executable File
99 lines
3.3 KiB
PHP
Executable File
<?php
|
|
include_once ("php/config.php");
|
|
$UTENTE = login();
|
|
isadmin();
|
|
?>
|
|
|
|
<?php include_once ("top.php");
|
|
$querypermessi = "SELECT iddefrule FROM utenti2defrule WHERE idutente = ".$_GET['id'];
|
|
$res = mysql_query( $querypermessi, $DB_ID );
|
|
$permessiutente = array();
|
|
while ($dato = mysql_fetch_array ( $res )) { $permessiutente[] = $dato['iddefrule']; }
|
|
?>
|
|
|
|
<script type="text/javascript" src="jquery/jquery-1.8.0.min.js"></script>
|
|
<script type="text/javascript">
|
|
$(function(){
|
|
$(".checkrule").click(function(){
|
|
var stato = $(this).is(':checked');
|
|
var id = $(this).val();
|
|
$.post("updatepermessi.php", {
|
|
stato: stato,
|
|
iddefrule: id,
|
|
idutente: <?php print $_GET['id'] ?>
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
|
<tr>
|
|
<td width="5%"><img src="img/spazio.gif"></td>
|
|
<td>
|
|
<select name='device' onchange="window.location.href='?id=<?php print $_GET['id']?>&interfaccia='+this.options[this.selectedIndex].value;">
|
|
<option name='device' value='' >Selezionare interfaccia</option>
|
|
<?php
|
|
$query = "SELECT id, device FROM interfacce";
|
|
$res = mysql_query( $query, $DB_ID );
|
|
while ($dato = mysql_fetch_array ( $res )) { ?>
|
|
<option name='device' value='<?php print $dato['id']?>' <?php if ($_GET['interfaccia'] == $dato['id']) { print "selected"; } ?>><?php print $dato['device'] ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
</td>
|
|
<td><img src="img/spazio.gif"></td>
|
|
</tr>
|
|
<tr><td class="spaziov" colspan=5><img src="img/spazio.gif"></td></tr>
|
|
|
|
<table cellpadding="0" cellspacing="0" border="0" width="90%">
|
|
<?php
|
|
livelli ($_GET['interfaccia'], 0, 0, 10);
|
|
?>
|
|
|
|
</table>
|
|
<img src="img/spazio.gif" width="1" height="20" alt="">
|
|
<?php include_once ("footer.php"); ?>
|
|
|
|
<?php
|
|
function livelli ($device, $parent, $livello, $maxliv) {
|
|
global $DB_ID, $permessiutente;
|
|
$query = "SELECT * FROM defrule WHERE stato <> 3 AND idparent = '$parent' AND idinterfacce = $device ORDER BY priorita";
|
|
$res = mysql_query( $query, $DB_ID );
|
|
while ($dato = mysql_fetch_array ( $res )) {
|
|
$queryint = "SELECT count(id) AS figli FROM defrule WHERE stato<>3 AND idparent = ".$dato['id'];
|
|
$queryrule = "SELECT COUNT(id) AS numrule FROM rule WHERE iddefrule = ".$dato['id'];
|
|
$resint = mysql_query( $queryint, $DB_ID );
|
|
$resrule = mysql_query( $queryrule, $DB_ID );
|
|
$datofigli = mysql_fetch_array ( $resint );
|
|
$datorule = mysql_fetch_array ( $resrule );
|
|
$numfigli = $datofigli['figli'];
|
|
$numrule = $datorule['numrule'];
|
|
?>
|
|
<tr>
|
|
<td class="spazioh" nowrap>
|
|
<?php if ($dato['attivo']) { ?>
|
|
<img border=0 src="img/attivo.gif" ALT="Disattiva regola" TITLE="Disattiva regola"></a>
|
|
<?php } else { ?>
|
|
<img border=0 src="img/non_attivo.gif" ALT="Attiva regola" TITLE="Attiva regola"></a>
|
|
<?php } ?>
|
|
</td>
|
|
<td class="defrulenome" nowrap>
|
|
<?php for ($i=0; $i<$livello; $i++) { ?>
|
|
<img border=0 src="img/spaziocol.gif">
|
|
|
|
<?php } ?>
|
|
<?php printf ("%s",creanome($dato['id'])) ?>
|
|
</td>
|
|
<td class="spazioh"><img src="img/spazio.gif"></td>
|
|
<td class="defruletxt" nowrap><?php print $dato['descrizione'] ?></td>
|
|
|
|
<td class="spazioh">
|
|
<input class="checkrule" type="checkbox" value=<?php print $dato['id']?> <?php if (in_array($dato['id'], $permessiutente)) { print "checked=\"checked\""; } ?>>
|
|
</td>
|
|
|
|
</tr>
|
|
<?php livelli ($device, $dato['id'], $livello+1, 10);
|
|
}
|
|
|
|
}
|
|
?>
|