#!/usr/bin/php <?php include "includes/defaults.inc.php"; include "config.php"; include "includes/functions.php"; # Remove a host and all related data from the system if ($argv[1]) { $host = strtolower($argv[1]); $id = getidbyname($host); if ($id) { delHost($id); echo "Removed {$host}\n"; } else { echo "Host doesn't exist!\n"; } } else { echo "Host Removal Tool\nUsage: ./delhost.php <hostname>\n"; }
* (at your option) any later version. * * MMC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require "modules/network/includes/network.inc.php"; if (isset($_POST["bconfirm"])) { $subnet = $_POST["subnet"]; $host = $_POST["host"]; delHost($subnet, $host); $result = _T("The host has been deleted."); if (isset($_POST["updatedns"]) & isset($_POST["zone"])) { delRecord($_POST["zone"], $host); $result .= " " . _T("The DNS record has been deleted."); } if (!isXMLRPCError()) { new NotifyWidgetSuccess($result); } header("Location: main.php?module=network&submod=network&action=subnetmembers&subnet={$subnet}"); exit; } else { $subnet = urldecode($_GET["subnet"]); $host = urldecode($_GET["host"]); $askupdatedns = False; $domain = "";
<?php if ($_SESSION['userlevel'] < 10) { echo "<span class='alert'>You are not permitted to perform this function</span>"; exit; } if ($_POST['id']) { delHost(mres($_POST['id'])); } elseif (mres($_GET['id'])) { delHost(mres($_GET['id'])); } ?> <form name="form1" method="post" action="?page=delhost"> <h1>Delete Host</h1> <br /> <p><select name="id"> <?php $query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`"); while ($data = mysql_fetch_array($query)) { echo "<option value='" . $data['device_id'] . "'>" . $data['hostname'] . "</option>"; } ?> </select> <input type="submit" class="submit" name="Submit" value="Delete Host"> </p> </form>