Files
librenms-librenms/html/includes/graphs/macaccounting/auth.inc.php
T

44 lines
1.3 KiB
PHP
Raw Normal View History

<?php
if (is_numeric($id))
{
2011-05-13 12:49:23 +00:00
$acc = dbFetchRow("SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = ? AND I.interface_id = M.interface_id AND I.device_id = D.device_id", array($id));
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-06-01 09:54:05 +00:00
2011-09-20 14:37:54 +00:00
if ($auth || port_permitted($acc['interface_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");
$port = get_port_by_id($acc['interface_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");
}
} else {
graph_error("entry not found");
}
2011-05-26 15:00:54 +00:00
} else {
graph_error("invalid id");
}
?>