IP Reg is a IPAM tool to keep track of assets, nodes (IP addresses, MAC addresses, DNS aliases) within different subnets, over different locations or even VLAN's. Written in PHP, used with a MySQL-database to have a unique insight in your local network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
ipreg/assetclassedit.php

78 lines
2.1 KiB

<?php
include("header.php");
// display only if admin
if($_SESSION['suser_level'] >= 2) {
// check for submit
if ($_SERVER['REQUEST_METHOD']=="POST" ) {
$assetclass_id = $_POST['assetclass_id'];
$assetclass_name = $_POST['assetclass_name'];
$assetclassgroup_id = $_POST['assetclassgroup_id'];
mysql_query("UPDATE assetclass SET assetclass_name='$assetclass_name', assetclassgroup_id='$assetclassgroup_id' WHERE assetclass_id='$assetclass_id'") or die(mysql_error());
header_location("assetclassview.php?assetclass_id=" . $assetclass_id);
}
$assetclass_id = $_GET['assetclass_id'];
// get current information
$result = mysql_query("SELECT assetclass_name, assetclassgroup_id FROM assetclass WHERE assetclass_id='$assetclass_id'");
while ($row = mysql_fetch_object($result)) {
$assetclass_name = $row->assetclass_name;
$assetclassgroup_id = $row->assetclassgroup_id;
}
?>
<form method="POST" action="assetclassedit.php">
<input type="hidden" name="assetclass_id" value="<?php echo $assetclass_id; ?>">
<table border="0">
<tr>
<td colspan="2">
<b>Edit assetclass:</b><br>
</td>
</tr>
<tr>
<td>
Assetclass name:
</td>
<td>
<input type="text" name="assetclass_name" value="<?php echo $assetclass_name; ?>">
</td>
</tr>
<tr>
<td>
Assetclass Group:<br>
</td>
<td>
<select name="assetclassgroup_id">
<?php
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name FROM assetclassgroup ORDER BY assetclassgroup_id");
while ($row = mysql_fetch_object($result)) {
if ($row->assetclassgroup_id==$assetclassgroup_id) {
$selected = "selected";
} else {
$selected = "";
}
echo '<option value="' . $row->assetclassgroup_id . '" ' . $selected . '>' . $row->assetclassgroup_name. '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" value="Submit"><input type="reset" value="Reset">
</td>
</tr>
</table>
</form>
<?php
// end display only if admin
}
include("footer.php");
?>