2006-03-27 05:37:27 +02:00
|
|
|
|
<?php
|
2006-07-20 00:01:47 +02:00
|
|
|
|
// Pandora - the Free monitoring system
|
|
|
|
|
// ====================================
|
|
|
|
|
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
|
2007-10-12 18:27:50 +02:00
|
|
|
|
// Copyright (c) 2005-2006 Artica Soluciones Tecnol<6F>gicas S.L, info@artica.es
|
2006-07-20 00:01:47 +02:00
|
|
|
|
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
|
2008-07-16 23:04:31 +02:00
|
|
|
|
// Copyright (c) 2008-2008 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
2006-07-20 00:01:47 +02:00
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
|
// This program 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 this program; if not, write to the Free Software
|
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
|
|
// Load global vars
|
2008-07-21 14:23:28 +02:00
|
|
|
|
require_once ("include/config.php");
|
2008-07-16 23:04:31 +02:00
|
|
|
|
check_login ();
|
2006-07-20 00:01:47 +02:00
|
|
|
|
|
2008-07-16 23:04:31 +02:00
|
|
|
|
if ((give_acl ($id_user, 0, "DM")==1) or (dame_admin ($id_user)==1)) {
|
2006-03-27 05:37:27 +02:00
|
|
|
|
// Todo for a good DB maintenance
|
|
|
|
|
/*
|
|
|
|
|
- Delete too on datos_string and and datos_inc tables
|
|
|
|
|
|
|
|
|
|
- A function to "compress" data, and interpolate big chunks of data (1 month - 60000 registers)
|
|
|
|
|
onto a small chunk of interpolated data (1 month - 600 registers)
|
|
|
|
|
|
|
|
|
|
- A more powerful selection (by Agent, by Module, etc).
|
|
|
|
|
*/
|
2008-07-16 23:04:31 +02:00
|
|
|
|
require("godmode/db/times_incl.php");
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
2008-07-16 23:04:31 +02:00
|
|
|
|
$datos_rango3=0;
|
|
|
|
|
$datos_rango2=0;
|
|
|
|
|
$datos_rango1=0;
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ADQUIRE DATA PASSED AS FORM PARAMETERS
|
|
|
|
|
# ======================================
|
|
|
|
|
# Purge data using dates
|
|
|
|
|
# Purge data using dates
|
|
|
|
|
if (isset($_POST["purgedb"])){ # Fixed 2005-1-13, nil
|
2008-07-21 14:23:28 +02:00
|
|
|
|
$from_date = get_parameter_post("date_purge");
|
2008-07-16 23:04:31 +02:00
|
|
|
|
$query = sprintf("DELETE FROM `tsesion` WHERE `fecha` < '%s';",$from_date);
|
2008-07-21 14:23:28 +02:00
|
|
|
|
(int) $deleted = process_sql($query);
|
2006-03-27 05:37:27 +02:00
|
|
|
|
}
|
|
|
|
|
# End of get parameters block
|
|
|
|
|
|
2007-05-27 04:55:55 +02:00
|
|
|
|
echo "<h2>".$lang_label["dbmain_title"]." > ";
|
2007-10-12 18:27:50 +02:00
|
|
|
|
echo $lang_label["db_purge_audit"]."</h2>";
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
2007-06-06 18:23:24 +02:00
|
|
|
|
echo "<table cellpadding='4' cellspacing='4' class='databox'>";
|
2006-03-27 05:37:27 +02:00
|
|
|
|
echo "<tr><td class='datos'>";
|
2008-07-16 23:04:31 +02:00
|
|
|
|
$result = get_db_row_sql ("SELECT COUNT(*) AS total, MIN(fecha) AS first_date, MAX(fecha) AS latest_date FROM tsesion");
|
|
|
|
|
|
2007-06-06 18:23:24 +02:00
|
|
|
|
echo "<b>".$lang_label["total"]."</b></td>";
|
2008-07-16 23:04:31 +02:00
|
|
|
|
echo "<td class='datos'>".$result["total"]." ".$lang_label["records"]."</td>";
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
2007-10-12 18:27:50 +02:00
|
|
|
|
echo "<tr>";
|
2007-06-06 18:23:24 +02:00
|
|
|
|
echo "<td class='datos2'><b>".$lang_label["first_date"]."</b></td>";
|
2008-07-16 23:04:31 +02:00
|
|
|
|
echo "<td class='datos2'>".$result["first_date"]."</td></tr>";
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
|
|
echo "<tr><td class='datos'>";
|
2007-06-06 18:23:24 +02:00
|
|
|
|
echo "<b>".$lang_label["latest_date"]."</b></td>";
|
2008-07-16 23:04:31 +02:00
|
|
|
|
echo "<td class='datos'>".$result["latest_date"]."</td>";
|
2007-06-06 18:23:24 +02:00
|
|
|
|
echo "</tr></table>";
|
2006-03-27 05:37:27 +02:00
|
|
|
|
?>
|
|
|
|
|
<h3><?php echo $lang_label["purge_data"] ?></h3>
|
|
|
|
|
<form name="db_audit" method="post" action="index.php?sec=gdbman&sec2=godmode/db/db_audit">
|
2007-06-06 18:23:24 +02:00
|
|
|
|
<table width='300' cellpadding='4' cellspacing='4' class='databox'>
|
2006-03-27 05:37:27 +02:00
|
|
|
|
<tr><td class='datos'>
|
2007-04-18 23:45:03 +02:00
|
|
|
|
<select name="date_purge" width="255px">
|
2006-03-27 05:37:27 +02:00
|
|
|
|
<option value="<?php echo $month3 ?>"><?php echo $lang_label["purge_audit_90day"] ?>
|
|
|
|
|
<option value="<?php echo $month ?>"><?php echo $lang_label["purge_audit_30day"] ?>
|
|
|
|
|
<option value="<?php echo $week2 ?>"><?php echo $lang_label["purge_audit_14day"] ?>
|
|
|
|
|
<option value="<?php echo $week ?>"><?php echo $lang_label["purge_audit_7day"] ?>
|
|
|
|
|
<option value="<?php echo $d3 ?>"><?php echo $lang_label["purge_audit_3day"] ?>
|
|
|
|
|
<option value="<?php echo $d1 ?>"><?php echo $lang_label["purge_audit_1day"] ?>
|
|
|
|
|
<option value="<?php echo $all_data ?>"><?php echo $lang_label["purge_audit_all"] ?>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<td class="datos">
|
2007-06-06 18:23:24 +02:00
|
|
|
|
<input class="sub wand" type="submit" name="purgedb" value="<?php echo $lang_label["doit"] ?>" onClick="if (!confirm('<?php echo $lang_label["are_you_sure"] ?>')) return false;">
|
2006-03-27 05:37:27 +02:00
|
|
|
|
|
|
|
|
|
</table>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
2008-07-16 23:04:31 +02:00
|
|
|
|
} else {
|
2006-03-27 05:37:27 +02:00
|
|
|
|
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Database Management Audit");
|
|
|
|
|
require ("general/noaccess.php");
|
|
|
|
|
}
|
2008-07-16 23:04:31 +02:00
|
|
|
|
?>
|