<?php
include_once ("../core/config.php");
$UTENTE = login();
$DIRITTI = diritti('Utente');
view_top();
?>
<meta http-equiv="refresh" content="10">
<?php
$query = "	SELECT 
			GREATEST (max(inviati), max(ricevuti)) AS max 
		FROM 
			proxy_speed
";

$res = mysql_query( $query, $DB_ID );
$valori = mysql_fetch_array ( $res );
$max = $valori['max'];

$query = "	SELECT 
			proxy_speed.ip, 
			proxy_speed.ricevuti,
 			proxy_speed.inviati, 
			proxy_pool.attivo,
			proxy_pool.id,
			proxy_pool.nome
		FROM 
			proxy_speed 
		JOIN 
			proxy_pool 
			ON 
				proxy_speed.ip = proxy_pool.ip 
		ORDER BY 
			ricevuti desc , 
			inviati desc
";

$res = mysql_query( $query, $DB_ID );

$tabella = new html (0,"90%", array (3,3,2,20,2,8,2,10,2,0));
while ($dato = mysql_fetch_array ( $res )) {
?>
	<tr>
<?php
	if ($dato['attivo']) {
?>
		<td rowspan=2 class="col3btn"><a href="proxy_gest.php?azione=pool_rem&id=<?php print $dato['ip']?>"><img src="<?php print $CONF['base_url'] ?>/img/non_attivo.gif" ALT="Utente limitato" TITLE="Utente limitato"></a></td>
<?php	} else { ?>
		<td rowspan=2 class="col3btn"><a href="proxy_gest.php?azione=pool_ins&id=<?php print $dato['ip']?>"><img src="<?php print $CONF['base_url'] ?>/img/attivo.gif" ALT="Utente non limitato" TITLE="Utente non limitato"></a></td>
<?php	} ?>
		<td rowspan=2 class="col3btn"><a href="pool_ip.php?id=<?php print $dato['id'] ?>"><img src="<?php print $CONF['base_url'] ?>/img/modify.gif" ALT="Dettaglio" TITLE="Dettaglio"></a></td>
		<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td <?php if ($dato['nome'] == "") print "rowspan=2" ?> class="colip"><?php print $dato['ip'] ?></td>
		<td rowspan=2 class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="descrizione">Inviati</td>
		<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="colspeed"><?php print byteConvert($dato['inviati']) ?> </td>
		<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="colimg"><img border="0" src="barra.php?max=<?php print $max ?>&val=<?php print $dato['inviati'] ?>&col=red"></td>
	</tr>
	<tr>
<?php
		if ($dato['nome'] != "") { ?>
		<td class="colip"><?php print $dato['nome'] ?></td>
<?php		} ?>
		<td class="descrizione">Ricevuti</td>
		<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="colspeed"><?php print byteConvert($dato['ricevuti']) ?></td>
		<td class="spazioh"><img src="<?php print $CONF['base_url'] ?>/img/spazio.gif"></td>
		<td class="colimg"><img border="0" src="barra.php?max=<?php print $max ?>&val=<?php print $dato['ricevuti'] ?>&col=blue"></td>

	</tr>
<?php
$tabella->riga();
} 
$tabella->close();
view_footer(); 
?>
