Manually edit parameters.
[gnucomo.git] / src / web / abuse.php
index 2595e0b..28eb373 100644 (file)
@@ -9,7 +9,7 @@
 ***********************
 **      FILE NAME      : abuse.php
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.1 $
+**      VERSION NUMBER : $Revision: 1.2 $
 **
 **  DESCRIPTION      : Abuse list page
 **
 
 /*****************************
    $Log: abuse.php,v $
-   Revision 1.1  2005-06-04 07:24:38  arjen
+   Revision 1.2  2007-01-11 13:44:29  arjen
+   Manually edit parameters.
+   View logs from abusing IP addresses.
+
+   Revision 1.1  2005/06/04 07:24:38  arjen
    New page: Abuse list
 
 ******************************/
 
-// RCSID = "$Id: abuse.php,v 1.1 2005-06-04 07:24:38 arjen Exp $";
+// RCSID = "$Id: abuse.php,v 1.2 2007-01-11 13:44:29 arjen Exp $";
 
 ini_set('include_path', '.:./classes:../phpclasses');
 
@@ -122,37 +126,60 @@ class abuse_list extends page
                                   "', '$Subnet', '$abuse_points', 'dropped')");
          }
 
-         echo "<form method='post'>";
-         echo "Report <input type='submit' name='ACTION' value='Abuse'>";
-         echo " for IP address <input type='text' name='source'>";
-         echo "</form>"; 
-
-         echo "<form method='post'>";
-         echo "<input type='submit' name='ACTION' value='Investigate'>";
-         echo " or <input type='submit' name='ACTION' value='Block'>";
-         echo " this subnet: <input type='text' name='subnet'>";
-         echo "</form>"; 
-
-         $res = pg_exec($this->database, "SELECT * FROM object_abuse
-                                  WHERE objectid='". $_GET['oid'] ."' ORDER BY source");
-
-         echo pg_numrows($res) . " records found.<br>";
-
-         echo "<table>";
-         echo "<tr><th>IP address</th><th>Abuses</th><th>Status</th></tr>\n";
-
-         for ($ip = 0; $ip < pg_numrows($res); $ip++)
+         if (!empty($_GET['src']))
          {
-            $abuse = pg_fetch_object($res, $ip);
-            echo "<tr><td>";
-            echo $abuse->source;
-            echo "</td><td>";
-            echo $abuse->nr_abuses;
-            echo "</td><td>";
-            echo $abuse->status;
-            echo "</td></tr>";
+            $oid = $_GET['oid'];
+            $src = $_GET['src'];
+            $res = pg_exec($this->database, "SELECT logid FROM log_abuse WHERE objectid=$oid AND source <<= '$src'");
+            echo "<table>";
+            echo "<tr><th>Abused log entry</th></tr>";
+            for ($row = 0; $row < pg_numrows($res); $row++)
+            {
+               $logid = pg_fetch_object($res, $row);
+               //$log = pg_fetch_object(pg_exec($this->database, "SELECT rawdata FROM log WHERE logid=" . $logid->logid), 0);
+               echo "<tr><td>";
+               //echo $log->rawdata;
+               echo $logid->logid;
+               echo "</td></tr>";
+            }
+            echo "</table>";
+         }
+         else
+         {
+            echo "<form method='post'>";
+            echo "Report <input type='submit' name='ACTION' value='Abuse'>";
+            echo " for IP address <input type='text' name='source'>";
+            echo "</form>"; 
+   
+            echo "<form method='post'>";
+            echo "<input type='submit' name='ACTION' value='Investigate'>";
+            echo " or <input type='submit' name='ACTION' value='Block'>";
+            echo " this subnet: <input type='text' name='subnet'>";
+            echo "</form>"; 
+   
+            $res = pg_exec($this->database, "SELECT * FROM object_abuse
+                                     WHERE objectid='". $_GET['oid'] ."' ORDER BY source");
+   
+            echo pg_numrows($res) . " records found.<br>";
+   
+            echo "<table>";
+            echo "<tr><th>IP address</th><th>Abuses</th><th>Status</th><th>Last Changed</th></tr>\n";
+   
+            for ($ip = 0; $ip < pg_numrows($res); $ip++)
+            {
+               $abuse = pg_fetch_object($res, $ip);
+               echo "<tr><td>";
+               echo $abuse->source;
+               echo "</td><td>";
+               echo "<a href='abuse.php?oid=" . $_GET['oid'] . "&src=" . $abuse->source . "'>" .  $abuse->nr_abuses . "</a>";
+               echo "</td><td>";
+               echo $abuse->status;
+               echo "</td><td>";
+               echo $abuse->last_changed;
+               echo "</td></tr>";
+            }
+            echo "</table>";
          }
-         echo "</table>";
       }
    }
 }