<option value="Cisco">Cisco</option> <option value="Mikrotik/RouterBoard">Mikrotik/RouterBoard</option> <option value="HP">HP</option> <option value="Dell">Dell</option> </select> <label>Device Location</label> <?php include 'config/db.php'; $sql = "SELECT * FROM `rackspace`"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo "<select class='form-control' name='device_location'>"; // output data of each row while ($row = $result->fetch_assoc()) { $rackid = $row["rackid"]; echo "<option value='{$rackid}'>" . get_rack_name($rackid) . "</option>"; } } else { echo "0 results"; } ?> </select> <label>Device Label</label> <input type="text" class="form-control" name="device_label"> <label>Device Serial</label> <input type="text" class="form-control" name="device_serial"> <label>Device Port Count</label> <input type="number" min="1" step="1" class="form-control" name="device_port_count"><br> </form> </div> <div class="modal-footer">
$device_label = $_POST['device_label']; $device_serial = $_POST['device_serial']; $device_capacity = $_POST['device_capacity']; $device_mac = $_POST['device_mac']; $device_ram_total = $_POST['device_ram_total']; $device_cpu_count = $_POST['device_cpu_count']; $device_power_usage = $_POST['device_power_usage']; $device_power_feed1 = $_POST['device_power_feed1']; $device_power_feed2 = $_POST['device_power_feed2']; $device_cpu = $_POST['device_cpu']; $device_rack_position = $_POST['device_rack_position']; $device_size = $_POST['device_size']; $device_notes = $_POST['device_notes']; $device_dop = $_POST['device_dop']; $device_warranty = $_POST['device_warranty']; if (empty($device_size)) { $device_size = 0; } $sql = "INSERT INTO `dcimstack`.`devices`\n(`device_id`, `rackid`, `device_type`, `device_label`, `device_brand`, `device_serial`, `device_mac`, `device_ram_total`, `device_capacity`, `device_cpu_count`, `device_power_usage`, `device_power_feed1`, `device_power_feed2`, `device_cpu`, `device_rack_position`, `device_size`, `device_warranty`,`device_dop`,`device_notes`)\nVALUES\n(NULL,\n\t'{$device_location}',\n\t'{$device_type}',\n\t'{$device_label}',\n\t'{$device_brand}',\n\t'{$device_serial}',\n\t'{$device_mac}',\n\t'{$device_ram_total}',\n\t'{$device_capacity}',\n\t'{$device_cpu_count}',\n\t'{$device_power_usage}',\n\t'{$device_power_feed1}',\n\t'{$device_power_feed2}',\n\t'{$device_cpu}',\n\t'{$device_rack_position}',\n\t'{$device_size}',\n\t'{$device_dop}',\n\t'{$device_warranty}',\n\t'{$device_notes}');"; if ($conn->query($sql) === TRUE) { $rack_name = get_rack_name($device_location); //echo "New record created successfully"; $event_type = "New {$device_type} added"; $event_message = "A new {$device_type} was added to {$rack_name}"; $event_status = "Complete"; add_event($event_type, $event_message, $event_status); $conn->close(); header("Location: {$page_referrer}"); } else { echo "Error: " . $sql . "<br>" . $conn->error; }
$rack_size_used = $row["rack_size_used"] . "U"; $rack_city = $row["rack_city"]; $rack_country = $row["rack_country"]; } } ?> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title"> <i class="fa fa-plug"></i> Manage power feed - <?php echo power_feed_name($feedid); ?> - <?php echo get_rack_name($rackid); ?> </h4> </div> <div class="modal-body"> <?php if (rack_feed_count($rackid) != 0) { ?> <form method="post" id="add_feed_form" action="manage_feeds_db.php" class="form-horizontal"> <input type="hidden" name="feedid" value='<?php echo $feedid; ?> '> <input type="hidden" name="rackid" value='<?php echo $rackid; ?>
if ($result->num_rows > 0) { // output data of each row echo "<table class='table' id='search_table'>"; echo "<thead>"; echo "<tr>"; echo "<th>Location</th>"; echo "<th>Vendor</th>"; echo "<th>Physical Label</th>"; echo "<th>Customer</th>"; echo "<th>IP Address</th>"; echo "<th>MAC Address</th>"; echo "<th><center>Manage</center></th>"; echo "</tr>"; echo "</thead>"; while ($row = $result->fetch_assoc()) { $device_id = $row["device_id"]; echo "<tr>"; echo "<td>" . get_rack_name($row['rackid']) . "</td>"; echo "<td>" . $row["device_brand"] . "</td>"; echo "<td>" . $row["device_label"] . "</td>"; echo "<td>" . get_customer_name_from_id($row["device_customer"]) . "</td>"; echo "<td>" . $row["device_ipaddress"] . "</td>"; echo "<td>" . $row["device_mac"] . "</td>"; echo "<td><center><a href='manage_server.php?device_id={$device_id}'>Manage</a></center></td>"; echo "</tr>"; } echo "</table>"; } else { echo "0 results"; } $conn->close();
<meta name="viewport" content="width=device-width, initial-scale=1"> <title>DCIMStack</title> <?php include 'libraries/css.php'; ?> </head> <body> <?php include 'libraries/header.php'; ?> <div class="container"> <h1 class="page-header">Manage Rackspace (<?php echo get_rack_name($_GET['rackid']); ?> )</h1> <?php include 'libraries/alerts.php'; ?> <div class="row"> <div class="col-md-4"> <?php echo "<center><h2>" . rackspace_available_rack($rackid) . "U</h2></center>"; echo "<center><h4>Rackspace available</h4></center>"; echo "<center><span class='text-muted'>Individual U's of rackspace not in-use</span></center>"; ?> </div> <div class="col-md-4"> <?php
$_SESSION['error'] = "Error, RackID missing."; header('Location: rackspace.php?rackid=' . $rackid); } if (empty($feed_type)) { $_SESSION['error'] = "Error, Feed Type not set."; header('Location: rackspace.php?rackid=' . $rackid); } if (empty($feed_voltage)) { $_SESSION['error'] = "Error, Feed Voltage not set."; header('Location: rackspace.php?rackid=' . $rackid); } if (empty($feed_power)) { $_SESSION['error'] = "Error, Feed Power not set."; header('Location: rackspace.php?rackid=' . $rackid); } if (isset($rackid, $feed_type, $feed_voltage, $feed_power)) { $sql = "INSERT INTO `power_feeds` (`rackid`, `feed_id`, `feed_type`, `feed_power`, `feed_voltage`) \n\t\t\tVALUES ('{$rackid}', NULL, '{$feed_type}', '{$feed_power}', '{$feed_voltage}');"; if ($conn->query($sql) === TRUE) { $rack_name = get_rack_name($rackid); $event_type = "Power Feed Added"; $event_message = "A power feed was added to {$rack_name}"; $event_status = "Complete"; add_event($event_type, $event_message, $event_status); $_SESSION['success'] = "Success, Power feed {$feed_type} added."; header('Location: rackspace.php?rackid=' . $rackid); } else { $_SESSION['error'] = "Error, Power feed {$feed_type} not added."; header('Location: rackspace.php?rackid=' . $rackid); } $conn->close(); }