From: arjen Date: Mon, 10 Dec 2007 16:29:59 +0000 (+0000) Subject: When blocking a subnet, maintain the references to the log table from X-Git-Tag: V0_0_12~3 X-Git-Url: http://www.andromeda.nl/gitweb/?p=gnucomo.git;a=commitdiff_plain;h=f24ac4a397747221b9d50f996416574aace26bcb When blocking a subnet, maintain the references to the log table from all IP addresses in that subnet. --- diff --git a/src/web/abuse.php b/src/web/abuse.php index 5da4b0d..2f37a57 100644 --- a/src/web/abuse.php +++ b/src/web/abuse.php @@ -9,7 +9,7 @@ *********************** ** FILE NAME : abuse.php ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring -** VERSION NUMBER : $Revision: 1.4 $ +** VERSION NUMBER : $Revision: 1.5 $ ** ** DESCRIPTION : Abuse list page ** @@ -27,7 +27,11 @@ /***************************** $Log: abuse.php,v $ - Revision 1.4 2007-11-21 14:38:06 arjen + Revision 1.5 2007-12-10 16:29:59 arjen + When blocking a subnet, maintain the references to the log table from + all IP addresses in that subnet. + + Revision 1.4 2007/11/21 14:38:06 arjen The buttonbar at the top of each page is now a fixed 'div' element instead of a framed page. Contributed by Edwin Nadorp. @@ -44,7 +48,7 @@ ******************************/ -// RCSID = "$Id: abuse.php,v 1.4 2007-11-21 14:38:06 arjen Exp $"; +// RCSID = "$Id: abuse.php,v 1.5 2007-12-10 16:29:59 arjen Exp $"; ini_set('include_path', '.:./classes:../phpclasses'); @@ -58,6 +62,8 @@ class abuse_list extends page { if (!empty($_GET['oid'])) { + $ObjectId = $_GET['oid']; + $res = pg_exec($this->database, "SELECT objectname FROM object WHERE objectid=CAST('" . $_GET['oid']."' AS BIGINT)"); $obj = pg_fetch_object($res, 0); @@ -133,7 +139,7 @@ class abuse_list extends page echo ""; echo "\n"; - for ($ip = 0; $ip < pg_numrows($res); $ip++) + for ($ip = 0; $ip < pg_num_rows($res); $ip++) { $abuse = pg_fetch_object($res, $ip); echo "
IP addressAbusesStatus
"; @@ -152,10 +158,14 @@ class abuse_list extends page // Block an entire subnet and remove the addresses from the list $Subnet = $_POST['subnet']; - pg_exec($this->database, "DELETE FROM object_abuse WHERE objectid = '" . $_GET['oid'] + pg_exec($this->database, "DELETE FROM object_abuse WHERE objectid = '$ObjectId" . "' AND source << '$Subnet'"); - $abuse_points = 8; - pg_exec($this->database, "INSERT INTO object_abuse VALUES ('" . $_GET['oid'] . + pg_exec($this->database, "UPDATE log_abuse set source='$Subnet' + WHERE objectid='$ObjectId' AND source << '$Subnet'"); + $res = pg_exec($this->database, "SELECT logid FROM log_abuse + WHERE objectid='$ObjectId' AND source = '$Subnet'"); + $abuse_points = pg_num_rows($res); + pg_exec($this->database, "INSERT INTO object_abuse VALUES ('$ObjectId" . "', '$Subnet', '$abuse_points', 'dropped', NOW())"); } @@ -171,7 +181,6 @@ class abuse_list extends page for ($row = 0; $row < pg_numrows($res); $row++) { $log = pg_fetch_object($res, $row); - //$log = pg_fetch_object(pg_exec($this->database, "SELECT rawdata FROM log WHERE logid=" . $logid->logid), 0); echo "
"; echo $log->object_timestamp; echo ""; @@ -184,14 +193,14 @@ class abuse_list extends page } else { - echo "
"; + echo ""; echo "Report "; echo " for IP address "; echo " or "; echo " with status "; echo "
"; - echo "
"; + echo ""; echo ""; echo " or "; echo " this subnet: ";