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

80 lines
1.8 KiB

<?php
include("header.php");
// display only if admin
if($_SESSION['suser_level'] >= 2) {
// check for submit
if ($_SERVER['REQUEST_METHOD']=="POST" ) {
$asset_name = $_POST['asset_name'];
$hostname = $_POST['hostname'];
$assetclass_id = $_POST['assetclass_id'];
$asset_info = $_POST['asset_info'];
mysql_query("INSERT INTO asset (asset_name, hostname, assetclass_id, asset_info) VALUE ('$asset_name', '$hostname', '$assetclass_id', '$asset_info')") or die(mysql_error());
$asset_id = mysql_insert_id();
header_location("assetview.php?asset_id=" . $asset_id);
}
?>
<form method="POST" action="assetadd.php">
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
<table border="0">
<tr>
<td colspan="2">
<b>Add asset:</b><br>
</td>
</tr>
<tr>
<td>
Asset name:
</td>
<td>
<input type="text" name="asset_name">
</td>
</tr>
<tr>
<td>
Hostname:
</td>
<td>
<input type="text" name="hostname">
</td>
</tr>
<tr>
<td>
Asset class:
</td>
<td>
<select name="assetclass_id">
<?php
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name");
while ($row = mysql_fetch_object($result)) {
echo '<option value="' . $row->assetclass_id . '">' . $row->assetclass_name . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>
Asset info:
</td>
<td>
<textarea name="asset_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");
?>