2011-04-29 16:49:37 +00:00
< ? php
2012-05-11 13:26:14 +00:00
if ( is_numeric ( $vars [ 'id' ]))
2011-04-29 16:49:37 +00:00
{
2012-05-16 13:25:50 +00:00
$acc = dbFetchRow ( " SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = ? AND I.port_id = M.port_id AND I.device_id = D.device_id " , array ( $vars [ 'id' ]));
2011-04-29 16:49:37 +00:00
2011-09-20 14:37:54 +00:00
if ( $debug ) {
2011-06-01 09:54:05 +00:00
echo ( " <pre> " );
print_r ( $acc );
echo ( " </pre> " );
}
2011-06-01 09:52:03 +00:00
2011-05-26 14:47:49 +00:00
if ( is_array ( $acc ))
2011-04-29 16:49:37 +00:00
{
2011-06-01 09:54:05 +00:00
2012-05-16 13:25:50 +00:00
if ( $auth || port_permitted ( $acc [ 'port_id' ]))
2011-05-26 14:47:49 +00:00
{
2011-09-20 14:37:54 +00:00
if ( $debug ) { echo ( $config [ 'rrd_dir' ] . " / " . $acc [ 'hostname' ] . " / " . safename ( " cip- " . $acc [ 'ifIndex' ] . " - " . $acc [ 'mac' ] . " .rrd " )); }
2011-06-01 09:54:05 +00:00
2011-09-20 14:37:54 +00:00
if ( is_file ( $config [ 'rrd_dir' ] . " / " . $acc [ 'hostname' ] . " / " . safename ( " cip- " . $acc [ 'ifIndex' ] . " - " . $acc [ 'mac' ] . " .rrd " )))
2011-05-26 15:00:54 +00:00
{
2011-09-20 14:37:54 +00:00
if ( $debug ) { echo ( " exists " ); }
2011-09-20 09:55:11 +00:00
$rrd_filename = $config [ 'rrd_dir' ] . " / " . $acc [ 'hostname' ] . " / " . safename ( " cip- " . $acc [ 'ifIndex' ] . " - " . $acc [ 'mac' ] . " .rrd " );
2012-05-16 13:25:50 +00:00
$port = get_port_by_id ( $acc [ 'port_id' ]);
2011-05-26 14:47:49 +00:00
$device = device_by_id_cache ( $port [ 'device_id' ]);
$title = generate_device_link ( $device );
$title .= " :: Port " . generate_port_link ( $port );
$title .= " :: " . formatMac ( $acc [ 'mac' ]);
$auth = TRUE ;
2011-05-26 15:00:54 +00:00
} else {
2011-06-01 10:04:11 +00:00
graph_error ( " file not found " );
2011-05-26 14:47:49 +00:00
}
} else {
2011-06-01 10:04:11 +00:00
graph_error ( " unauthenticated " );
2011-05-20 16:05:29 +00:00
}
} else {
2011-06-01 10:05:36 +00:00
graph_error ( " entry not found " );
2011-04-29 16:49:37 +00:00
}
2011-05-26 15:00:54 +00:00
} else {
2011-06-01 10:05:36 +00:00
graph_error ( " invalid id " );
2011-04-29 16:49:37 +00:00
}
?>