function print_ports($physical_label, $port_count, $device_id) { $port_number = 1; echo "<h4>{$physical_label}</h4>"; echo "<hr>"; for ($i = 0; $i < 4; $i++) { echo "<div class='row'>"; for ($j = 0; $j < $port_count; $j++) { echo "<div class='col-md-2'>"; if (port_status($port_number, $device_id) == 0) { echo "<div class='panel panel-warning' data-toggle='tooltip' data-placement='top' title='Click for Graph'>"; } else { echo "<div class='panel panel-success' data-toggle='tooltip' data-placement='top' title='Click for Graph'>"; } $port_label = port_label($port_number, $device_id); echo "<div class='panel-heading' href='view_port.php?port_number={$port_number}&device_id={$device_id}' data-remote='false' data-toggle='ajaxModal'>\n\t\t\t\t <h3 class='panel-title' ><center>{$port_label}<br> {$port_number}</center></h3>\n\t\t\t\t </div>\n\t\t\t\t <div class='panel-body'>"; echo "<center>"; //echo "<img src='assets/img/arrow_up.png'> 5 MB/s"; //echo "<img src='assets/img/arrow_down.png'> 4 MB/s"; echo "</center>"; echo "</div>\n\t\t\t\t</div>"; echo "</div>"; $port_number++; } echo "</div>"; } }
<?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">