Files

39 lines
1.2 KiB
PHP
Raw Permalink Normal View History

<?php
if (is_numeric($vars['id'])) {
2020-09-21 15:40:17 +02: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', [$vars['id']]);
if ($debug) {
echo '<pre>';
print_r($acc);
echo '</pre>';
}
2011-06-01 09:52:03 +00:00
if (is_array($acc)) {
if ($auth || port_permitted($acc['port_id'])) {
2020-09-21 15:40:17 +02:00
$filename = rrd_name($acc['hostname'], ['cip', $acc['ifIndex'], $acc['mac']]);
d_echo($filename);
2011-06-01 09:54:05 +00:00
if (is_file($filename)) {
d_echo('exists');
2011-06-01 09:54:05 +00:00
$rrd_filename = $filename;
2020-09-21 15:40:17 +02:00
$port = cleanPort(get_port_by_id($acc['port_id']));
$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;
2016-08-18 20:28:22 -05:00
} else {
graph_error('file not found');
}
2016-08-18 20:28:22 -05:00
} else {
graph_error('unauthenticated');
}
2016-08-18 20:28:22 -05:00
} else {
graph_error('entry not found');
}
2016-08-18 20:28:22 -05:00
} else {
graph_error('invalid id');
}