= 2) { // check for submit if ($_SERVER['REQUEST_METHOD']=="POST" ) { $ip = str_replace(' ', '', $_POST['ip']); // IP in use? $result = mysql_query("SELECT * FROM node WHERE ip='$ip'"); if (mysql_num_rows($result)!=0) { echo 'IP in use!'; exit; } else { $asset_name = $_POST['asset_name']; $hostname = $_POST['hostname']; $assetclass_id = $_POST['assetclass_id']; mysql_query("INSERT INTO asset (asset_name, hostname, assetclass_id) VALUE ('$asset_name', '$hostname', '$assetclass_id')") or die(mysql_error()); // get asset_id for new node $asset_id = mysql_insert_id(); $mac = strip_mac($_POST['mac']); // DNS1 if (!empty($_POST['dns1']) && isset($_POST['dns1suffix'])) { $dns1 = $_POST['dns1'] . $config_dns1suffix; } else { $dns1 = $_POST['dns1']; } // DNS2 if (!empty($_POST['dns2']) && isset($_POST['dns2suffix'])) { $dns2 = $_POST['dns2'] . $config_dns2suffix; } else { $dns2 = $_POST['dns2']; } $subnet_id = $_POST['subnet_id']; mysql_query("INSERT INTO node (ip, mac, dns1, dns2, subnet_id, asset_id) VALUE ('$ip', '$mac', '$dns1', '$dns2', '$subnet_id', '$asset_id')") or die(mysql_error()); $node_id = mysql_insert_id(); header_location("assetview.php?asset_id=" . $asset_id); } } // check for ip if (isset($_GET['ip'])) { $ip = $_GET['ip']; } else { $ip = ""; } // check for subnet_id if (isset($_GET['subnet_id'])) { $subnet_id = $_GET['subnet_id']; } else { $subnet_id = ''; } ?>
Add new node:
Asset name: *
Hostname:  
IP Address: *
Subnet:
*
Asset class: *
MAC Address:  
DNS name:
DNS alias: