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/vlanedit.php

72 lines
1.7 KiB

<?php
include("header.php");
// display only if admin
if($_SESSION['suser_level'] >= 2) {
// check for submit
if ($_SERVER['REQUEST_METHOD']=="POST" ) {
$vlan_id = $_POST['vlan_id'];
$vlan_name = $_POST['vlan_name'];
$vlan_number = $_POST['vlan_number'];
$vlan_info = $_POST['vlan_info'];
mysql_query("UPDATE vlan SET vlan_name='$vlan_name', vlan_number='$vlan_number', vlan_info='$vlan_info' WHERE vlan_id='$vlan_id'") or die(mysql_error());
header_location("vlanview.php?vlan_id=" . $vlan_id);
}
// get current information
$result = mysql_query("SELECT vlan_name, vlan_number, vlan_info FROM vlan WHERE vlan_id='$vlan_id'");
while ($row = mysql_fetch_object($result)) {
$vlan_name = $row->vlan_name;
$vlan_number = $row->vlan_number;
$vlan_info = $row->vlan_info;
}
?>
<form method="POST" action="vlanedit.php">
<input type="hidden" name="vlan_id" value="<?php echo $vlan_id; ?>">
<table border="0">
<tr>
<td colspan="2">
<b>Edit VLAN:</b><br>
</td>
</tr>
<tr>
<td>
VLAN name:
</td>
<td>
<input type="text" name="vlan_name" value="<?php echo $vlan_name; ?>">
</td>
</tr>
<tr>
<td>
VLAN ID:
</td>
<td>
<input type="text" name="vlan_number" size="3" value="<?php echo $vlan_number; ?>">
</td>
</tr>
<tr>
<td>
VLAN info:
</td>
<td>
<textarea name="vlan_info"><?php echo $vlan_info; ?></textarea>
</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");
?>