<?php include 'config/db.php'; include 'views/rackspace/networking/networking_functions.php'; $port_number = mysqli_real_escape_string($conn, $_GET['port_number']); $device_id = mysqli_real_escape_string($conn, $_GET['device_id']); $sql = "SELECT * FROM `devices` WHERE `device_id`='{$device_id}'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $device_label = $row["device_label"]; $device_location = $row["rackid"]; } $port_name = port_name($port_number, $device_id); $port_label = port_label($port_number, $device_id); } ?> <div class="modal-dialog" style="min-width:1200px;"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title"> <img src="assets/img/arrow_switch.png"> Viewing Port <?php echo $port_number; ?> on <?php echo $device_label; ?> </h4> </div> <div class="modal-body">
<?php include 'graph_functions.php'; include 'libraries/general.php'; $librenms_api_endpoint = lirenms_api_endpoint(); $librenms_api_key = librenms_api_key(); $device_name = get_device_label_from_id($_GET['device_id']); $port_name = port_name($_GET['port_number']); $url = $librenms_api_endpoint . "" . $device_name . "/ports/" . $port_name . "/port_bits"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, '3'); curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Auth-Token: {$librenms_api_key}")); $content = trim(curl_exec($ch)); curl_close($ch); header("Content-Type: image/png"); print $content;