fixing things, adding better security

git-svn-id: http://www.observium.org/svn/observer/trunk@351 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-03-11 14:50:24 +00:00
parent 98b5917f27
commit b7c9a6eb11
9 changed files with 57 additions and 14 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/php
### Purge deleted interfaces from the database
<?
include("config.php");
include("includes/functions.php");
$query = mysql_query("SELECT * FROM interfaces AS I, devices as D WHERE I.device_id = D.device_id AND I.deleted = '1'");
while($interface = mysql_fetch_array($query)) {
mysql_query("DELETE from interfaces where interface_id = '" . $interface['interface_id'] . "'");
mysql_query("DELETE from `adjacencies` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
mysql_query("DELETE from `links` WHERE `src_if` = '" . $interface['interface_id'] . "'");
mysql_query("DELETE from `links` WHERE `dst_if` = '" . $interface['interface_id'] . "'");
mysql_query("DELETE from `ipaddr` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
echo("Removed interface " . $interface['ifDescr'] . " from " . $interface['hostname'] . "\n");
}
?>